tanya/okx/candleApi.go

29 lines
947 B
Go
Raw Normal View History

2025-03-06 00:31:55 +08:00
// CandlesRequest 定义获取K线数据的请求参数
package okx
type CandlesRequest struct {
InstID string `url:"instId"` // 必填交易对ID
Bar string `url:"bar,omitempty"` // 可选K线周期默认1m
Before string `url:"before,omitempty"` // 可选:请求此时间戳之前
After string `url:"after,omitempty"` // 可选:请求此时间戳之后
Limit string `url:"limit,omitempty"` // 可选返回条数默认100
}
// Candle 定义K线数据的返回结构
type Candle struct {
Timestamp string `json:"timestamp"`
Open string `json:"open"`
High string `json:"high"`
Low string `json:"low"`
Close string `json:"close"`
Volume string `json:"volume"`
VolumeCcy string `json:"volumeCcy"`
}
// ApiResponse 定义 OKX API 的通用返回结构
type ApiResponse struct {
Code string `json:"code"`
Msg string `json:"msg"`
Data interface{} `json:"data"`
}