forked from go-numb/go-ftx
/
order-status.go
53 lines (43 loc) · 1.12 KB
/
order-status.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
package orders
import (
"fmt"
"net/http"
"time"
)
type RequestForOrderStatus struct {
ClientID string
OrderID int
}
type ResponseForOrderStatus struct {
ClientID string `json:"clientId"`
Future string `json:"future"`
Market string `json:"market"`
Status string `json:"status"`
Type string `json:"type"`
Side string `json:"side"`
Price float64 `json:"price"`
AvgFillPrice float64 `json:"avgFillPrice"`
FilledSize float64 `json:"filledSize"`
Size float64 `json:"size"`
RemainingSize float64 `json:"remainingSize"`
ID int `json:"id"`
Ioc bool `json:"ioc"`
ReduceOnly bool `json:"reduceOnly"`
PostOnly bool `json:"postOnly"`
CreatedAt time.Time `json:"createdAt"`
}
func (req *RequestForOrderStatus) Path() string {
if req.ClientID != "" {
return fmt.Sprintf("/orders/by_client_id/%s", req.ClientID)
}
return fmt.Sprintf("/orders/%d", req.OrderID)
}
func (req *RequestForOrderStatus) Method() string {
return http.MethodGet
}
func (req *RequestForOrderStatus) Query() string {
return ""
}
func (req *RequestForOrderStatus) Payload() []byte {
return nil
}