124 lines
4.7 KiB
Plaintext
124 lines
4.7 KiB
Plaintext
@model volatility
|
|
@{
|
|
ViewBag.Title = "波动率曲面 | 数据导入";
|
|
Layout = "~/Views/Shared/_InfoLayout.cshtml";
|
|
var sysDate = ViewBag.valueDate;
|
|
}
|
|
|
|
@section JS
|
|
{
|
|
<script src="~/Scripts/app/tradeHelper.js?v=@HtmlUtil.JsVersion"></script>
|
|
<script type="text/javascript">
|
|
var valueDate = "@sysDate";
|
|
//是否使用更加精确的波动率
|
|
var g_volMoreAccurate = "@YLErp.PS.Config.ErpElement.VolMoreAccurate" == "True";
|
|
$(function () {
|
|
|
|
$(".datepicker").datepicker({ changeMonth: true, changeYear: true, showButtonPanel: true, showOtherMonths: true, selectOtherMonths: true });
|
|
$(".datepicker").val(valueDate);
|
|
|
|
$('#openFile').change(function () {
|
|
var file = this.files[0];
|
|
name = file.name;
|
|
size = file.size;
|
|
type = file.type;
|
|
alert(name + " " + size + " " + type);
|
|
});
|
|
|
|
let flag = tradeHelper.UnderlyingSelectFlag;
|
|
let underlyingCtrl = new tradeHelper.UnderlyingSelectCtrl('#UnderlyingIds').setFlag(flag.UsePinYinFilter | flag.IncludeMatured);
|
|
});
|
|
|
|
function downLoadVolatility() {
|
|
if ($('#UnderlyingIds').val() == null || $('#UnderlyingIds').val() == "" || $('#UnderlyingIds').val() == undefined) {
|
|
return main.confirm("确定导出所有标的对应的波动率信息吗?", function () {
|
|
execDown();
|
|
});
|
|
} else {
|
|
execDown();
|
|
}
|
|
}
|
|
function getExpireDay(expire) {
|
|
var mu = expire.substr(expire.length - 1, 1);
|
|
var data = expire.substr(0, expire.length - 1);
|
|
var drate = 1;
|
|
switch (mu) {
|
|
case "W": drate = 7; break;
|
|
case "M": drate = 30; break;
|
|
case "Y": drate = 365; break;
|
|
}
|
|
return data * drate;
|
|
}
|
|
//到期日排序
|
|
function compareExpire(value1, value2) {
|
|
//D W M Y
|
|
//定义排序规则
|
|
var ruleArr = ['D', 'W', 'M', 'Y'];
|
|
//查找value1 和 value2 在数组中的索引
|
|
var index1 = getExpireDay(value1);
|
|
var index2 = getExpireDay(value2);
|
|
//通过比较索引的大小来判断是否进行交换
|
|
//todo
|
|
|
|
if (index1 > index2) {
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
function execDown() {
|
|
$('form')[0].submit();
|
|
}
|
|
|
|
function progressHandlingFunction(e) {
|
|
if (e.lengthComputable) {
|
|
$('progress').attr({ value: e.loaded, max: e.total });
|
|
}
|
|
}
|
|
|
|
function checkData() {
|
|
if ($('#UnderlyingIds').val() == null || $('#UnderlyingIds').val() == "" || $('#UnderlyingIds').val() == undefined) {
|
|
return main.confirm("确定导出所有已启用标的对应的波动率信息吗?", function () {
|
|
return true;
|
|
});
|
|
}
|
|
var pass = $('#volatilityUploadForm').valid();
|
|
return pass;
|
|
}
|
|
</script>
|
|
}
|
|
|
|
@section CSS{
|
|
<style>
|
|
.form-layout input, .form-layout select { width: 220px !important; }
|
|
</style>
|
|
}
|
|
@using (Html.BeginForm("downLoadVolSurfaceList", "volatility", FormMethod.Post, new { id = "volatilityUploadForm" }))
|
|
{
|
|
<div class="form-layout">
|
|
@Html.MyDateFor(model => model.QuotationDate, true)
|
|
@Html.MyDropdownFor1(model => model.VolType, GlobalData.GetSelectItems(YLErp.QdpModule.Constants.ConsVolInfos.VolTypesFormat), appendBlank: false)
|
|
<div class="form-group col-md-6">
|
|
<label class="form-label">标的代码</label>
|
|
<select data-placeholder="请选择 标的代码" id="UnderlyingIds" multiple="multiple" name="UnderlyingIds"></select>
|
|
</div>
|
|
<div class="form-group col-md-6">
|
|
<span style="color:red">(注:如果不选择,则默认为选择全部已启用标的)</span>
|
|
</div>
|
|
@if (YLErp.PS.Config.Is国泰君安)
|
|
{
|
|
@Html.MyDropdownFor1(model => model.VolSurfaceMode, GlobalData.GetSelectItems(YLErp.QdpModule.Constants.ConsVolInfos.Gtja_VolSurfaceModes), "", appendBlank: false)
|
|
}
|
|
else
|
|
{
|
|
@Html.MyDropdownFor1(model => model.VolSurfaceMode, GlobalData.GetSelectItems(YLErp.QdpModule.Constants.ConsVolInfos.VolSurfaceModes), appendBlank: false)
|
|
}
|
|
</div>
|
|
<div class="form-buttons">
|
|
@MyControls.Btn("导出", "downLoadVolatility()")
|
|
@MyControls.Btn("关闭", "layer.closeMe()")
|
|
</div>
|
|
}
|
|
<a onfocus="this.blur();" download="code.csv" id="createInvote" class="ipt-todo hide"></a>
|