From 789c882448dffdca788ec000035ff95b41fe35a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=94=A6=E9=BA=9F=20=E7=8E=8B?= Date: Mon, 13 Apr 2026 14:55:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=94=B6=E7=9B=8A=E4=BA=92?= =?UTF-8?q?=E6=8D=A2=E6=96=B9=E5=90=91=E5=88=A4=E6=96=AD=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=8C=E7=A7=BB=E9=99=A4=E5=86=97=E4=BD=99=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TradeConfirmationGenerator.cs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/Plugins/YLErp.Plugins.GuoLian/DocumentGenerator/TradeConfirmationGenerator.cs b/Plugins/YLErp.Plugins.GuoLian/DocumentGenerator/TradeConfirmationGenerator.cs index 5fba935c..b31c7d7c 100644 --- a/Plugins/YLErp.Plugins.GuoLian/DocumentGenerator/TradeConfirmationGenerator.cs +++ b/Plugins/YLErp.Plugins.GuoLian/DocumentGenerator/TradeConfirmationGenerator.cs @@ -54,8 +54,11 @@ namespace YLErp.Plugins.GuoLian.DocumentGenerator var trade = Context.Trade; var underlying = Context.GetTradeUnderlying(); - // 判断看多/看空方向 - bool isLong = IsLongPosition(trade); + // 判断看多/看空方向(通过持仓方向判断:PositionType: 1=多头/看多,2=空头/看空) + var swapPosition = Context.GetSwapPositions(trade.id, true) + .Where(x => x.PositionType == (int)PositionTypeFlag.Long || x.PositionType == (int)PositionTypeFlag.Short) + .FirstOrDefault(); + bool isLong = swapPosition?.PositionType == (int)PositionTypeFlag.Long; // 判断标的类型(债券ETF vs 现券) bool isEtf = IsBondEtf(underlying?.UnderlyingCode ?? string.Empty); @@ -74,15 +77,6 @@ namespace YLErp.Plugins.GuoLian.DocumentGenerator return Path.Combine(GlobalConfig.PluginFolder, "App_Docs\\contract_template", templateName); } - /// - /// 判断是否为多头/看多方向 - /// - private bool IsLongPosition(OtcTradeBase trade) - { - // 通过BuySell判断:买入=看多,卖出=看空 - return trade.BuySell == "买入"; - } - /// /// 判断是否为债券ETF /// - .SH后缀且511开头 -> 债券ETF