-
Notifications
You must be signed in to change notification settings - Fork 58
Open
Description
问题描述
Warning: turnover is nil for symbol AAPL.US timestamp 2025-01-27 14:57:00 -0500 EST , index: 327 ,len : 390 price: 230.98 open: 230.98
获取 AAPL.US 指定时间范围K线失败: turnover is nil for symbol AAPL.US timestamp 2025-01-27 14:57:00 -0500 EST
func (c *QuoteContext) HistoryCandlesticksByDate(ctx context.Context, symbol string, period Period, adjustType AdjustType, startDate *time.Time, endDate *time.Time, opts ...CandlestickRequestOption) (sticks []*Candlestick, err error) {
return c.core.HistoryCandlesticksByDate(ctx, symbol, period, adjustType, startDate, endDate, opts...)
}
基于这个接口拉取天级别的分钟 K线,发现苹果在2025-01-27 14:57:00的数据里Turnover字段是空指针,甚至其他字段都有,其他K线也没问题
代码例子
resp, err := qc.HistoryCandlesticksByDate(ctx, symbol, period, quote.AdjustTypeNo, start, end)
if err != nil {
return nil, err
}
candles := make([]Candlestick, 0)
for i, k := range resp {
price, _ := k.Close.Float64()
open, _ := k.Open.Float64()
if k.Turnover == nil {
locus, _ := time.LoadLocation("America/New_York")
fmt.Println("Warning: turnover is nil for symbol", symbol, "timestamp", time.Unix(k.Timestamp, 0).In(locus),
", index:", i, ",len : ", len(resp), "price:", price, "open:", open)
return nil, fmt.Errorf("turnover is nil for symbol %s timestamp %s", symbol, time.Unix(k.Timestamp, 0).In(locus))
}
turnover, _ := k.Turnover.Float64()
candles = append(candles, Candlestick{
Price: price,
Open: open,
Volume: k.Volume,
TotalMoney: turnover,
Timestamp: k.Timestamp,
})
}错误信息或结果截图
如果可以,请给出一些执行的结果截图,最好给完整截图,避免关键信息遗漏(请注意保护你的 Access Token)
你的环境信息
- 操作系统: [比如: macOS / Windows]
- 开发语言: Python / Go / Rust / Node.js / Java
- SDK 版本号:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels