tanya/okx/candleApi.go
zhangkun9038@dingtalk.com 18f15b0534 up
2025-03-06 00:31:55 +08:00

29 lines
947 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 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"`
}