feat(strategy): support Hyperliquid stock strategy editing

- Extend strategy storage and engine analysis for Hyperliquid defaults

- Rework coin source and indicator editors for the stock strategy flow

- Update Strategy Studio translations and page wiring
This commit is contained in:
tinklefund
2026-05-25 01:25:05 +08:00
parent c7c003cc3c
commit 5bdffee3b0
8 changed files with 903 additions and 1114 deletions

View File

@@ -84,6 +84,7 @@ func GetFullDecisionWithStrategy(ctx *Context, mcpClient mcp.AIClient, engine *S
return nil, fmt.Errorf("failed to fetch market data: %w", err)
}
}
pruneCandidateCoinsWithoutMarketData(ctx)
// Ensure OITopDataMap is initialized
if ctx.OITopDataMap == nil {
@@ -223,6 +224,21 @@ func fetchMarketDataWithStrategy(ctx *Context, engine *StrategyEngine) error {
return nil
}
func pruneCandidateCoinsWithoutMarketData(ctx *Context) {
if ctx == nil || len(ctx.CandidateCoins) == 0 || len(ctx.MarketDataMap) == 0 {
return
}
kept := make([]CandidateCoin, 0, len(ctx.CandidateCoins))
for _, coin := range ctx.CandidateCoins {
if _, ok := ctx.MarketDataMap[coin.Symbol]; ok {
kept = append(kept, coin)
continue
}
logger.Infof("⚠️ Skipping candidate %s in AI prompt: no valid market/K-line data", coin.Symbol)
}
ctx.CandidateCoins = kept
}
// ============================================================================
// AI Response Parsing
// ============================================================================