-
Notifications
You must be signed in to change notification settings - Fork 0
/
huobiapi.go
69 lines (53 loc) · 1.88 KB
/
huobiapi.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
package huobiapi
import (
"github.com/feeeei/huobiapi-go/config"
"github.com/feeeei/huobiapi-go/debug"
"github.com/feeeei/huobiapi-go/restclient"
"github.com/feeeei/huobiapi-go/wsclient"
)
type Params = map[string]interface{}
// MarketClient REST格式市场client
type MarketClient = restclient.MarketClient
// TradeClient REST格式交易client
type TradeClient = restclient.TradeClient
// MarketWSClient WebSocket格式市场client
type MarketWSClient = wsclient.MarketWSClient
// TradeWSClient WebSocket格式交易client
type TradeWSClient = wsclient.TradeWSClient
//TradeWSV2Client WebSocket格式交易clientV2
type TradeWSV2Client = wsclient.TradeWSV2Client
func init() {
config.SetAPIHost("api.huobi.pro")
}
// UseAWSHost 使用aws域名,在aws网络下速度时延更低
func UseAWSHost() {
config.SetAPIHost("api-aws.huobi.pro")
}
// SetAPIHost 使用自定义Host
func SetAPIHost(host string) {
config.SetAPIHost(host)
}
// DebugMode 是否使用Debug模式,打印日志
func DebugMode(output bool) {
debug.Debug(output)
}
// NewMarketClient 创建REST行情Client
func NewMarketClient() (*MarketClient, error) {
return restclient.NewMarketClient()
}
// NewTradeClient 创建REST交易Client
func NewTradeClient(accessKeyID, accessKeySecret string) (*TradeClient, error) {
return restclient.NewTradeClient(accessKeyID, accessKeySecret)
}
// NewMarketWSClient 创建WebSocket行情Client
func NewMarketWSClient() (*MarketWSClient, error) {
return wsclient.NewMarketWSClient()
}
// NewTradeWSClient 创建WebSocket交易Client
func NewTradeWSClient(accessKeyID, accessKeySecret string) (*TradeWSClient, error) {
return wsclient.NewTradeWSClient(accessKeyID, accessKeySecret)
}
// NewTradeWSV2Client 创建WebSocket交易Client
func NewTradeWSV2Client(accessKeyID, accessKeySecret string) (*TradeWSV2Client, error) {
return wsclient.NewTradeWSV2Client(accessKeyID, accessKeySecret)
}