fix: OI Top API response parsing and quant data URL validation

- Fix OITopAPIResponse struct to use Code int (0=success) instead of Success bool
- Add all response fields from actual API (time_range_param, rank_type, limit)
- Add {symbol} placeholder validation warning in FetchQuantData
- Add API-level validation in strategy create/update to warn about missing {symbol}
This commit is contained in:
tinkle-community
2025-12-08 12:49:49 +08:00
parent ce3f62cb50
commit 9c1a322901
3 changed files with 54 additions and 14 deletions

View File

@@ -215,8 +215,14 @@ func (e *StrategyEngine) FetchQuantData(symbol string) (*QuantData, error) {
return nil, nil
}
// Check if URL contains {symbol} placeholder
apiURL := e.config.Indicators.QuantDataAPIURL
if !strings.Contains(apiURL, "{symbol}") {
logger.Infof("⚠️ Quant data URL does not contain {symbol} placeholder, data may be incorrect for %s", symbol)
}
// Replace {symbol} placeholder
url := strings.Replace(e.config.Indicators.QuantDataAPIURL, "{symbol}", symbol, -1)
url := strings.Replace(apiURL, "{symbol}", symbol, -1)
client := &http.Client{Timeout: 10 * time.Second}
resp, err := client.Get(url)