Merge branch 'glms/feature/1.4.2' of https://gitee.glmszq.com/gsty/onederiv/trs into glms/feature/1.4.2
This commit is contained in:
@@ -62,7 +62,7 @@ namespace YLErp
|
||||
/// 价格四舍五入保留位数
|
||||
/// </summary>
|
||||
|
||||
public const int PriceRound = 10;
|
||||
public const int PriceRound = 11;
|
||||
/// <summary>
|
||||
/// 金额四舍五入保留位数
|
||||
/// </summary>
|
||||
|
||||
@@ -98,12 +98,12 @@ namespace YLErp.DBModels
|
||||
/// 发布时间
|
||||
/// </summary>
|
||||
[Column("insert_time")]
|
||||
public DateTime create_time { get; set; }
|
||||
public DateTime? create_time { get; set; }
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// </summary>
|
||||
[DisplayName("更新时间")]
|
||||
[Column("update_time")]
|
||||
public DateTime update_time { get; set; }
|
||||
public DateTime? update_time { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -609,7 +609,7 @@ namespace YLErp.Modules.SwapModule
|
||||
ExpectedInterest(1, FixedRate, 0.001m, Principal * 0.5m))
|
||||
};
|
||||
var eodInterest = CalcEod("10", new DateTime(2026, 4, 30), eodPositions);
|
||||
var expectedEod = ExpectedInterest(1, FixedRate, 0.001m, Principal * 0.5m);
|
||||
var expectedEod = ExpectedInterest(2, FixedRate, 0.001m, Principal * 0.5m);
|
||||
Assert.AreEqual(expectedEod, eodInterest.InterestAmount);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using MoreLinq.Extensions;
|
||||
using Newtonsoft.Json;
|
||||
using Qdp.Pricing.Library.Base.Utilities;
|
||||
using System.Linq.Expressions;
|
||||
using YLErp.BLL;
|
||||
using YLErp.BLL.Eod;
|
||||
@@ -330,8 +331,9 @@ namespace YLErp.Modules.SwapModule
|
||||
var posiNotionalValue = stockEqvNotional * closePercent;//剩余名义本金
|
||||
var orginPv = lastEod != null ? lastEod.NotionalValue : stockEqvNotional;
|
||||
var grossPrice = realPostitions.Where(x => x.PosiDirection > 0).FirstOrDefault()?.PosiGrossPrice;
|
||||
bool tdClose = DbContext.swap_flow_event.Any(x => x.SwapTradeId == tradeId && x.UnwindDate == unwindDate && eventTypes.Contains(x.EventType) && x.DataState == (int)SwapFlowDateStateEnum.完成);
|
||||
interests = GetInterests(td, tradeExtend, valueDate, unwindDate, lastEodPositions, positions, stockEqvNotional, posiLongNotionalValue, posiShortNotionalValue, posiNotionalValue, closePercent, eventType, tdClose, false, grossPrice ?? 0, orginPv, true, false);
|
||||
var closeList = DbContext.swap_flow_event.Where(x => x.SwapTradeId == tradeId && x.UnwindDate == unwindDate && eventTypes.Contains(x.EventType) && x.DataState == (int)SwapFlowDateStateEnum.完成).ToList();
|
||||
bool tdClose = closeList.Count > 0;
|
||||
interests = GetInterests(td, tradeExtend, valueDate, unwindDate, lastEodPositions, positions, stockEqvNotional, posiLongNotionalValue, posiShortNotionalValue, posiNotionalValue, closePercent, eventType, tdClose, false, grossPrice ?? 0, orginPv, true, false, closeList);
|
||||
return interests;
|
||||
}
|
||||
/// <summary>
|
||||
@@ -369,7 +371,8 @@ namespace YLErp.Modules.SwapModule
|
||||
decimal grossPrice,
|
||||
decimal orginPv,
|
||||
bool add = false,
|
||||
bool settment = true)
|
||||
bool settment = true,
|
||||
List<swap_flow_event> closeList = null)
|
||||
{
|
||||
List<swap_flow_event> interests = new List<swap_flow_event>();
|
||||
var annualDays = tradeExtend == null ? 365 : tradeExtend.ExtendObj.AnnualDays;
|
||||
@@ -406,7 +409,21 @@ namespace YLErp.Modules.SwapModule
|
||||
else
|
||||
{
|
||||
// 盘中互换场景,使用 CalcUnwindInterest
|
||||
interests.Add(CalcUnwindInterest(td, valueDate, endDate, positionClone, rate, floatRate, posiPrincipal, closePrincipal, newClosePercent, annualDays, preEodPosition, eventType, add, swap, orginPv));
|
||||
interests.Add(CalcUnwindInterest(td, valueDate, endDate, positionClone, rate, floatRate, posiPrincipal, closePrincipal, newClosePercent, annualDays, preEodPosition, eventType, add, swap, orginPv, calcFirst, calcLast));
|
||||
}
|
||||
}
|
||||
//当日有平仓或互换记录时,需要把平仓或互换已经结算的利息从计算结果中扣除,避免重复计算
|
||||
if (closeList != null && closeList.Count > 0)
|
||||
{
|
||||
foreach (var item in interests)
|
||||
{
|
||||
var closeEvent = closeList.Where(x => x.PositionId == item.PositionId);
|
||||
var closePnl = closeEvent.Sum(s => s.InterestClosePnL);
|
||||
var closeAmount = closeEvent.Sum(s => s.InterestAmount);
|
||||
var closeTdAmount = closeEvent.Sum(s => s.TdInterestAmount);
|
||||
item.InterestAmount = item.InterestAmount - closeAmount;
|
||||
item.TdInterestAmount = item.TdInterestAmount - closeTdAmount;
|
||||
item.InterestClosePnL = item.InterestClosePnL - closePnl;
|
||||
}
|
||||
}
|
||||
return interests;
|
||||
@@ -557,17 +574,21 @@ namespace YLErp.Modules.SwapModule
|
||||
/// <summary>
|
||||
/// 计算盘中利息(平仓/互换)
|
||||
/// </summary>
|
||||
private swap_flow_event CalcUnwindInterest(trade td, DateTime valueDate, DateTime endDate, swap_position position, decimal rate, decimal floatRate, decimal posiPrincipal, decimal closePrincipal, decimal closePercent, int annualDays, eod_swap_position preEod, int eventType, bool add, bool swap, decimal orginPv)
|
||||
private swap_flow_event CalcUnwindInterest(trade td, DateTime valueDate, DateTime endDate, swap_position position, decimal rate, decimal floatRate, decimal posiPrincipal, decimal closePrincipal, decimal closePercent, int annualDays, eod_swap_position preEod, int eventType, bool add, bool swap, decimal orginPv, bool calcFirst, bool calcLast)
|
||||
{
|
||||
if (preEod.id == 0)
|
||||
{
|
||||
preEod.FloatRate = floatRate;
|
||||
preEod.TdInterestPrincipal = posiPrincipal;
|
||||
preEod.PosiNotionalValue = posiPrincipal;
|
||||
preEod.ValueDate = td.TradeDate.Value;
|
||||
preEod.ValueDate = td.StartDate.Value;
|
||||
if (calcFirst)
|
||||
{
|
||||
preEod.ValueDate= preEod.ValueDate.AddDays(-1);
|
||||
}
|
||||
}
|
||||
|
||||
return InitSwapDealInterest(td, valueDate, endDate, rate, position, add, swap, posiPrincipal, closePrincipal, closePercent, annualDays, eventType, preEod, false, orginPv);
|
||||
return InitSwapDealInterest(td, valueDate, endDate, rate, position, add, swap, posiPrincipal, closePrincipal, closePercent, annualDays, eventType, preEod, false, orginPv, calcFirst, calcLast);
|
||||
}
|
||||
/// <summary>
|
||||
/// 初始化利息腿信息
|
||||
@@ -598,7 +619,9 @@ namespace YLErp.Modules.SwapModule
|
||||
int eventType,
|
||||
eod_swap_position preEodPosition,
|
||||
bool needPrice,
|
||||
decimal orginPv
|
||||
decimal orginPv,
|
||||
bool calcFirst,
|
||||
bool calcLast
|
||||
)
|
||||
{
|
||||
decimal interestProfitSum = preEodPosition.InterestProfitSum;
|
||||
@@ -633,11 +656,11 @@ namespace YLErp.Modules.SwapModule
|
||||
var floateRate = preEodPosition.FloatRate;
|
||||
if (position.InterestType == (int)InterestTypeEnum.复利)
|
||||
{
|
||||
CalcDailyCompoundInterest(preEodPosition, endDate, position, closePosiNotionalValue, posiNotionalValue, interest, annualDays, needPrice, floateRate, closePrecent, orginPv, ref InterestAmount, ref TdInterestAmount);
|
||||
CalcDailyCompoundInterest(preEodPosition, endDate, position, closePosiNotionalValue, posiNotionalValue, interest, annualDays, needPrice, floateRate, closePrecent, orginPv, calcFirst, calcLast, ref InterestAmount, ref TdInterestAmount);
|
||||
}
|
||||
else
|
||||
{
|
||||
CalcDailySimpleInterest(preEodPosition, endDate, position, closePosiNotionalValue, posiNotionalValue, interest, annualDays, needPrice, floateRate, closePrecent, orginPv, ref InterestAmount, ref TdInterestAmount);
|
||||
CalcDailySimpleInterest(preEodPosition, endDate, position, closePosiNotionalValue, posiNotionalValue, interest, annualDays, needPrice, floateRate, closePrecent, orginPv, calcFirst, calcLast, ref InterestAmount, ref TdInterestAmount);
|
||||
}
|
||||
|
||||
interest.InterestAmount = Math.Round(InterestAmount, ConsGlobal.PriceRound, MidpointRounding.AwayFromZero);
|
||||
@@ -661,26 +684,26 @@ namespace YLErp.Modules.SwapModule
|
||||
/// <param name="isAnnualized">是否年化</param>
|
||||
/// <param name="annualDays">年化天数</param>
|
||||
/// <returns></returns>
|
||||
public void CalcDailyCompoundInterest(eod_swap_position preEodPosition, DateTime endDate, swap_position position, decimal principal, decimal posiPrincipal, swap_flow_event flowEvent, int annualDays, bool needPrice, decimal floateRate, decimal closePercent, decimal orginPv, ref decimal InterestAmount, ref decimal TdInterestAmount)
|
||||
public void CalcDailyCompoundInterest(eod_swap_position preEodPosition, DateTime endDate, swap_position position, decimal principal, decimal posiPrincipal, swap_flow_event flowEvent, int annualDays, bool needPrice, decimal floateRate, decimal closePercent, decimal orginPv, bool calcFirst, bool calcLast, ref decimal InterestAmount, ref decimal TdInterestAmount)
|
||||
{
|
||||
// 复利:利息并入本金
|
||||
CalcDailyInterest(preEodPosition, endDate, position, principal, posiPrincipal, flowEvent, annualDays, needPrice, floateRate, closePercent, orginPv, compoundInterest: true, ref InterestAmount, ref TdInterestAmount);
|
||||
CalcDailyInterest(preEodPosition, endDate, position, principal, posiPrincipal, flowEvent, annualDays, needPrice, floateRate, closePercent, orginPv, compoundInterest: true, calcFirst, calcLast, ref InterestAmount, ref TdInterestAmount);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 计算单利 盘中(按重置天数分段,每段使用对应浮动利率)
|
||||
/// </summary>
|
||||
public void CalcDailySimpleInterest(eod_swap_position preEodPosition, DateTime endDate, swap_position position, decimal principal, decimal posiPrincipal, swap_flow_event flowEvent, int annualDays, bool needPrice, decimal floateRate, decimal closePercent, decimal orginPv, ref decimal InterestAmount, ref decimal TdInterestAmount)
|
||||
public void CalcDailySimpleInterest(eod_swap_position preEodPosition, DateTime endDate, swap_position position, decimal principal, decimal posiPrincipal, swap_flow_event flowEvent, int annualDays, bool needPrice, decimal floateRate, decimal closePercent, decimal orginPv, bool calcFirst, bool calcLast, ref decimal InterestAmount, ref decimal TdInterestAmount)
|
||||
{
|
||||
// 单利:利息不并入本金
|
||||
CalcDailyInterest(preEodPosition, endDate, position, principal, posiPrincipal, flowEvent, annualDays, needPrice, floateRate, closePercent, orginPv, compoundInterest: false, ref InterestAmount, ref TdInterestAmount);
|
||||
CalcDailyInterest(preEodPosition, endDate, position, principal, posiPrincipal, flowEvent, annualDays, needPrice, floateRate, closePercent, orginPv, compoundInterest: false,calcFirst,calcLast, ref InterestAmount, ref TdInterestAmount);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通用日度利息计算方法(单利/复利共用)
|
||||
/// </summary>
|
||||
/// <param name="compoundInterest">是否复利:true=利息并入本金,false=单利</param>
|
||||
private void CalcDailyInterest(eod_swap_position preEodPosition, DateTime endDate, swap_position position, decimal principal, decimal posiPrincipal, swap_flow_event flowEvent, int annualDays, bool needPrice, decimal floateRate, decimal closePercent, decimal orginPv, bool compoundInterest, ref decimal InterestAmount, ref decimal TdInterestAmount)
|
||||
private void CalcDailyInterest(eod_swap_position preEodPosition, DateTime endDate, swap_position position, decimal principal, decimal posiPrincipal, swap_flow_event flowEvent, int annualDays, bool needPrice, decimal floateRate, decimal closePercent, decimal orginPv, bool compoundInterest, bool calcFirst, bool calcLast, ref decimal InterestAmount, ref decimal TdInterestAmount)
|
||||
{
|
||||
var startDate = position.PosiStartDate;
|
||||
decimal interestProfitSum = preEodPosition.InterestProfitSum;
|
||||
@@ -695,6 +718,8 @@ namespace YLErp.Modules.SwapModule
|
||||
for (int i = 0; i <= calcDays; i++)
|
||||
{
|
||||
var accrueDate = startDate.AddDays(i);
|
||||
if (!calcFirst && accrueDate == startDate) continue; // 首日不算头
|
||||
if (!calcLast && accrueDate == endDate) continue; // 到期日不算尾
|
||||
if (accrueDate > preEodPosition.ValueDate)
|
||||
{
|
||||
if (i % interestPeriod == 0)
|
||||
|
||||
@@ -977,6 +977,7 @@ namespace YLErp.Modules.SwapModule
|
||||
newEodPayPosition.TdInterestFee = flowEvents.Sum(s => s.InterestFee);
|
||||
newEodPayPosition.TdCloseInterestFee = newEodPayPosition.TdInterestFee;
|
||||
newEodPayPosition.TdCloseInterest = flowEvents.Sum(s => s.InterestClosePnL);
|
||||
newEodPayPosition.TdInterestIncome = TdInterestAmount * (1 - closePercent);
|
||||
Log.Info($"InterestIncomeSum is {eodPayPosition.InterestIncomeSum},TdInterestIncome is {newEodPayPosition.TdInterestIncome}" +
|
||||
$",TdCloseInterest is {newEodPayPosition.TdCloseInterest}");
|
||||
Log.Info($"InterestFeeSum is {eodPayPosition.InterestFeeSum},TdInterestFee is {newEodPayPosition.TdInterestFee}" +
|
||||
@@ -987,10 +988,9 @@ namespace YLErp.Modules.SwapModule
|
||||
}
|
||||
else
|
||||
{
|
||||
newEodPayPosition.InterestIncomeSum = eodPayPosition.InterestIncomeSum + TdInterestAmount - newEodPayPosition.TdCloseInterest * ratio;
|
||||
newEodPayPosition.InterestIncomeSum = eodPayPosition.InterestIncomeSum + newEodPayPosition.TdInterestIncome - newEodPayPosition.TdCloseInterest * ratio;
|
||||
}
|
||||
//持仓内容-利息腿-损益统计(本方视角)
|
||||
newEodPayPosition.TdInterestIncome = TdInterestAmount * (1 - closePercent);
|
||||
newEodPayPosition.InterestFeeSum = eodPayPosition.InterestFeeSum + newEodPayPosition.TdInterestFee - newEodPayPosition.TdCloseInterestFee;
|
||||
newEodPayPosition.InterestProfitSum = newEodPayPosition.InterestIncomeSum + newEodPayPosition.InterestFeeSum;
|
||||
//持仓价值
|
||||
@@ -1451,9 +1451,9 @@ namespace YLErp.Modules.SwapModule
|
||||
curretEod.PosiNetPrice = (eod.PosiNetPrice * eod.PosiQuantity + openFlowEvents.Sum(a => a.Quantity * a.TradingAmountFeeAvg)) / (eod.PosiQuantity + openQty);
|
||||
curretEod.PosiNetPrice = Math.Round(curretEod.PosiNetPrice, ConsGlobal.PriceRound, MidpointRounding.AwayFromZero);
|
||||
curretEod.PosiNetNoFeePrice = (eod.PosiNetNoFeePrice * eod.PosiQuantity + openFlowEvents.Sum(a => a.Quantity * a.TradingAmountNetAvg)) / (eod.PosiQuantity + openQty);
|
||||
curretEod.PosiNetNoFeePrice = Math.Round(curretEod.PosiNetNoFeePrice ?? 0, 10, MidpointRounding.AwayFromZero);
|
||||
curretEod.PosiNetNoFeePrice = Math.Round(curretEod.PosiNetNoFeePrice ?? 0, ConsGlobal.PriceRound, MidpointRounding.AwayFromZero);
|
||||
curretEod.PosiNetFeePrice = (eod.PosiNetFeePrice * eod.PosiQuantity + openFlowEvents.Sum(a => a.Quantity * a.TradingAmountNetFeeAvg)) / (eod.PosiQuantity + openQty);
|
||||
curretEod.PosiNetFeePrice = Math.Round(curretEod.PosiNetFeePrice ?? 0, 10, MidpointRounding.AwayFromZero);
|
||||
curretEod.PosiNetFeePrice = Math.Round(curretEod.PosiNetFeePrice ?? 0, ConsGlobal.PriceRound, MidpointRounding.AwayFromZero);
|
||||
}
|
||||
curretEod.PosiNotionalValue = curretEod.PosiGrossPrice * curretEod.PosiQuantity * curretEod.ContractSize;
|
||||
curretEod.PosiNotionalValue = Math.Round(curretEod.PosiNotionalValue, ConsGlobal.MoneyRound, MidpointRounding.AwayFromZero);
|
||||
|
||||
@@ -1355,7 +1355,7 @@ namespace YLErp.Modules.SwapModule
|
||||
position.PosiNetNoFeePrice = swap.PosiNetNoFeePrice;
|
||||
position.PosiNetFeePrice = swap.PosiQuantity == 0 ? 0 : (swap.PosiNetNoFeePrice + (position.PosiTradingFeePending / swap.PosiQuantity) * ratio);
|
||||
position.PosiNetFeePrice = Math.Round(position.PosiNetFeePrice??0, ConsGlobal.PriceRound, MidpointRounding.AwayFromZero);
|
||||
position.PosiNotionalValue = position.PosiGrossPrice * swap.PosiQuantity * swap.ContractSize;
|
||||
position.PosiNotionalValue = swap.PosiNotionalValue;
|
||||
position.PosiQuantity = swap.PosiQuantity;
|
||||
position.InterestDirection = swap.InterestDirection;
|
||||
position.InterestMode = swap.InterestMode;
|
||||
|
||||
@@ -1833,6 +1833,10 @@ namespace YLErp.Modules.TradeModule.DealModule
|
||||
td.OptId = UserId;
|
||||
td.OptName = UserName;
|
||||
td.OptDate = OptDate;
|
||||
if (td.TradeStatus!=ConsTrade.确认成交)
|
||||
{
|
||||
throw new Exception("当前交易状态不是确认成交");
|
||||
}
|
||||
if (isSwap)
|
||||
{
|
||||
td.TradeStatus = ConsTrade.互换待复核;
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
var main = main || {};
|
||||
main.formatOptions={"trading":{"umprice":{"trimTailZeros":true,"precision":9,"grouping":true,"rounded":true,"percent":false,"minDecimals":2,"maxDecimals":9},"umpriceP":{"trimTailZeros":true,"percent":true,"precision":9,"grouping":false,"rounded":true,"minDecimals":2,"maxDecimals":9},"umpricePR":{"trimTailZeros":true,"precision":9,"grouping":false,"rounded":true,"percent":false,"minDecimals":2,"maxDecimals":9},"tradeSinglePrice":{"trimTailZeros":true,"precision":9,"grouping":true,"rounded":true,"percent":false,"minDecimals":2,"maxDecimals":9},"premiumRateP":{"trimTailZeros":true,"percent":true,"precision":9,"grouping":false,"rounded":true,"minDecimals":2,"maxDecimals":9},"premiumRate":{"trimTailZeros":true,"precision":9,"grouping":false,"rounded":true,"percent":false,"minDecimals":2,"maxDecimals":9},"tradePrice":{"trimTailZeros":true,"precision":9,"grouping":false,"rounded":true,"percent":false,"minDecimals":2,"maxDecimals":9},"StockEqvNotional":{"trimTailZeros":true,"precision":9,"grouping":true,"rounded":true,"percent":false,"minDecimals":2,"maxDecimals":9},"notional":{"trimTailZeros":true,"precision":9,"grouping":true,"rounded":true,"percent":false,"minDecimals":2,"maxDecimals":9},"notionalP":{"trimTailZeros":true,"percent":true,"precision":9,"grouping":false,"rounded":true,"minDecimals":2,"maxDecimals":9},"volatility":{"trimTailZeros":true,"precision":9,"grouping":false,"rounded":true,"percent":false,"minDecimals":2,"maxDecimals":9},"volatilityP":{"trimTailZeros":true,"percent":true,"precision":9,"grouping":false,"rounded":true,"minDecimals":2,"maxDecimals":9},"greek":{"trimTailZeros":true,"precision":9,"grouping":false,"rounded":true,"percent":false,"minDecimals":2,"maxDecimals":9},"marginRateP":{"trimTailZeros":true,"percent":true,"precision":9,"grouping":false,"rounded":true,"minDecimals":2,"maxDecimals":9},"marginRate":{"trimTailZeros":true,"precision":9,"grouping":false,"rounded":true,"percent":false,"minDecimals":2,"maxDecimals":9}}};
|
||||
main.formatOptions = { "trading": { "umprice": { "trimTailZeros": true, "precision": 9, "grouping": true, "rounded": true, "percent": false, "minDecimals": 2, "maxDecimals": 9 }, "umpriceP": { "trimTailZeros": true, "percent": true, "precision": 9, "grouping": false, "rounded": true, "minDecimals": 2, "maxDecimals": 9 }, "umpricePR": { "trimTailZeros": true, "precision": 9, "grouping": false, "rounded": true, "percent": false, "minDecimals": 2, "maxDecimals": 9 }, "tradeSinglePrice": { "trimTailZeros": true, "precision": 9, "grouping": true, "rounded": true, "percent": false, "minDecimals": 2, "maxDecimals": 9 }, "premiumRateP": { "trimTailZeros": true, "percent": true, "precision": 9, "grouping": false, "rounded": true, "minDecimals": 2, "maxDecimals": 9 }, "premiumRate": { "trimTailZeros": true, "precision": 9, "grouping": false, "rounded": true, "percent": false, "minDecimals": 2, "maxDecimals": 9 }, "tradePrice": { "trimTailZeros": true, "precision": 9, "grouping": false, "rounded": true, "percent": false, "minDecimals": 2, "maxDecimals": 9 }, "StockEqvNotional": { "trimTailZeros": true, "precision": 9, "grouping": true, "rounded": true, "percent": false, "minDecimals": 2, "maxDecimals": 9 }, "notional": { "trimTailZeros": true, "precision": 9, "grouping": true, "rounded": true, "percent": false, "minDecimals": 2, "maxDecimals": 9 }, "notionalP": { "trimTailZeros": true, "percent": true, "precision": 9, "grouping": false, "rounded": true, "minDecimals": 2, "maxDecimals": 9 }, "volatility": { "trimTailZeros": true, "precision": 9, "grouping": false, "rounded": true, "percent": false, "minDecimals": 2, "maxDecimals": 9 }, "volatilityP": { "trimTailZeros": true, "percent": true, "precision": 9, "grouping": false, "rounded": true, "minDecimals": 2, "maxDecimals": 9 }, "greek": { "trimTailZeros": true, "precision": 9, "grouping": false, "rounded": true, "percent": false, "minDecimals": 2, "maxDecimals": 9 }, "marginRateP": { "trimTailZeros": true, "percent": true, "precision": 9, "grouping": false, "rounded": true, "minDecimals": 2, "maxDecimals": 9 }, "marginRate": { "trimTailZeros": true, "precision": 9, "grouping": false, "rounded": true, "percent": false, "minDecimals": 2, "maxDecimals": 9 } } };
|
||||
-1
@@ -1 +0,0 @@
|
||||
var main=main||{};main.formatOptions={trading:{umprice:{precision:9,grouping:!0,rounded:!0,percent:!1,minDecimals:9,maxDecimals:0},umpriceP:{percent:!0,precision:6,grouping:!1,rounded:!0,minDecimals:6,maxDecimals:0},umpricePR:{precision:8,grouping:!1,rounded:!0,percent:!1,minDecimals:8,maxDecimals:2},tradeSinglePrice:{precision:6,grouping:!0,rounded:!0,percent:!1,minDecimals:6,maxDecimals:0},premiumRateP:{percent:!0,precision:4,grouping:!1,rounded:!0,minDecimals:4,maxDecimals:0},premiumRate:{precision:6,grouping:!1,rounded:!0,percent:!1,minDecimals:6,maxDecimals:2},tradePrice:{precision:2,grouping:!1,rounded:!0,percent:!1,minDecimals:2,maxDecimals:0},StockEqvNotional:{precision:2,grouping:!0,rounded:!0,percent:!1,minDecimals:2,maxDecimals:0},notional:{precision:4,grouping:!0,rounded:!0,percent:!1,minDecimals:4,maxDecimals:0},notionalP:{percent:!0,precision:4,grouping:!1,rounded:!0,minDecimals:4,maxDecimals:0},volatility:{precision:4,grouping:!1,rounded:!0,percent:!1,minDecimals:4,maxDecimals:2},volatilityP:{percent:!0,precision:2,grouping:!1,rounded:!0,minDecimals:2,maxDecimals:0},greek:{precision:3,grouping:!1,rounded:!0,percent:!1,minDecimals:3,maxDecimals:0},marginRateP:{percent:!0,precision:4,grouping:!1,rounded:!0,minDecimals:4,maxDecimals:0},marginRate:{precision:6,grouping:!1,rounded:!0,percent:!1,minDecimals:6,maxDecimals:2}}};
|
||||
@@ -146,7 +146,7 @@
|
||||
<td>{{priceFormat(floatPosition.PosiGrossPrice)}}</td>
|
||||
<td>{{priceFormat(floatPosition.TradingAmountNetAvg)}}</td>
|
||||
<td>
|
||||
<vue-number-input v-model="floatPosition.TradingAmountAvg" v-bind:format="inputFormatEqvNotional" v-on:input="changeUnderlyingPrice"></vue-number-input>
|
||||
<vue-number-input v-model="floatPosition.TradingAmountAvg" v-bind:format="inputFormatEqvNotional" v-on:input="changeUnderlyingPrice" style="width:107px;"></vue-number-input>
|
||||
<input class="text-box" v-model="floatPosition.TradingAmountAvg" v-on:blur="changeUnderlyingPrice" type="number" min="0" v-else />
|
||||
<a href="javascript:void(0)" v-on:click="refreshUnderlyingPrice()">
|
||||
<span title="使用系统标的价格" class="glyphicon glyphicon-refresh"></span>
|
||||
|
||||
@@ -197,7 +197,7 @@
|
||||
</td>
|
||||
<td>{{priceFormat(floatPosition.PosiGrossPrice)}}</td>
|
||||
<td>
|
||||
<vue-number-input v-model="floatPosition.TradingAmountAvg" v-bind:format="inputFormatEqvNotional" v-on:input="changeUnderlyingPrice"></vue-number-input>
|
||||
<vue-number-input v-model="floatPosition.TradingAmountAvg" v-bind:format="inputFormatEqvNotional" v-on:input="changeUnderlyingPrice" style="width:107px;"></vue-number-input>
|
||||
<a href="javascript:void(0)" v-on:click="refreshUnderlyingPrice()">
|
||||
<span title="使用系统标的价格" class="glyphicon glyphicon-refresh"></span>
|
||||
</a>
|
||||
|
||||
@@ -63,8 +63,8 @@ const vue = new Vue({
|
||||
this.floatPosition.Quantity = otcformat.trading.notional(this.floatPosition.Quantity);
|
||||
this.floatPosition.PositionQty = otcformat.trading.notional(this.floatPosition.PositionQty);
|
||||
this.deal.SwapCloseAmount = otcformat.trading.StockEqvNotional(this.deal.SwapCloseAmount);
|
||||
this.floatPosition.PosiNetPrice = otcformat.trading.umprice(this.floatPosition.PosiNetPrice);
|
||||
this.floatPosition.PosiGrossPrice = otcformat.trading.umprice(this.floatPosition.PosiGrossPrice);
|
||||
//this.floatPosition.PosiNetPrice = otcformat.trading.umprice(this.floatPosition.PosiNetPrice);
|
||||
//this.floatPosition.PosiGrossPrice = otcformat.trading.umprice(this.floatPosition.PosiGrossPrice);
|
||||
this.floatPosition.TradingFee = otcformat.trading.StockEqvNotional(this.floatPosition.TradingFee);
|
||||
this.floatPosition.DividendIn = otcformat.trading.StockEqvNotional(this.floatPosition.DividendIn);
|
||||
this.floatPosition.MarkClosePnl = otcformat.trading.StockEqvNotional(this.floatPosition.MarkClosePnl);
|
||||
|
||||
@@ -268,9 +268,9 @@ const vue = new Vue({
|
||||
this.getSpotPrice(payItem.UnderlyingCode, this.trade.StartDate, payItem);
|
||||
}
|
||||
var national = payItem.PosiQuantity * payItem.ContractSize;
|
||||
var stockEqvNotional = payItem.PosiGrossPrice * national;//名义本金=期初价格*数量*乘数
|
||||
var stockEqvNotional = _.round(payItem.PosiGrossPrice * national, 2);//名义本金=期初价格*数量*乘数
|
||||
this.trade.StockEqvNotional = otcformat.trading.stockEqvNotional(stockEqvNotional);
|
||||
payItem.PosiNotionalValue = this.StockEqvNotional;
|
||||
payItem.PosiNotionalValue = this.trade.StockEqvNotional;
|
||||
}
|
||||
},
|
||||
//变更到期日
|
||||
|
||||
@@ -76,8 +76,8 @@ const vue = new Vue({
|
||||
this.deal.CloseQty = otcformat.trading.notional(this.deal.CloseQty);
|
||||
this.deal.ClosePercent = otcformat.fixed6(this.deal.ClosePercent);
|
||||
this.deal.SwapCloseAmount = otcformat.trading.StockEqvNotional(this.deal.SwapCloseAmount);
|
||||
this.floatPosition.PosiNetPrice = otcformat.trading.tradeSinglePrice(this.floatPosition.PosiNetPrice);
|
||||
this.floatPosition.PosiGrossPrice = otcformat.trading.tradeSinglePrice(this.floatPosition.PosiGrossPrice);
|
||||
//this.floatPosition.PosiNetPrice = otcformat.trading.tradeSinglePrice(this.floatPosition.PosiNetPrice);
|
||||
//this.floatPosition.PosiGrossPrice = otcformat.trading.tradeSinglePrice(this.floatPosition.PosiGrossPrice);
|
||||
this.floatPosition.TradingAmountAvg = otcformat.trading.tradeSinglePrice(this.floatPosition.TradingAmountAvg);
|
||||
this.floatPosition.TradingFee = otcformat.trading.StockEqvNotional(this.floatPosition.TradingFee);
|
||||
this.floatPosition.TradingFeePending = otcformat.trading.StockEqvNotional(this.floatPosition.TradingFeePending);
|
||||
|
||||
@@ -194,7 +194,7 @@ li > input {
|
||||
}
|
||||
|
||||
.swapflowtr input, .swapflowtr select {
|
||||
width: 91px;
|
||||
width: 113px;
|
||||
}
|
||||
|
||||
.swappay, .swappay select {
|
||||
|
||||
Reference in New Issue
Block a user