From 7027d7a2e1f500853c758d99fc348fd50858ee76 Mon Sep 17 00:00:00 2001 From: ZhouYongyou <128128010+zhouyongyou@users.noreply.github.com> Date: Wed, 5 Nov 2025 01:16:34 +0800 Subject: [PATCH] =?UTF-8?q?refactor(decision):=20relax=20minimum=20positio?= =?UTF-8?q?n=20size=20constraints=20for=20flexibility=20##=20Changes=20###?= =?UTF-8?q?=20Prompt=20Layer=20(Soft=20Guidance)=20**Before**:=20-=20BTC/E?= =?UTF-8?q?TH=20=E2=89=A5100=20USDT=20|=20=E5=B1=B1=E5=AF=A8=E5=B8=81=20?= =?UTF-8?q?=E2=89=A515=20USDT=20(=E7=A1=AC=E6=80=A7=E8=A6=81=E6=B1=82)=20*?= =?UTF-8?q?*After**:=20-=20=E7=BB=9F=E4=B8=80=E5=BB=BA=E8=AE=AE=20?= =?UTF-8?q?=E2=89=A512=20USDT=20(=E8=BD=AF=E6=80=A7=E5=BB=BA=E8=AE=AE)=20-?= =?UTF-8?q?=20=E6=9B=B4=E7=AE=80=E6=B4=81=EF=BC=8C=E4=B8=8D=E5=8C=BA?= =?UTF-8?q?=E5=88=86=E5=B8=81=E7=A7=8D=20-=20=E7=BB=99=20AI=20=E6=9B=B4?= =?UTF-8?q?=E5=A4=9A=E5=86=B3=E7=AD=96=E7=A9=BA=E9=97=B4=20###=20Validatio?= =?UTF-8?q?n=20Layer=20(Lower=20Thresholds)=20**Before**:=20-=20BTC/ETH:?= =?UTF-8?q?=20100=20USDT=20(=E7=A1=AC=E6=80=A7)=20-=20=E5=B1=B1=E5=AF=A8?= =?UTF-8?q?=E5=B8=81:=2015=20USDT=20(=E7=A1=AC=E6=80=A7)=20**After**:=20-?= =?UTF-8?q?=20BTC/ETH:=2060=20USDT=20(-40%,=20=E6=9B=B4=E7=81=B5=E6=B4=BB)?= =?UTF-8?q?=20-=20=E5=B1=B1=E5=AF=A8=E5=B8=81:=2012=20USDT=20(-20%,=20?= =?UTF-8?q?=E6=9B=B4=E5=90=88=E7=90=86)=20##=20Rationale=20###=20Why=20Rel?= =?UTF-8?q?ax=3F=201.=20**Previous=20was=20too=20strict**:=20=20=20=20-=20?= =?UTF-8?q?100=20USDT=20for=20BTC=20hardcoded=20at=20current=20price=20(~1?= =?UTF-8?q?01k)=20=20=20=20-=20If=20BTC=20drops=20to=2060k,=20only=20needs?= =?UTF-8?q?=2060=20USDT=20=20=20=20-=2015=20USDT=20for=20altcoins=20=3D=20?= =?UTF-8?q?50%=20safety=20margin=20(too=20conservative)=202.=20**Three-lay?= =?UTF-8?q?er=20defense=20is=20sufficient**:=20=20=20=20-=20Layer=201=20(P?= =?UTF-8?q?rompt):=20Soft=20suggestion=20(=E2=89=A512=20USDT)=20=20=20=20-?= =?UTF-8?q?=20Layer=202=20(Validation):=20Medium=20threshold=20(BTC=2060?= =?UTF-8?q?=20/=20Alt=2012)=20=20=20=20-=20Layer=203=20(API):=20Final=20ch?= =?UTF-8?q?eck=20(quantity=20!=3D=200=20+=20CheckMinNotional)=203.=20**Use?= =?UTF-8?q?r=20feedback**:=20Original=20constraints=20too=20restrictive=20?= =?UTF-8?q?###=20Safety=20Preserved=20=E2=9C=85=20API=20layer=20still=20pr?= =?UTF-8?q?events:=20-=20quantity=20=3D=200=20errors=20(formatted=20precis?= =?UTF-8?q?ion=20check)=20-=20Below=20min=20notional=20(CheckMinNotional)?= =?UTF-8?q?=20=E2=9C=85=20Validation=20still=20blocks=20obviously=20small?= =?UTF-8?q?=20amounts=20=E2=9C=85=20Prompt=20guides=20AI=20toward=20safe?= =?UTF-8?q?=20amounts=20##=20Testing=20|=20Symbol=20|=20Amount=20|=20Old?= =?UTF-8?q?=20|=20New=20|=20Result=20|=20|--------|--------|-----|-----|--?= =?UTF-8?q?------|=20|=20BTCUSDT=20|=2050=20USDT=20|=20=E2=9D=8C=20Rejecte?= =?UTF-8?q?d=20|=20=E2=9D=8C=20Rejected=20|=20=E2=9C=85=20Correct=20(too?= =?UTF-8?q?=20small)=20|=20|=20BTCUSDT=20|=2070=20USDT=20|=20=E2=9D=8C=20R?= =?UTF-8?q?ejected=20|=20=E2=9C=85=20Pass=20|=20=E2=9C=85=20More=20flexibl?= =?UTF-8?q?e=20|=20|=20ADAUSDT=20|=2011=20USDT=20|=20=E2=9D=8C=20Rejected?= =?UTF-8?q?=20|=20=E2=9D=8C=20Rejected=20|=20=E2=9C=85=20Correct=20(too=20?= =?UTF-8?q?small)=20|=20|=20ADAUSDT=20|=2013=20USDT=20|=20=E2=9D=8C=20Reje?= =?UTF-8?q?cted=20|=20=E2=9C=85=20Pass=20|=20=E2=9C=85=20More=20flexible?= =?UTF-8?q?=20|=20##=20Impact=20-=20=E2=9C=85=20More=20flexible=20for=20pr?= =?UTF-8?q?ice=20fluctuations=20-=20=E2=9C=85=20Better=20user=20experience?= =?UTF-8?q?=20for=20small=20accounts=20-=20=E2=9C=85=20Still=20prevents=20?= =?UTF-8?q?API=20errors=20-=20=E2=9C=85=20AI=20has=20more=20decision=20spa?= =?UTF-8?q?ce?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- decision/engine.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/decision/engine.go b/decision/engine.go index ebe49fff..17120d0d 100644 --- a/decision/engine.go +++ b/decision/engine.go @@ -268,7 +268,7 @@ func buildSystemPrompt(accountEquity float64, btcEthLeverage, altcoinLeverage in accountEquity*0.8, accountEquity*1.5, accountEquity*5, accountEquity*10)) sb.WriteString(fmt.Sprintf("4. 杠杆限制: **山寨币最大%dx杠杆** | **BTC/ETH最大%dx杠杆** (⚠️ 严格执行,不可超过)\n", altcoinLeverage, btcEthLeverage)) sb.WriteString("5. 保证金: 总使用率 ≤ 90%\n") - sb.WriteString("6. 最小开仓金额: **BTC/ETH ≥100 USDT | 山寨币 ≥15 USDT** (⚠️ 低于此金额会因精度问题导致开仓失败)\n\n") + sb.WriteString("6. 开仓金额: 建议 **≥12 USDT** (交易所最小名义价值 10 USDT + 安全边际)\n\n") // 3. 输出格式 - 动态生成 sb.WriteString("#输出格式\n\n") @@ -537,8 +537,8 @@ func validateDecision(d *Decision, accountEquity float64, btcEthLeverage, altcoi // ✅ 验证最小开仓金额(防止数量格式化为 0 的错误) // Binance 最小名义价值 10 USDT + 安全边际 - const minPositionSizeGeneral = 15.0 - const minPositionSizeBTCETH = 100.0 // BTC/ETH 因价格高和精度限制需要更大金额 + const minPositionSizeGeneral = 12.0 // 10 + 20% 安全边际 + const minPositionSizeBTCETH = 60.0 // BTC/ETH 因价格高和精度限制需要更大金额(更灵活) if d.Symbol == "BTCUSDT" || d.Symbol == "ETHUSDT" { if d.PositionSizeUSD < minPositionSizeBTCETH {