forked from nntaoli-project/goex
-
Notifications
You must be signed in to change notification settings - Fork 4
/
FutureRestAPI.go
125 lines (103 loc) · 3.85 KB
/
FutureRestAPI.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
package goex
type FutureRestAPI interface {
/**
*获取交易所名字
*/
GetExchangeName() string
/**
*获取交割预估价
*/
GetFutureEstimatedPrice(currencyPair CurrencyPair) (float64, error)
/**
* 期货行情
* @param currency_pair btc_usd:比特币 ltc_usd :莱特币
* @param contractType 合约类型: this_week:当周 next_week:下周 month:当月 quarter:季度
*/
GetFutureTicker(currencyPair CurrencyPair, contractType string) (*Ticker, error)
/**
* 期货深度
* @param currencyPair btc_usd:比特币 ltc_usd :莱特币
* @param contractType 合约类型: this_week:当周 next_week:下周 month:当月 quarter:季度
* @param size 获取深度档数
* @return
*/
GetFutureDepth(currencyPair CurrencyPair, contractType string, size int) (*Depth, error)
/**
* 期货指数
* @param currencyPair btc_usd:比特币 ltc_usd :莱特币
*/
GetFutureIndex(currencyPair CurrencyPair) (float64, error)
/**
*全仓账户
*@param currency
*/
GetFutureUserinfo(currencyPair ...CurrencyPair) (*FutureAccount, error)
/**
* @deprecated
* 期货下单
* @param currencyPair btc_usd:比特币 ltc_usd :莱特币
* @param contractType 合约类型: this_week:当周 next_week:下周 month:当月 quarter:季度
* @param price 价格
* @param amount 委托数量
* @param openType 1:开多 2:开空 3:平多 4:平空
* @param matchPrice 是否为对手价 0:不是 1:是 ,当取值为1时,price无效
*/
PlaceFutureOrder(currencyPair CurrencyPair, contractType, price, amount string, openType, matchPrice int, leverRate float64) (string, error)
LimitFuturesOrder(currencyPair CurrencyPair, contractType, price, amount string, openType int, opt ...LimitOrderOptionalParameter) (*FutureOrder, error)
//对手价下单
MarketFuturesOrder(currencyPair CurrencyPair, contractType, amount string, openType int) (*FutureOrder, error)
/**
* 取消订单
* @param symbol btc_usd:比特币 ltc_usd :莱特币
* @param contractType 合约类型: this_week:当周 next_week:下周 month:当月 quarter:季度
* @param orderId 订单ID
*/
FutureCancelOrder(currencyPair CurrencyPair, contractType, orderId string) (bool, error)
/**
* 用户持仓查询
* @param symbol btc_usd:比特币 ltc_usd :莱特币
* @param contractType 合约类型: this_week:当周 next_week:下周 month:当月 quarter:季度
* @return
*/
GetFuturePosition(currencyPair CurrencyPair, contractType string) ([]FuturePosition, error)
/**
*获取订单信息
*/
GetFutureOrders(orderIds []string, currencyPair CurrencyPair, contractType string) ([]FutureOrder, error)
/**
*获取单个订单信息
*/
GetFutureOrder(orderId string, currencyPair CurrencyPair, contractType string) (*FutureOrder, error)
/**
*获取未完成订单信息
*/
GetUnfinishFutureOrders(currencyPair CurrencyPair, contractType string) ([]FutureOrder, error)
/**
* 获取个人订单历史,默认获取最近的订单历史列表,返回多少条订单数据,需根据平台接口定义而定
*/
GetFutureOrderHistory(pair CurrencyPair, contractType string, optional ...OptionalParameter) ([]FutureOrder, error)
/**
*获取交易费
*/
GetFee() (float64, error)
/**
*获取交易所的美元人民币汇率
*/
//GetExchangeRate() (float64, error)
/**
*获取每张合约价值
*/
GetContractValue(currencyPair CurrencyPair) (float64, error)
/**
*获取交割时间 星期(0,1,2,3,4,5,6),小时,分,秒
*/
GetDeliveryTime() (int, int, int, int)
/**
* 获取K线数据
*/
GetKlineRecords(contractType string, currency CurrencyPair, period KlinePeriod, size int, optional ...OptionalParameter) ([]FutureKline, error)
/**
* 获取Trade数据
*/
GetTrades(contractType string, currencyPair CurrencyPair, since int64) ([]Trade, error)
}