-
-
Notifications
You must be signed in to change notification settings - Fork 275
/
types.go
130 lines (107 loc) · 3.49 KB
/
types.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
package bybitapi
import "github.com/c9s/bbgo/pkg/types"
var (
SupportedIntervals = map[types.Interval]int{
types.Interval1m: 1 * 60,
types.Interval3m: 3 * 60,
types.Interval5m: 5 * 60,
types.Interval15m: 15 * 60,
types.Interval30m: 30 * 60,
types.Interval1h: 60 * 60,
types.Interval2h: 60 * 60 * 2,
types.Interval4h: 60 * 60 * 4,
types.Interval6h: 60 * 60 * 6,
types.Interval12h: 60 * 60 * 12,
types.Interval1d: 60 * 60 * 24,
types.Interval1w: 60 * 60 * 24 * 7,
types.Interval1mo: 60 * 60 * 24 * 30,
}
ToGlobalInterval = map[string]types.Interval{
"1": types.Interval1m,
"3": types.Interval3m,
"5": types.Interval5m,
"15": types.Interval15m,
"30": types.Interval30m,
"60": types.Interval1h,
"120": types.Interval2h,
"240": types.Interval4h,
"360": types.Interval6h,
"720": types.Interval12h,
"D": types.Interval1d,
"W": types.Interval1w,
"M": types.Interval1mo,
}
)
type Category string
const (
CategorySpot Category = "spot"
)
type Status string
const (
// StatusTrading is only include the "Trading" status for `spot` category.
StatusTrading Status = "Trading"
)
type OpenOnly int
const (
OpenOnlyOrder OpenOnly = 0
)
type Side string
const (
SideBuy Side = "Buy"
SideSell Side = "Sell"
)
type OrderStatus string
const (
// OrderStatusCreated order has been accepted by the system but not yet put through the matching engine
OrderStatusCreated OrderStatus = "Created"
// OrderStatusNew is order has been placed successfully.
OrderStatusNew OrderStatus = "New"
OrderStatusRejected OrderStatus = "Rejected"
OrderStatusPartiallyFilled OrderStatus = "PartiallyFilled"
// OrderStatusPartiallyFilledCanceled means that the order has been partially filled but not all then cancel.
OrderStatusPartiallyFilledCanceled OrderStatus = "PartiallyFilledCanceled"
OrderStatusFilled OrderStatus = "Filled"
OrderStatusCancelled OrderStatus = "Cancelled"
// Following statuses is conditional orders. Once you place conditional orders, it will be in untriggered status.
// Untriggered -> Triggered -> New
// Once the trigger price reached, order status will be moved to triggered
// Singe BBGO not support Untriggered/Triggered, so comment it.
//
// OrderStatusUntriggered means that the order not triggered
//OrderStatusUntriggered OrderStatus = "Untriggered"
//// OrderStatusTriggered means that the order has been triggered
//OrderStatusTriggered OrderStatus = "Triggered"
// Following statuses is stop orders
// OrderStatusDeactivated is an order status for stopOrders.
//e.g. when you place a conditional order, then you cancel it, this order status is "Deactivated"
OrderStatusDeactivated OrderStatus = "Deactivated"
// OrderStatusActive order has been triggered and the new active order has been successfully placed. Is the final
// state of a successful conditional order
OrderStatusActive OrderStatus = "Active"
)
var (
AllOrderStatuses = []OrderStatus{
OrderStatusCreated,
OrderStatusNew,
OrderStatusRejected,
OrderStatusPartiallyFilled,
OrderStatusPartiallyFilledCanceled,
OrderStatusFilled,
OrderStatusCancelled,
OrderStatusDeactivated,
OrderStatusActive,
}
)
type OrderType string
const (
OrderTypeMarket OrderType = "Market"
OrderTypeLimit OrderType = "Limit"
)
type TimeInForce string
const (
TimeInForceGTC TimeInForce = "GTC"
TimeInForceIOC TimeInForce = "IOC"
TimeInForceFOK TimeInForce = "FOK"
)
type AccountType string
const AccountTypeSpot AccountType = "SPOT"