forked from thrasher-corp/gocryptotrader
-
Notifications
You must be signed in to change notification settings - Fork 1
/
okcoin.go
66 lines (61 loc) · 2.32 KB
/
okcoin.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
package okcoin
import (
"time"
"github.com/woshidama323/gocryptotrader/common"
exchange "github.com/woshidama323/gocryptotrader/exchanges"
"github.com/woshidama323/gocryptotrader/exchanges/okgroup"
"github.com/woshidama323/gocryptotrader/exchanges/request"
"github.com/woshidama323/gocryptotrader/exchanges/ticker"
"github.com/woshidama323/gocryptotrader/exchanges/websocket/wshandler"
)
const (
okCoinAuthRate = 600
okCoinUnauthRate = 600
okCoinAPIPath = "api/"
okCoinAPIURL = "https://www.okcoin.com/" + okCoinAPIPath
okCoinAPIVersion = "/v3/"
okCoinExchangeName = "OKCOIN International"
okCoinWebsocketURL = "wss://real.okcoin.com:10442/ws/v3"
)
// OKCoin bases all methods off okgroup implementation
type OKCoin struct {
okgroup.OKGroup
}
// SetDefaults method assignes the default values for OKEX
func (o *OKCoin) SetDefaults() {
o.SetErrorDefaults()
o.SetCheckVarDefaults()
o.Name = okCoinExchangeName
o.Enabled = false
o.Verbose = false
o.RESTPollingDelay = 10
o.APIWithdrawPermissions = exchange.AutoWithdrawCrypto |
exchange.NoFiatWithdrawals
o.RequestCurrencyPairFormat.Delimiter = "_"
o.RequestCurrencyPairFormat.Uppercase = false
o.ConfigCurrencyPairFormat.Delimiter = "_"
o.ConfigCurrencyPairFormat.Uppercase = true
o.SupportsAutoPairUpdating = true
o.SupportsRESTTickerBatching = false
o.Requester = request.New(o.Name,
request.NewRateLimit(time.Second, okCoinAuthRate),
request.NewRateLimit(time.Second, okCoinUnauthRate),
common.NewHTTPClientWithTimeout(exchange.DefaultHTTPTimeout))
o.APIUrlDefault = okCoinAPIURL
o.APIUrl = okCoinAPIURL
o.AssetTypes = []string{ticker.Spot}
o.Websocket = wshandler.New()
o.WebsocketURL = okCoinWebsocketURL
o.APIVersion = okCoinAPIVersion
o.Websocket.Functionality = wshandler.WebsocketTickerSupported |
wshandler.WebsocketTradeDataSupported |
wshandler.WebsocketKlineSupported |
wshandler.WebsocketOrderbookSupported |
wshandler.WebsocketSubscribeSupported |
wshandler.WebsocketUnsubscribeSupported |
wshandler.WebsocketAuthenticatedEndpointsSupported |
wshandler.WebsocketMessageCorrelationSupported
o.WebsocketResponseMaxLimit = exchange.DefaultWebsocketResponseMaxLimit
o.WebsocketResponseCheckTimeout = exchange.DefaultWebsocketResponseCheckTimeout
o.WebsocketOrderbookBufferLimit = exchange.DefaultWebsocketOrderbookBufferLimit
}