mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-05 20:11:13 +08:00
feat: improve AI decision input format and chart UX
Backend changes: - Add symbol headers to market data sections for clarity - Add symbol labels to quantitative data output - Skip position coins in candidate list to avoid duplicate data Frontend changes: - Add B/S toggle button to show/hide order markers - Remove bottom legend (B BUY S SELL) - Fix chart position reset on data refresh - Separate marker toggle logic from data loading
This commit is contained in:
@@ -983,10 +983,20 @@ func (e *StrategyEngine) BuildUserPrompt(ctx *Context) string {
|
||||
sb.WriteString("Current Positions: None\n\n")
|
||||
}
|
||||
|
||||
// Candidate coins
|
||||
// Candidate coins (exclude coins already in positions to avoid duplicate data)
|
||||
positionSymbols := make(map[string]bool)
|
||||
for _, pos := range ctx.Positions {
|
||||
positionSymbols[pos.Symbol] = true
|
||||
}
|
||||
|
||||
sb.WriteString(fmt.Sprintf("## Candidate Coins (%d coins)\n\n", len(ctx.MarketDataMap)))
|
||||
displayedCount := 0
|
||||
for _, coin := range ctx.CandidateCoins {
|
||||
// Skip if this coin is already a position (data already shown in positions section)
|
||||
if positionSymbols[coin.Symbol] {
|
||||
continue
|
||||
}
|
||||
|
||||
marketData, hasData := ctx.MarketDataMap[coin.Symbol]
|
||||
if !hasData {
|
||||
continue
|
||||
@@ -1081,6 +1091,8 @@ func (e *StrategyEngine) formatMarketData(data *market.Data) string {
|
||||
var sb strings.Builder
|
||||
indicators := e.config.Indicators
|
||||
|
||||
// 明确标注币种
|
||||
sb.WriteString(fmt.Sprintf("=== %s Market Data ===\n\n", data.Symbol))
|
||||
sb.WriteString(fmt.Sprintf("current_price = %.4f", data.CurrentPrice))
|
||||
|
||||
if indicators.EnableEMA {
|
||||
@@ -1252,7 +1264,7 @@ func (e *StrategyEngine) formatQuantData(data *QuantData) string {
|
||||
}
|
||||
|
||||
var sb strings.Builder
|
||||
sb.WriteString("📊 Quantitative Data:\n")
|
||||
sb.WriteString(fmt.Sprintf("📊 %s Quantitative Data:\n", data.Symbol))
|
||||
|
||||
if len(data.PriceChange) > 0 {
|
||||
sb.WriteString("Price Change: ")
|
||||
|
||||
Reference in New Issue
Block a user