对冲交易 持仓名义本金

This commit is contained in:
shangzhongyuan
2025-08-05 17:39:09 +08:00
parent 282554e2e9
commit 3fb50ad1e7
@@ -264,7 +264,7 @@ namespace YLErp.Modules.CalculationModule
newPnl.RealizedPnL += closeProfit;
//减去持仓成本
newPnl.Cost -= openAmount;
newPnl.Cost += closeAmount;
//减去持仓份额
newPnl.Notional -= closeNotional * posSign;
@@ -483,6 +483,11 @@ namespace YLErp.Modules.CalculationModule
/// </summary>
public static string GetHedgeUniqueCode(int BookId, string TradeType, string LongShort, string UnderlyingCode, string ExchangeOptionCode = null)
{
List<string> tradeTypes=new List<string>() { "利率债", "信用债", "其它债券" };
if (tradeTypes.Contains(TradeType))
{
return $"{BookId}_{TradeType}_{UnderlyingCode}".ToUpperInvariant();
}
return $"{BookId}_{TradeType}_{LongShort}_{("".Equals(TradeType) ? ExchangeOptionCode : UnderlyingCode)}".ToUpperInvariant();
}