forked from nntaoli-project/goex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConst.go
125 lines (101 loc) · 1.85 KB
/
Const.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
package coinapi
type CurrencyPair int;
func (c CurrencyPair) String() string {
return currencyPairSymbol[c - 1];
}
type Currency int;
func (c Currency) String() string {
return currencySymbol[c - 1];
}
type TradeSide int;
func (ts TradeSide)String() string {
switch ts {
case 1:
return "BUY";
case 2:
return "SELL";
case 3:
return "BUY_MARKET";
case 4:
return "SELL_MARKET";
default:
return "UNKNOWN";
}
}
type TradeStatus int;
func (ts TradeStatus) String() string {
return orderStatusSymbol[ts];
}
var currencySymbol = [...]string{"cny", "usd", "btc", "ltc", "eth", "etc" , "zec" , "sc"};
const
(
CNY = 1 + iota
USD
BTC
LTC
ETH
ETC
ZEC
SC
)
var currencyPairSymbol = [...]string{"btc_cny", "btc_usd", "ltc_cny", "ltc_usd", "eth_cny",
"eth_usd", "eth_btc", "etc_cny", "etc_usd", "etc_btc", "xcn_btc", "sys_btc" , "zec_cny" , "zec_usd" , "zec_btc"};
const
(
BTC_CNY = 1 + iota
BTC_USD
LTC_CNY
LTC_USD
ETH_CNY
ETH_USD
ETH_BTC
ETC_CNY
ETC_USD
ETC_BTC
XCN_BTC
SYS_BTC
ZEC_CNY
ZEC_USD
ZEC_BTC
)
const
(
BUY = 1 + iota
SELL
BUY_MARKET
SELL_MARKET
)
var orderStatusSymbol = [...]string{"UNFINISH", "PART_FINISH", "FINISH", "CANCEL", "REJECT", "CANCEL_ING"}
const
(
ORDER_UNFINISH = iota
ORDER_PART_FINISH
ORDER_FINISH
ORDER_CANCEL
ORDER_REJECT
ORDER_CANCEL_ING
)
const
(
OPEN_BUY = 1 + iota //开多
OPEN_SELL //开空
CLOSE_BUY //平多
CLOSE_SELL //平空
)
var CurrencyPairSymbol = map[CurrencyPair]string{
BTC_CNY : "btc_cny",
BTC_USD : "btc_usd",
LTC_CNY : "ltc_cny",
LTC_USD : "ltc_usd",
ETH_CNY : "eth_cny",
ETH_USD : "eth_usd",
ETH_BTC : "eth_btc",
ETC_CNY : "etc_cny",
ETC_USD : "etc_usd",
ETC_BTC : "etc_btc"};
var
(
THIS_WEEK_CONTRACT = "this_week"; //周合约
NEXT_WEEK_CONTRACT = "next_week"; //次周合约
QUARTER_CONTRACT = "quarter"; //季度合约
)