29 lines
947 B
Go
29 lines
947 B
Go
![]() |
// 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"`
|
|||
|
}
|