diff --git a/YLErpWeb/Controllers/SwapTrade2Controller.cs b/YLErpWeb/Controllers/SwapTrade2Controller.cs index 6b174297..ff1d159c 100644 --- a/YLErpWeb/Controllers/SwapTrade2Controller.cs +++ b/YLErpWeb/Controllers/SwapTrade2Controller.cs @@ -51,6 +51,7 @@ namespace YLErp.Web.Controllers OpenFeeType = 0, InterestCalcMode = "10", SettlementRules=0, + DividendPayDate=0 }; r = new trade() { diff --git a/YLErpWeb/Controllers/underlying_managerController.cs b/YLErpWeb/Controllers/underlying_managerController.cs index 85e08a03..851b449b 100644 --- a/YLErpWeb/Controllers/underlying_managerController.cs +++ b/YLErpWeb/Controllers/underlying_managerController.cs @@ -307,6 +307,7 @@ namespace YLErp.Web.Controllers if (EodPriceQueryService.TryGetEodPrice(valuedate.Value, code, out var eodPrice)) { price = eodPrice.GetPrice((SettlementTypeEnum)settlementType); + return JsonSuccessData(price); } } diff --git a/YLErpWeb/Views/SwapTrade2/SwapIncome.cshtml b/YLErpWeb/Views/SwapTrade2/SwapIncome.cshtml index 6142bde6..330b81a4 100644 --- a/YLErpWeb/Views/SwapTrade2/SwapIncome.cshtml +++ b/YLErpWeb/Views/SwapTrade2/SwapIncome.cshtml @@ -1,4 +1,4 @@ -@model UnwindData +@model UnwindData @{ ViewBag.Title = "交易 | 收益结算"; Layout = "~/Views/Shared/_InfoLayout.cshtml"; @@ -133,10 +133,12 @@ 收支方向 多空方向 标的代码 - 期初标的交割全价% - 期初标的交割净价% - 标的价格% - 持仓数量 + 期初标的交割全价% + 期初标的交割净价% + 期初标的价格 + 期末标的交割全价% + 期末标的价格 + 数量 交易费用(平仓) 分红收益 浮动端平仓盈亏 @@ -150,9 +152,9 @@ {{floatPosition.UnderlyingCode}} {{priceFormat(floatPosition.PosiGrossPrice)}} - {{priceFormat(floatPosition.TradingAmountNetAvg)}} + {{priceFormat(floatPosition.TradingAmountNetAvg)}} - {{floatPosition.TradingAmountAvg}} + {{priceFormat(floatPosition.TradingAmountAvg)}} {{floatPosition.Quantity}} diff --git a/YLErpWeb/Views/SwapTrade2/SwapUnwind.cshtml b/YLErpWeb/Views/SwapTrade2/SwapUnwind.cshtml index 612995b4..1bb5484d 100644 --- a/YLErpWeb/Views/SwapTrade2/SwapUnwind.cshtml +++ b/YLErpWeb/Views/SwapTrade2/SwapUnwind.cshtml @@ -1,4 +1,4 @@ -@model UnwindData +@model UnwindData @{ ViewBag.Title = "交易 | 交易平仓"; Layout = "~/Views/Shared/_InfoLayout.cshtml"; @@ -179,9 +179,11 @@ 收支方向 多空方向 标的代码 - 期初标的交割全价% - 期末标的交割全价% - 持仓数量 + 期初标的交割全价% + 期初标的价格 + 期末标的交割全价% + 期末标的价格 + 数量 交易费用(平仓) 交易费用(待结算) 分红收益 diff --git a/YLErpWeb/Views/SwapTrade2/TradeEdit.cshtml b/YLErpWeb/Views/SwapTrade2/TradeEdit.cshtml index 84fb3dff..6d020bd2 100644 --- a/YLErpWeb/Views/SwapTrade2/TradeEdit.cshtml +++ b/YLErpWeb/Views/SwapTrade2/TradeEdit.cshtml @@ -423,9 +423,10 @@ 收支方向 多空方向 标的代码 - 期初标的交割全价% - 期初标的交割净价% - 期初标的成交收益率% + 期初标的交割全价% + 期初标的交割净价% + 期初标的成交收益率% + 期初标的价格 数量 交易费用后付 @@ -443,19 +444,23 @@ - + + - - + + - - + + - - + + + + + {{item.underlying!=null?item.underlying.QuoteUnitString:''}} diff --git a/YLErpWeb/Views/SwapTrade2/TradeView.cshtml b/YLErpWeb/Views/SwapTrade2/TradeView.cshtml index c1d42011..a1f946dc 100644 --- a/YLErpWeb/Views/SwapTrade2/TradeView.cshtml +++ b/YLErpWeb/Views/SwapTrade2/TradeView.cshtml @@ -22,9 +22,10 @@ var swap_deals = trade.swap_Events.Where(x => x.EventType == (int)SwapEventTypeEnum.互换 || x.EventType == (int)SwapEventTypeEnum.自动互换).ToList();//单标的/多空组合互换 互换记录 var closeSwapDeals = trade.swap_Events.Where(x => x.EventType == (int)SwapEventTypeEnum.平仓).ToList();//单标的互换 平仓记录 bool isBond = trade.StructureType == "普通债券类收益互换"; - string spotPriceTitle = "期初标的交割全价%"; - string netSportPriceTitle = "期初标的交割净价%"; - string initYtmTitle = "期初标的成交收益率%"; + string spotPriceTitle = isBond ? "期初标的交割全价%" : "期初标的价格"; + string netSportPriceTitle = isBond ? "期初标的交割净价%" : string.Empty; + string initYtmTitle = isBond ? "期初标的成交收益率%" : string.Empty; + string endSpotPriceTitle = isBond ? "期末标的交割全价%" : "期末标的价格"; var positions = trade.swap_positions.Where(x=>x.PosiDirection>0&&x.IsInitial).ToList(); var realPositions = trade.swap_positions.Where(x => x.PosiDirection > 0 && !x.IsInitial).ToList(); var sr = trade.trade_extend.ExtendObj.SettlementRules; @@ -368,8 +369,11 @@ 多空方向 标的代码 @spotPriceTitle - @netSportPriceTitle - @initYtmTitle + @if (isBond) + { + @netSportPriceTitle + @initYtmTitle + } 数量 交易费用后付 @@ -384,12 +388,15 @@ @((item.PosiGrossPrice * multiplier).OtcFormat(OtcFormatFlag.umprice)) - - @(((item.PosiNetNoFeePrice ?? 0) * multiplier).OtcFormat(OtcFormatFlag.umprice)) - - - @((item.InitYtm * multiplier).OtcFormat(OtcFormatFlag.umprice)) - + @if (isBond) + { + + @(((item.PosiNetNoFeePrice ?? 0) * multiplier).OtcFormat(OtcFormatFlag.umprice)) + + + @((item.InitYtm * multiplier).OtcFormat(OtcFormatFlag.umprice)) + + } @item.PosiQuantity.OtcFormat(OtcFormatFlag.StockEqvNotional) @@ -561,8 +568,11 @@ 多空方向 标的代码 @spotPriceTitle - @netSportPriceTitle - 持仓数量 + @if (isBond) + { + @netSportPriceTitle + } + 数量 持仓名义本金 交易费用后付 起始日期 @@ -583,9 +593,12 @@ @((item.PosiGrossPrice * multiplier).OtcFormat(OtcFormatFlag.umprice)) - - @(((item.PosiNetNoFeePrice ?? 0) * multiplier).OtcFormat(OtcFormatFlag.umprice)) - + @if (isBond) + { + + @(((item.PosiNetNoFeePrice ?? 0) * multiplier).OtcFormat(OtcFormatFlag.umprice)) + + } @item.PosiQuantity.OtcFormat(OtcFormatFlag.StockEqvNotional) @@ -761,9 +774,17 @@ 收支方向 多空方向 标的代码 - 期初标的交割全价% - 期末标的交割全价% - 平仓数量 + @if (isBond) + { + 期初标的交割全价% + 期末标的交割全价% + } + else + { + 期初标的价格 + 期末标的价格 + } + 数量 交易费用 交易费用(待结算) 分红收益 @@ -773,8 +794,16 @@ @((SwapDirectionEnum)closeFloat.PayDirection) @(closeFloat.PositionType == (int)PositionTypeFlag.Long ? "多头" : "空头") @closeFloat.UnderlyingCode - @((closeFloat.PosiGrossPrice * multiplier).OtcFormat(OtcFormatFlag.umprice)) - @((closeFloat.TradingAmountAvg * multiplier).OtcFormat(OtcFormatFlag.umprice)) + @if (isBond) + { + @((closeFloat.PosiGrossPrice * multiplier).OtcFormat(OtcFormatFlag.umprice)) + @((closeFloat.TradingAmountAvg * multiplier).OtcFormat(OtcFormatFlag.umprice)) + } + else + { + @(closeFloat.PosiGrossPrice.OtcFormat(OtcFormatFlag.umprice)) + @(closeFloat.TradingAmountAvg.OtcFormat(OtcFormatFlag.umprice)) + } @(closeFloat.Quantity.OtcFormat(OtcFormatFlag.StockEqvNotional)) @(closeFloat.TradingFee.OtcFormat(OtcFormatFlag.StockEqvNotional)) @(closeFloat.TradingFeePending.OtcFormat(OtcFormatFlag.StockEqvNotional)) @@ -938,10 +967,18 @@ 收支方向 多空方向 标的代码 - @spotPriceTitle - @netSportPriceTitle - 标的价格% - 持仓数量 + @if (isBond) + { + @spotPriceTitle + @netSportPriceTitle + + } + else + { + 标的价格 + } + @endSpotPriceTitle + 数量 交易费用 分红收益 浮动端平仓盈亏 @@ -950,9 +987,16 @@ @((SwapDirectionEnum)closeFloat.PayDirection) @(closeFloat.PositionType == (int)PositionTypeFlag.Long ? "多头" : "空头") @closeFloat.UnderlyingCode - @((closeFloat.PosiGrossPrice * multiplier).OtcFormat(OtcFormatFlag.umpriceP)) - @(((closeFloat.TradingAmountNetAvg ?? 0) * multiplier).OtcFormat(OtcFormatFlag.umpriceP)) - @((closeFloat.TradingAmountAvg * multiplier).OtcFormat(OtcFormatFlag.umpriceP)) + @if (isBond) + { + @((closeFloat.PosiGrossPrice * multiplier).OtcFormat(OtcFormatFlag.umprice)) + @(((closeFloat.TradingAmountNetAvg ?? 0) * multiplier).OtcFormat(OtcFormatFlag.umprice)) + } + else + { + @((closeFloat.TradingAmountAvg * multiplier).OtcFormat(OtcFormatFlag.umprice)) + } + @((closeFloat.TradingAmountAvg * multiplier).OtcFormat(OtcFormatFlag.umprice)) @((closeFloat.PositionQty??0).OtcFormat(OtcFormatFlag.StockEqvNotional)) @(closeFloat.TradingFee.OtcFormat(OtcFormatFlag.StockEqvNotional)) @(closeFloat.DividendIn.OtcFormat(OtcFormatFlag.StockEqvNotional)) @@ -1057,4 +1101,4 @@ @if (!string.IsNullOrWhiteSpace(Context.Request.Query["abstract"])) { @await Html.PartialAsync("/Views/trade/_part/TradeAbstractInfo.cshtml", Model.Trade) -} \ No newline at end of file +} diff --git a/YLErpWeb/wwwroot/Scripts/app/swaptrade/incomeSwapTrade.js b/YLErpWeb/wwwroot/Scripts/app/swaptrade/incomeSwapTrade.js index 358338b5..565f67f4 100644 --- a/YLErpWeb/wwwroot/Scripts/app/swaptrade/incomeSwapTrade.js +++ b/YLErpWeb/wwwroot/Scripts/app/swaptrade/incomeSwapTrade.js @@ -1,4 +1,4 @@ -//otcformat禁止千分位分组 +//otcformat禁止千分位分组 window.otcformat.options.disableGrouping = true; const inputFormatSwapRate = Object.freeze({ precision: otcformat.trading.premiumRateP.precision, append: '%' }); @@ -27,13 +27,14 @@ const vue = new Vue({ } }, created() { + this.multiplier = this.deal.StructureType == '普通债券类收益互换' ? 100 : 1; this.initDeal(); this.setValueDate(); - if (this.deal.StructureType != '普通收益互换') { - this.multiplier = 100; - } }, methods: { + getPriceScale() { + return this.multiplier == 100 ? 0.01 : 1; + }, initDeal() { var positions = model.FlowEvents.filter((item) => { return item.UnderlyingCode; @@ -41,7 +42,7 @@ const vue = new Vue({ this.floatPosition = positions[0]; this.initPosiNetPrice = this.floatPosition.PosiNetPrice; // 互换标的价格固定为期初净价,与平仓不同不需要用户填写 - this.floatPosition.TradingAmountAvg = this.initPosiNetPrice * 100; + this.floatPosition.TradingAmountAvg = this.initPosiNetPrice; this.interestList = model.FlowEvents.filter((item) => { return item.InterestMode == 1 || item.InterestMode == 2 || item.InterestMode == 7 || item.InterestMode == 8 || item.InterestMode == 9; }); @@ -114,7 +115,8 @@ const vue = new Vue({ let TradingFee = thisObj.floatPosition.TradingFee == "" ? 0 : parseFloat(thisObj.floatPosition.TradingFee); let TradingFeePending = thisObj.floatPosition.TradingFeePending == "" ? 0 : parseFloat(thisObj.floatPosition.TradingFeePending); let DividendIn = thisObj.floatPosition.DividendIn == "" ? 0 : parseFloat(thisObj.floatPosition.DividendIn ?? 0); - thisObj.floatPosition.MarkClosePnl = thisObj.deal.CloseNotionalValue * (thisObj.floatPosition.TradingAmountAvg*0.01 - thisObj.initPosiNetPrice) * floatRatio; + let scale = thisObj.getPriceScale(); + thisObj.floatPosition.MarkClosePnl = thisObj.deal.CloseNotionalValue * (thisObj.floatPosition.TradingAmountAvg * scale - thisObj.initPosiNetPrice) * floatRatio; thisObj.floatPosition.MarkClosePnl = thisObj.floatPosition.MarkClosePnl + TradingFee + TradingFeePending + DividendIn; thisObj.floatPosition.MarkClosePnl = otcformat.trading.StockEqvNotional(thisObj.floatPosition.MarkClosePnl); thisObj.calcCloseAmount(); @@ -133,12 +135,13 @@ const vue = new Vue({ thisObj.deal.SwapRealizedPnL = pnl; thisObj.deal.SwapMarginRebatePnl = 0; thisObj.deal.SwapMarginAmount = 0; - thisObj.floatPosition.TradingAmount = parseFloat(thisObj.floatPosition.TradingAmountAvg) * parseFloat(thisObj.deal.CloseNotionalValue) * 0.01; + let scale = thisObj.getPriceScale(); + thisObj.floatPosition.TradingAmount = parseFloat(thisObj.floatPosition.TradingAmountAvg) * parseFloat(thisObj.deal.CloseNotionalValue) * scale; thisObj.floatPosition.CloseFee = TradingFee; if (thisObj.deal.CloseQty > 0) { - thisObj.floatPosition.TradingAmountFeeAvg = parseFloat(thisObj.floatPosition.TradingAmountAvg) * 0.01 + (TradingFee / thisObj.deal.CloseQty) * floatRatio; + thisObj.floatPosition.TradingAmountFeeAvg = parseFloat(thisObj.floatPosition.TradingAmountAvg) * scale + (TradingFee / thisObj.deal.CloseQty) * floatRatio; } else { - thisObj.floatPosition.TradingAmountFeeAvg = parseFloat(thisObj.floatPosition.TradingAmountAvg) * 0.01; + thisObj.floatPosition.TradingAmountFeeAvg = parseFloat(thisObj.floatPosition.TradingAmountAvg) * scale; } this.interestList.forEach(x => { //let interestRatio = x.InterestDirection == 1 ? 1 : -1; @@ -201,7 +204,7 @@ const vue = new Vue({ thisObj.floatPosition.EventDate = thisObj.deal.ValueDate; let floatPosition = _.cloneDeep(thisObj.floatPosition); floatPosition.Quantity = 0; - floatPosition.TradingAmountAvg = floatPosition.TradingAmountAvg * 0.01; + floatPosition.TradingAmountAvg = floatPosition.TradingAmountAvg * thisObj.getPriceScale(); reqObj.FlowEvents.push(floatPosition); var postData = { unwindData: reqObj }; var msg = "确认提交收益结算?"; diff --git a/YLErpWeb/wwwroot/Scripts/app/swaptrade/swapTradeEdit.js b/YLErpWeb/wwwroot/Scripts/app/swaptrade/swapTradeEdit.js index bd63138b..f139c027 100644 --- a/YLErpWeb/wwwroot/Scripts/app/swaptrade/swapTradeEdit.js +++ b/YLErpWeb/wwwroot/Scripts/app/swaptrade/swapTradeEdit.js @@ -11,14 +11,22 @@ const inputFormatEqvNotional = Object.freeze({ precision: otcformat.trading.Stoc const inputFormatTradeAmount = Object.freeze({ precision: otcformat.trading.notional.precision, append: '' }); const inputFormatSwapRate = Object.freeze({ precision: otcformat.trading.premiumRateP.precision, negative: true, append: '%' }); const inputFormatTradePrice = Object.freeze({ precision: otcformat.trading.tradePrice.precision, negative: true, append: '' }); -const inputFormatTradeSinglePrice = Object.freeze({ precision: otcformat.trading.tradeSinglePrice.precision, negative: true, append: '' }); +const inputFormatTradeSinglePrice = Object.freeze({ precision: otcformat.trading.tradeSinglePrice.precision, negative: true, append: '', percent: false }); const inputFormatMarginRate = Object.freeze({ precision: otcformat.trading.marginRateP.precision, append: '%' }); const inputFormatMarginRateNoPercent = Object.freeze({ precision: otcformat.trading.umpriceP.precision, append: '', percent:true }); -const consUnderlyingFlag = (function () { +const consUnderlyingFlagBase = (function () { let unSelFlag = tradeHelper.UnderlyingSelectFlag; return unSelFlag.UseForTrading | unSelFlag.IncludeMatured | unSelFlag.UsePinYinFilter | unSelFlag.IncludeBasket | unSelFlag.IncludeSynthetic | unSelFlag.CheckLaunch; }()); +const consUnderlyingFlagNonBond = (function () { + let unSelFlag = tradeHelper.UnderlyingSelectFlag; + return consUnderlyingFlagBase | unSelFlag.Stock | unSelFlag.StockIndex | unSelFlag.StockIF | unSelFlag.CommodityFutures | unSelFlag.CommoditySpot; +}()); +const consUnderlyingFlagBond = (function () { + let unSelFlag = tradeHelper.UnderlyingSelectFlag; + return consUnderlyingFlagBase | unSelFlag.CreditBonds | unSelFlag.Bonds | unSelFlag.TBonds | unSelFlag.OtherBonds; +}()); const inputFormatDouble2 = Object.freeze({ precision: 2, append: '' }); var autoMarginTemplateName; @@ -42,16 +50,14 @@ const consNumberFormat = Object.freeze(new function () { return this; }()); -//标的选择组件 -const vueUnderlying = function () { +const createVueUnderlying = function (selectFlag) { return { props: ['value', 'index'], data() { return { autoUnderlying: null }; }, mounted() { - var selFlag = tradeHelper.UnderlyingSelectFlag; - this.autoUnderlying = tradeHelper.UnderlyingAutoComplete(this.$el, { SelectFlag: selFlag.UsePinYinFilter | selFlag.UseForTrading | selFlag.IncludeSynthetic | selFlag.IncludeMatured | selFlag.IncludeBasket | selFlag.CheckLaunch, BlackLimit: 2, }); + this.autoUnderlying = tradeHelper.UnderlyingAutoComplete(this.$el, { SelectFlag: selectFlag, BlackLimit: 2, }); this.autoUnderlying.onSelect(this.onchange); this.value && this.autoUnderlying.selectByCode(this.value); }, @@ -67,6 +73,12 @@ const vueUnderlying = function () { template: '' }; }; +const vueUnderlyingNonBond = function () { + return createVueUnderlying(consUnderlyingFlagNonBond); +}; +const vueUnderlyingBond = function () { + return createVueUnderlying(consUnderlyingFlagBond); +}; //标的选择组件 银行间回购定盘&其他利率 const vueUnderlyingRate = function () { @@ -177,11 +189,6 @@ const vue = new Vue({ this.initSwapRateList(); }, methods: { - getPosiPriceFormat(item) { - return tradeHelper.IsBond(item && item.UnderlyingInstrumentType) - ? inputFormatMarginRateNoPercent - : inputFormatTradeSinglePrice; - }, getPosiPriceFormatKey(item, field) { const index = item && item.index != null ? item.index : ''; const isBond = tradeHelper.IsBond(item && item.UnderlyingInstrumentType); @@ -189,6 +196,13 @@ const vue = new Vue({ }, changeStructureType() { this.trade.StockEqvNotional = 0; + let direction = this.trade.trade_extend.ExtendObj.Direction; + if (direction !== 1 && direction !== 2) { + direction = 2; + this.trade.trade_extend.ExtendObj.Direction = direction; + } + this.paySwapList = []; + this.addSwapFloat(direction); //this.trade.trade_extend.ExtendObj.FlowBookMode = 0; }, //变更初始预付金收取方向 @@ -1432,7 +1446,8 @@ const vue = new Vue({ components: { 'vue-datepicker': FastVue.vueDatePicker(), 'vue-number-input': FastVue.vueNumberInput(), - 'vue-underlying': vueUnderlying(), + 'vue-underlying-nonbond': vueUnderlyingNonBond(), + 'vue-underlying-bond': vueUnderlyingBond(), 'vue-underlying-rate': vueUnderlyingRate() }, destroyed() { diff --git a/YLErpWeb/wwwroot/Scripts/app/swaptrade/unwindSwapTrade.js b/YLErpWeb/wwwroot/Scripts/app/swaptrade/unwindSwapTrade.js index c880359d..3e95a768 100644 --- a/YLErpWeb/wwwroot/Scripts/app/swaptrade/unwindSwapTrade.js +++ b/YLErpWeb/wwwroot/Scripts/app/swaptrade/unwindSwapTrade.js @@ -1,4 +1,4 @@ -//otcformat禁止千分位分组 +//otcformat禁止千分位分组 window.otcformat.options.disableGrouping = true; const inputFormatSwapRate = Object.freeze({ precision: otcformat.trading.premiumRateP.precision, append: '%' }); @@ -30,13 +30,14 @@ const vue = new Vue({ } }, created() { - if (this.deal.StructureType != '普通收益互换') { - this.multiplier = 100; - } + this.multiplier = this.deal.StructureType == '普通债券类收益互换' ? 100 : 1; this.initDeal(); this.setUnwindDate(); }, methods: { + getPriceScale() { + return this.multiplier == 100 ? 0.01 : 1; + }, initDeal() { var positions = model.FlowEvents.filter((item) => { return item.UnderlyingCode; @@ -187,7 +188,7 @@ const vue = new Vue({ main.post("/underlying_manager/GetUnderlyingPriceByCode", { code: thisObj.floatPosition.UnderlyingCode, valuedate: thisObj.deal.ValueDate }) .done(function (res) { - res.obj = res.obj * 100; + res.obj = res.obj * thisObj.multiplier; thisObj.floatPosition.TradingAmountAvg = otcformat.trading.tradeSinglePrice(res.obj); thisObj.calcFloatClosePnl(); }); @@ -198,7 +199,8 @@ const vue = new Vue({ let longRatio = thisObj.floatPosition.PositionType == 1 ? 1 : -1; let TradingFee = thisObj.floatPosition.TradingFee == "" ? 0 : parseFloat(thisObj.floatPosition.TradingFee); let TradingFeePending = thisObj.floatPosition.TradingFeePending == "" ? 0 : parseFloat(thisObj.floatPosition.TradingFeePending); - thisObj.floatPosition.MarkClosePnl = Math.round(thisObj.deal.CloseQty * (thisObj.floatPosition.TradingAmountAvg*0.01 - thisObj.initPosiNetPrice) * floatRatio * longRatio * 10000) / 10000; + let scale = thisObj.getPriceScale(); + thisObj.floatPosition.MarkClosePnl = Math.round(thisObj.deal.CloseQty * (thisObj.floatPosition.TradingAmountAvg * scale - thisObj.initPosiNetPrice) * floatRatio * longRatio * 10000) / 10000; thisObj.floatPosition.MarkClosePnl = Number(thisObj.floatPosition.MarkClosePnl.toFixed(2)); thisObj.floatPosition.MarkClosePnl = thisObj.floatPosition.MarkClosePnl + (TradingFee + TradingFeePending) * floatRatio * -1 + parseFloat(thisObj.floatPosition.DividendIn); thisObj.floatPosition.MarkClosePnl = otcformat.trading.StockEqvNotional(thisObj.floatPosition.MarkClosePnl); @@ -228,12 +230,13 @@ const vue = new Vue({ thisObj.deal.SwapRealizedPnL = pnl; thisObj.deal.SwapMarginRebatePnl = 0; thisObj.deal.SwapMarginAmount = 0; - thisObj.floatPosition.TradingAmount = parseFloat(thisObj.floatPosition.TradingAmountAvg) * parseFloat(thisObj.deal.CloseQty) * 0.01; + let scale = thisObj.getPriceScale(); + thisObj.floatPosition.TradingAmount = parseFloat(thisObj.floatPosition.TradingAmountAvg) * parseFloat(thisObj.deal.CloseQty) * scale; thisObj.floatPosition.CloseFee = TradingFee; if (thisObj.deal.CloseQty == 0) { thisObj.floatPosition.TradingAmountFeeAvg = 0; } else { - thisObj.floatPosition.TradingAmountFeeAvg = parseFloat(thisObj.floatPosition.TradingAmountAvg) * 0.01 + (TradingFee / thisObj.deal.CloseQty) * ratio; + thisObj.floatPosition.TradingAmountFeeAvg = parseFloat(thisObj.floatPosition.TradingAmountAvg) * scale + (TradingFee / thisObj.deal.CloseQty) * ratio; } this.interestList.forEach(x => { /*let interestRatio = x.InterestDirection == 1 ? 1 : -1;*/ @@ -325,7 +328,7 @@ const vue = new Vue({ thisObj.floatPosition.EventDate = thisObj.deal.ValueDate; let floatPosition = _.cloneDeep(thisObj.floatPosition); floatPosition.Quantity = reqObj.CloseQty; - floatPosition.TradingAmountAvg = floatPosition.TradingAmountAvg * 0.01; + floatPosition.TradingAmountAvg = floatPosition.TradingAmountAvg * thisObj.getPriceScale(); reqObj.FlowEvents.push(floatPosition); var postData = { unwindData: reqObj }; var msg = "确认提交平仓?"; diff --git a/YLErpWeb/wwwroot/Scripts/app/tradeHelper.js b/YLErpWeb/wwwroot/Scripts/app/tradeHelper.js index 564d5697..f920ddc2 100644 --- a/YLErpWeb/wwwroot/Scripts/app/tradeHelper.js +++ b/YLErpWeb/wwwroot/Scripts/app/tradeHelper.js @@ -1,4 +1,4 @@ -//tradeHelper +//tradeHelper (function () { function tradeHelper() { } @@ -362,22 +362,22 @@ function __getPostData() { let options = this.options; let sf = options.SelectFlag; - let InstrumentTypes = options.InstrumentTypes; - (sf & SelectFlag.Stock) > 0 && (InstrumentTypes.push('Stock')); - (sf & SelectFlag.StockIndex) > 0 && (InstrumentTypes.push('StockIndex')); - (sf & SelectFlag.CommodityFutures) > 0 && (InstrumentTypes.push('CommodityFutures')); - (sf & SelectFlag.CommoditySpot) > 0 && (InstrumentTypes.push('CommoditySpot')); - (sf & SelectFlag.CreditBonds) > 0 && (InstrumentTypes.push('CreditBonds')); - (sf & SelectFlag.Bonds) > 0 && (InstrumentTypes.push('Bonds')); - (sf & SelectFlag.TBonds) > 0 && (InstrumentTypes.push('TBonds')); - (sf & SelectFlag.OtherBonds) > 0 && (InstrumentTypes.push('OtherBonds')); + let instrumentTypes = Array.isArray(options.InstrumentTypes) ? options.InstrumentTypes.slice() : []; + (sf & SelectFlag.Stock) > 0 && (instrumentTypes.push('Stock')); + (sf & SelectFlag.StockIndex) > 0 && (instrumentTypes.push('StockIndex')); + (sf & SelectFlag.CommodityFutures) > 0 && (instrumentTypes.push('CommodityFutures')); + (sf & SelectFlag.CommoditySpot) > 0 && (instrumentTypes.push('CommoditySpot')); + (sf & SelectFlag.CreditBonds) > 0 && (instrumentTypes.push('CreditBonds')); + (sf & SelectFlag.Bonds) > 0 && (instrumentTypes.push('Bonds')); + (sf & SelectFlag.TBonds) > 0 && (instrumentTypes.push('TBonds')); + (sf & SelectFlag.OtherBonds) > 0 && (instrumentTypes.push('OtherBonds')); return { FilterCode: '{{{q}}}', ClientId: options.ClientId, VarietyId: options.VarietyId, BlackLimit: options.BlackLimit, MaxShowLength: options.MaxShowLength, - InstrumentTypes: InstrumentTypes, + InstrumentTypes: instrumentTypes, UsePinYinFilter: (sf & (SelectFlag.UsePinYinFilter | SelectFlag.Stock | SelectFlag.StockIndex)) > 0, IncludeMatured: (sf & SelectFlag.IncludeMatured) > 0, OnlySynthetic: (sf & SelectFlag.OnlySynthetic) > 0, @@ -728,4 +728,4 @@ }(window.tradeHelper)); -Object.freeze(window.tradeHelper); \ No newline at end of file +Object.freeze(window.tradeHelper);