feat: position sizing follows the strategy config — default 4x equity notional

Positions were stuck at ~equity×1.2 (~$420 on a $500 account) no matter
what the strategy said: both the manager load path and the per-cycle config
reload hardcoded vergex strategies to a 6-position × equity×1.2 book,
silently overriding the configured 10x ratio. Both overrides removed —
sizing now comes from the strategy's own RiskControl (ClampLimits bounds it,
margin auto-reduce keeps the book solvent).

Defaults aligned across all three config sources (backend default template,
quick-create preset, studio unified config): 2 positions × 4x equity
notional at 10x leverage ≈ 80% margin when both are open — concentrated per
the operator's request. Live strategy updated via relaunch; loader log
confirms maxPos=2 posRatio=4.0.
This commit is contained in:
tinkle-community
2026-07-10 19:12:52 +09:00
parent 8c8cd9b61f
commit 7a66d048f3
6 changed files with 23 additions and 28 deletions

View File

@@ -658,15 +658,10 @@ func (tm *TraderManager) addTraderFromStore(traderCfg *store.Trader, aiModelCfg
return fmt.Errorf("failed to parse strategy config for trader %s: %w", traderCfg.Name, err)
}
strategyConfig.ClampLimits()
// Autopilot (vergex_signal/claw402) runs a balanced multi-position book:
// hold several instruments with a smaller per-position notional so multiple
// long/short positions fit the margin. Applied after ClampLimits so it is
// not capped back to the conservative single-position default.
if strategyConfig.CoinSource.SourceType == "vergex_signal" {
strategyConfig.RiskControl.MaxPositions = 6
strategyConfig.RiskControl.BTCETHMaxPositionValueRatio = 1.2
strategyConfig.RiskControl.AltcoinMaxPositionValueRatio = 1.2
}
// Sizing comes from the strategy's own RiskControl (a hardcoded
// 6-position × equity×1.2 override used to live here, silently ignoring
// the user's configuration). ClampLimits bounds the values and the
// margin auto-reduce at order time keeps the book solvent.
logger.Infof("✓ Trader %s loaded strategy config: %s (maxPos=%d, posRatio=%.1f)", traderCfg.Name, strategy.Name, strategyConfig.RiskControl.MaxPositions, strategyConfig.RiskControl.AltcoinMaxPositionValueRatio)
ensureHyperliquidNativeStrategy(traderCfg.Name, exchangeCfg.ExchangeType, strategyConfig)
} else {