/
huobi_struct.go
75 lines (68 loc) · 3.58 KB
/
huobi_struct.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
package huobi
// TradePair ...
type TradePair struct {
Base string `json:"base-currency"` // 基础币种
Quote string `json:"quote-currency"` // 计价币种
}
// Account ...
type Account struct {
AccountID int64 `json:"id"`
Status string `json:"state"` // working:正常, lock:账户被锁定
AccountType string `json:"type"` // spot:现货账户
}
// Kline k线数据
type Kline struct {
Base string
Quote string
Timestamp float64 `json:"id"` // 时间戳
Volume float64 `json:"vol"` // 交易量
Close float64 `json:"close"` // 收盘价
High float64 `json:"high"` // 最高价
Low float64 `json:"low"` // 最低价
Open float64 `json:"open"` // 开盘价
}
// Balance ...
type Balance struct {
Amount string `json:"balance"` // 余额
CurrencyNo string `json:"currency"` //币种
BType string `json:"type"` // trade: 交易余额,frozen: 冻结余额
}
// InsertOrderReq ...
type InsertOrderReq struct {
AccountID string `json:"account-id"` // 账户ID
Amount string `json:"amount"` // 限价表示下单数量, 市价买单时表示买多少钱, 市价卖单时表示卖多少币
Price string `json:"price,omitempty"` // 下单价格, 市价单不传该参数
Source string `json:"source"` // 订单来源, api: API调用, margin-api: 借贷资产交易
Symbol string `json:"symbol"` // 交易对, btcusdt, bccbtc......
OrderType string `json:"type"` // 订单类型, buy-market: 市价买, sell-market: 市价卖, buy-limit: 限价买, sell-limit: 限价卖
}
// OrderDetail ...
type OrderDetail struct {
AccountID int64 `json:"account-id"` //账户 ID
Num int64 `json:"amount"` //订单数量
CancelTime int64 `json:"canceled-at"` //订单撤销时间
CreateTime int64 `json:"created-at"` //订单创建时间
TradeNum string `json:"field-amount"` //已成交数量
TradePrice string `json:"field-cash-amount"` //已成交总金额
TradeFee string `json:"field-fees"` //已成交手续费(买入为币,卖出为钱)
TradeTime int64 `json:"finished-at"` // 最后成交时间
MatchNo int64 `json:"id"` //订单ID
InsertPrice string `json:"price"` //订单价格
InsertSource string `json:"source"` //订单来源 api
OrderStatus string `json:"state"` //订单状态 pre-submitted 准备提交, submitting , submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销
Symbol string `json:"symbol"` // 交易对 btcusdt, bchbtc, rcneth ...
OrderType string `json:"type"` // 订单类型 buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖
}
// MatchDetail ...
type MatchDetail struct {
MatchTime int64 `json:"created-at"` //成交时间
MatchNum string `json:"filled-amount"` //成交数量
MatchFee string `json:"filled-fees"` //成交手续费
MatchNo int64 `json:"id"` //订单成交记录ID
MatchMarkNo int64 `json:"match-id"` //撮合ID
OrderNo int64 `json:"order-id"` // 订单 ID
MatchPrice string `json:"price"` //成交价格
OrderSource string `json:"source"` //订单来源 api
Symbol string `json:"symbol"` //交易对 btcusdt, bchbtc, rcneth ...
OrderType string `json:"type"` //订单类型 buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖
}