模板和平仓线、预警线、档位值客户方向判断逻辑修改
This commit is contained in:
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -47,6 +47,21 @@ namespace YLErp.Plugins.GuoLian.DocumentGenerator
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断客户是否为看多方向
|
||||
/// 规则:根据 PosiDirection(收支方向)和 PositionType(多空方向)组合出我方方向,再取反得到客户方向
|
||||
/// </summary>
|
||||
private bool IsCustomerLong(swap_position position)
|
||||
{
|
||||
if (position == null)
|
||||
return false;
|
||||
|
||||
bool isOurLong = position.PosiDirection == (int)SwapDirectionEnum.支付
|
||||
? position.PositionType == (int)PositionTypeFlag.Short // 支付端:我方方向与 PositionType 相反
|
||||
: position.PositionType == (int)PositionTypeFlag.Long; // 收取端:我方方向与 PositionType 相同
|
||||
return !isOurLong;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取收益互换模板路径
|
||||
/// </summary>
|
||||
@@ -55,20 +70,12 @@ namespace YLErp.Plugins.GuoLian.DocumentGenerator
|
||||
var trade = Context.Trade;
|
||||
var underlying = Context.GetTradeUnderlying();
|
||||
|
||||
// 判断客户看多/看空方向:
|
||||
// 先根据 PosiDirection(收支方向)和 PositionType(多空方向)组合出我方方向,再取反得到客户方向。
|
||||
// 判断客户看多/看空方向
|
||||
var swapPosition = Context.GetSwapPositions(trade.id, true)
|
||||
.Where(x => x.PositionType == (int)PositionTypeFlag.Long || x.PositionType == (int)PositionTypeFlag.Short)
|
||||
.FirstOrDefault();
|
||||
|
||||
bool isCustomerLong = false;
|
||||
if (swapPosition != null)
|
||||
{
|
||||
bool isOurLong = swapPosition.PosiDirection == (int)SwapDirectionEnum.支付
|
||||
? swapPosition.PositionType == (int)PositionTypeFlag.Short // 支付端:我方方向与 PositionType 相反
|
||||
: swapPosition.PositionType == (int)PositionTypeFlag.Long; // 收取端:我方方向与 PositionType 相同
|
||||
isCustomerLong = !isOurLong;
|
||||
}
|
||||
bool isCustomerLong = IsCustomerLong(swapPosition);
|
||||
|
||||
// 判断标的类型(债券ETF vs 现券)
|
||||
bool isEtf = IsBondEtf(underlying?.UnderlyingCode ?? string.Empty);
|
||||
@@ -244,7 +251,7 @@ namespace YLErp.Plugins.GuoLian.DocumentGenerator
|
||||
dic["期初预付比例"] = "0.0000";
|
||||
dic["期初预付金额"] = "0.00";
|
||||
}
|
||||
bool posiLong = swapPosition?.PositionType == (int)PositionTypeFlag.Short ? false : true;
|
||||
bool posiLong = IsCustomerLong(swapPosition);
|
||||
// 计算平仓线、预警线、档位值(利率债TRS,固定4档)
|
||||
var maintainRatePercent = (double)(clientMarginRate?.maintain_rate ?? 0) * 100; // 维持保证金率 A(%)
|
||||
if (maintainRatePercent > 0)
|
||||
|
||||
Reference in New Issue
Block a user