50 lines
2 KiB
Go
50 lines
2 KiB
Go
package bybit
|
|
|
|
const (
|
|
categorySpot string = "spot"
|
|
categoryLinear string = "linear"
|
|
categoryInverse string = "inverse"
|
|
categoryOption string = "option"
|
|
)
|
|
|
|
type marketOrderbookReq struct {
|
|
// Product type. spot, linear, inverse, option
|
|
Category string `json:"category"`
|
|
// Symbol name, like BTCUSDT, uppercase only
|
|
Symbol string `json:"symbol"`
|
|
/*
|
|
Limit size for each bid and ask
|
|
spot: [1, 200]. Default: 1.
|
|
linear&inverse: [1, 500]. Default: 25.
|
|
option: [1, 25]. Default: 1.
|
|
*/
|
|
Limit *int `json:"limit,omitempty"`
|
|
}
|
|
|
|
type marketOrderbookResp struct {
|
|
S string `json:"s"` // Symbol name.
|
|
A [][]string `json:"a"` // Ask, seller. Sorted by price in ascending order. a[0]: Ask price, a[1]: Ask size.
|
|
B [][]string `json:"b"` // Bid, buyer. Sorted by price in descending order. b[0]: Bid price, b[1]: Bid size.
|
|
Ts int64 `json:"ts"` // The timestamp (ms) that the system generates the data.
|
|
U int `json:"u"` // Update ID, is always in sequence.
|
|
Seq int `json:"seq"` // Cross sequence.
|
|
Cts int64 `json:"cts"` // The timestamp from the matching engine when this orderbook data is produced. It can be correlated with T from public trade channel.
|
|
}
|
|
|
|
type marketKlineReq struct {
|
|
Category string `json:"category"` // Product type. spot,linear,inverse
|
|
Symbol string `json:"symbol"` // Symbol name, like BTCUSDT, uppercase only
|
|
Interval string `json:"interval"` // Kline interval. 1,3,5,15,30,60,120,240,360,720,D,W,M
|
|
Start string `json:"start,omitempty"` // unix timestamp in ms
|
|
End string `json:"end,omitempty"` // unix timestamp in ms
|
|
Limit *int `json:"limit,omitempty"` // Limit for data size per page. [1, 1000]. Default: 200
|
|
}
|
|
|
|
// marketKlineResp contains the result of /v5/market/kline.
|
|
// List entries: [startTime, open, high, low, close, volume, turnover].
|
|
// Returned in descending order (newest first).
|
|
type marketKlineResp struct {
|
|
Symbol string `json:"symbol"`
|
|
Category string `json:"category"`
|
|
List [][]string `json:"list"`
|
|
}
|