forked from hirokisan/bybit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
v5_execution_service.go
86 lines (74 loc) · 2.84 KB
/
v5_execution_service.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package bybit
import "github.com/google/go-querystring/query"
// V5ExecutionServiceI :
type V5ExecutionServiceI interface {
GetExecutionList(V5GetExecutionParam) (*V5GetExecutionListResponse, error)
}
// V5ExecutionService :
type V5ExecutionService struct {
client *Client
}
// V5GetExecutionParam :
type V5GetExecutionParam struct {
Category CategoryV5 `url:"category"`
Symbol *SymbolV5 `url:"symbol,omitempty"`
OrderID *string `url:"orderId,omitempty"`
OrderLinkID *string `url:"orderLinkId,omitempty"`
BaseCoin *Coin `url:"baseCoin,omitempty"`
StartTime *int `url:"startTime,omitempty"`
EndTime *int `url:"endTime,omitempty"`
ExecType *ExecTypeV5 `url:"execType,omitempty"`
Limit *int `url:"limit,omitempty"`
Cursor *string `url:"cursor,omitempty"`
}
// V5GetExecutionListResponse :
type V5GetExecutionListResponse struct {
CommonV5Response `json:",inline"`
Result V5GetExecutionListResult `json:"result"`
}
// V5GetExecutionListResult :
type V5GetExecutionListResult struct {
NextPageCursor string `json:"nextPageCursor"`
Category string `json:"category"`
List []V5GetExecutionListItem `json:"list"`
}
// V5GetExecutionListItem :
type V5GetExecutionListItem struct {
Symbol SymbolV5 `json:"symbol"`
OrderID string `json:"orderId"`
OrderLinkID string `json:"orderLinkId"`
Side Side `json:"side"`
OrderPrice string `json:"orderPrice"`
OrderQty string `json:"orderQty"`
LeavesQty string `json:"leavesQty"`
OrderType OrderType `json:"orderType"`
StopOrderType string `json:"stopOrderType"`
ExecFee string `json:"execFee"`
ExecID string `json:"execId"`
ExecPrice string `json:"execPrice"`
ExecQty string `json:"execQty"`
ExecType ExecTypeV5 `json:"execType"`
ExecValue string `json:"execValue"`
ExecTime string `json:"execTime"`
FeeCurrency Coin `json:"feeCurrency"`
IsMaker bool `json:"isMaker"`
FeeRate string `json:"feeRate"`
TradeIv string `json:"tradeIv"`
MarkIv string `json:"markIv"`
MarkPrice string `json:"markPrice"`
IndexPrice string `json:"indexPrice"`
UnderlyingPrice string `json:"underlyingPrice"`
BlockTradeID string `json:"blockTradeId"`
ClosedSize string `json:"closedSize"`
}
func (s *V5ExecutionService) GetExecutionList(param V5GetExecutionParam) (*V5GetExecutionListResponse, error) {
var res V5GetExecutionListResponse
queryString, err := query.Values(param)
if err != nil {
return nil, err
}
if err := s.client.getV5Privately("/v5/execution/list", queryString, &res); err != nil {
return nil, err
}
return &res, nil
}