mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 15:09:42 +00:00
Create exchange base struct
This commit is contained in:
13
anxhttp.go
13
anxhttp.go
@@ -10,6 +10,7 @@ import (
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -27,17 +28,7 @@ const (
|
||||
)
|
||||
|
||||
type ANX struct {
|
||||
Name string
|
||||
Enabled bool
|
||||
Verbose bool
|
||||
Websocket bool
|
||||
RESTPollingDelay time.Duration
|
||||
AuthenticatedAPISupport bool
|
||||
APIKey, APISecret string
|
||||
TakerFee, MakerFee float64
|
||||
BaseCurrencies []string
|
||||
AvailablePairs []string
|
||||
EnabledPairs []string
|
||||
exchange.ExchangeBase
|
||||
}
|
||||
|
||||
type ANXOrder struct {
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/gorilla/websocket"
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -170,19 +171,10 @@ type BitfinexSymbolDetails struct {
|
||||
}
|
||||
|
||||
type Bitfinex struct {
|
||||
Name string
|
||||
Enabled bool
|
||||
Verbose bool
|
||||
Websocket bool
|
||||
RESTPollingDelay time.Duration
|
||||
AuthenticatedAPISupport bool
|
||||
APIKey, APISecret string
|
||||
ActiveOrders []BitfinexOrder
|
||||
BaseCurrencies []string
|
||||
AvailablePairs []string
|
||||
EnabledPairs []string
|
||||
WebsocketConn *websocket.Conn
|
||||
WebsocketSubdChannels map[int]BitfinexWebsocketChanInfo
|
||||
exchange.ExchangeBase
|
||||
ActiveOrders []BitfinexOrder
|
||||
WebsocketConn *websocket.Conn
|
||||
WebsocketSubdChannels map[int]BitfinexWebsocketChanInfo
|
||||
}
|
||||
|
||||
func (b *Bitfinex) SetDefaults() {
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -44,18 +45,8 @@ const (
|
||||
)
|
||||
|
||||
type Bitstamp struct {
|
||||
Name string
|
||||
Enabled bool
|
||||
Verbose bool
|
||||
Websocket bool
|
||||
RESTPollingDelay time.Duration
|
||||
AuthenticatedAPISupport bool
|
||||
ClientID, APIKey, APISecret string
|
||||
Balance BitstampBalances
|
||||
TakerFee, MakerFee float64
|
||||
BaseCurrencies []string
|
||||
AvailablePairs []string
|
||||
EnabledPairs []string
|
||||
exchange.ExchangeBase
|
||||
Balance BitstampBalances
|
||||
}
|
||||
|
||||
type BitstampTicker struct {
|
||||
|
||||
13
btcchttp.go
13
btcchttp.go
@@ -11,6 +11,7 @@ import (
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -42,17 +43,7 @@ const (
|
||||
)
|
||||
|
||||
type BTCC struct {
|
||||
Name string
|
||||
Enabled bool
|
||||
Verbose bool
|
||||
Websocket bool
|
||||
RESTPollingDelay time.Duration
|
||||
AuthenticatedAPISupport bool
|
||||
APISecret, APIKey string
|
||||
Fee float64
|
||||
BaseCurrencies []string
|
||||
AvailablePairs []string
|
||||
EnabledPairs []string
|
||||
exchange.ExchangeBase
|
||||
}
|
||||
|
||||
type BTCCTicker struct {
|
||||
|
||||
15
btcehttp.go
15
btcehttp.go
@@ -11,6 +11,7 @@ import (
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -35,18 +36,8 @@ const (
|
||||
)
|
||||
|
||||
type BTCE struct {
|
||||
Name string
|
||||
Enabled bool
|
||||
Verbose bool
|
||||
Websocket bool
|
||||
RESTPollingDelay time.Duration
|
||||
AuthenticatedAPISupport bool
|
||||
APIKey, APISecret string
|
||||
Fee float64
|
||||
BaseCurrencies []string
|
||||
AvailablePairs []string
|
||||
EnabledPairs []string
|
||||
Ticker map[string]BTCeTicker
|
||||
exchange.ExchangeBase
|
||||
Ticker map[string]BTCeTicker
|
||||
}
|
||||
|
||||
type BTCeTicker struct {
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -26,18 +27,8 @@ const (
|
||||
)
|
||||
|
||||
type BTCMarkets struct {
|
||||
Name string
|
||||
Enabled bool
|
||||
Verbose bool
|
||||
Websocket bool
|
||||
RESTPollingDelay time.Duration
|
||||
Fee float64
|
||||
Ticker map[string]BTCMarketsTicker
|
||||
AuthenticatedAPISupport bool
|
||||
APIKey, APISecret string
|
||||
BaseCurrencies []string
|
||||
AvailablePairs []string
|
||||
EnabledPairs []string
|
||||
exchange.ExchangeBase
|
||||
Ticker map[string]BTCMarketsTicker
|
||||
}
|
||||
|
||||
type BTCMarketsTicker struct {
|
||||
|
||||
21
exchanges/exchange.go
Normal file
21
exchanges/exchange.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package exchange
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type ExchangeBase struct {
|
||||
Name string
|
||||
Enabled bool
|
||||
Verbose bool
|
||||
Websocket bool
|
||||
RESTPollingDelay time.Duration
|
||||
AuthenticatedAPISupport bool
|
||||
APISecret, APIKey, ClientID string
|
||||
TakerFee, MakerFee, Fee float64
|
||||
BaseCurrencies []string
|
||||
AvailablePairs []string
|
||||
EnabledPairs []string
|
||||
WebsocketURL string
|
||||
APIUrl string
|
||||
}
|
||||
14
gdaxhttp.go
14
gdaxhttp.go
@@ -11,6 +11,7 @@ import (
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -33,17 +34,8 @@ const (
|
||||
)
|
||||
|
||||
type GDAX struct {
|
||||
Name string
|
||||
Enabled bool
|
||||
Verbose bool
|
||||
Websocket bool
|
||||
RESTPollingDelay time.Duration
|
||||
AuthenticatedAPISupport bool
|
||||
Password, APIKey, APISecret string
|
||||
TakerFee, MakerFee float64
|
||||
BaseCurrencies []string
|
||||
AvailablePairs []string
|
||||
EnabledPairs []string
|
||||
exchange.ExchangeBase
|
||||
Password string
|
||||
}
|
||||
|
||||
type GDAXTicker struct {
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -35,16 +36,7 @@ const (
|
||||
)
|
||||
|
||||
type Gemini struct {
|
||||
Name string
|
||||
Enabled bool
|
||||
Verbose bool
|
||||
Websocket bool
|
||||
RESTPollingDelay time.Duration
|
||||
AuthenticatedAPISupport bool
|
||||
APIKey, APISecret string
|
||||
BaseCurrencies []string
|
||||
AvailablePairs []string
|
||||
EnabledPairs []string
|
||||
exchange.ExchangeBase
|
||||
}
|
||||
|
||||
type GeminiOrderbookEntry struct {
|
||||
|
||||
21
huobihttp.go
21
huobihttp.go
@@ -10,6 +10,7 @@ import (
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -18,17 +19,7 @@ const (
|
||||
)
|
||||
|
||||
type HUOBI struct {
|
||||
Name string
|
||||
Enabled bool
|
||||
Verbose bool
|
||||
Websocket bool
|
||||
RESTPollingDelay time.Duration
|
||||
AuthenticatedAPISupport bool
|
||||
AccessKey, SecretKey string
|
||||
Fee float64
|
||||
BaseCurrencies []string
|
||||
AvailablePairs []string
|
||||
EnabledPairs []string
|
||||
exchange.ExchangeBase
|
||||
}
|
||||
|
||||
type HuobiTicker struct {
|
||||
@@ -91,8 +82,8 @@ func (h *HUOBI) Start() {
|
||||
}
|
||||
|
||||
func (h *HUOBI) SetAPIKeys(apiKey, apiSecret string) {
|
||||
h.AccessKey = apiKey
|
||||
h.SecretKey = apiSecret
|
||||
h.APIKey = apiKey
|
||||
h.APISecret = apiSecret
|
||||
}
|
||||
|
||||
func (h *HUOBI) GetFee() float64 {
|
||||
@@ -281,10 +272,10 @@ func (h *HUOBI) GetOrderIDByTradeID(coinType, orderID int) {
|
||||
}
|
||||
|
||||
func (h *HUOBI) SendAuthenticatedRequest(method string, v url.Values) error {
|
||||
v.Set("access_key", h.AccessKey)
|
||||
v.Set("access_key", h.APIKey)
|
||||
v.Set("created", strconv.FormatInt(time.Now().Unix(), 10))
|
||||
v.Set("method", method)
|
||||
hash := common.GetMD5([]byte(v.Encode() + "&secret_key=" + h.SecretKey))
|
||||
hash := common.GetMD5([]byte(v.Encode() + "&secret_key=" + h.APISecret))
|
||||
v.Set("sign", common.StringToLower(common.HexEncodeToString(hash)))
|
||||
encoded := v.Encode()
|
||||
|
||||
|
||||
23
itbithttp.go
23
itbithttp.go
@@ -10,6 +10,7 @@ import (
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -18,17 +19,7 @@ const (
|
||||
)
|
||||
|
||||
type ItBit struct {
|
||||
Name string
|
||||
Enabled bool
|
||||
Verbose bool
|
||||
Websocket bool
|
||||
RESTPollingDelay time.Duration
|
||||
AuthenticatedAPISupport bool
|
||||
ClientKey, APISecret, UserID string
|
||||
MakerFee, TakerFee float64
|
||||
BaseCurrencies []string
|
||||
AvailablePairs []string
|
||||
EnabledPairs []string
|
||||
exchange.ExchangeBase
|
||||
}
|
||||
|
||||
type ItBitTicker struct {
|
||||
@@ -98,9 +89,9 @@ func (i *ItBit) Start() {
|
||||
}
|
||||
|
||||
func (i *ItBit) SetAPIKeys(apiKey, apiSecret, userID string) {
|
||||
i.ClientKey = apiKey
|
||||
i.APIKey = apiKey
|
||||
i.APISecret = apiSecret
|
||||
i.UserID = userID
|
||||
i.ClientID = userID
|
||||
}
|
||||
|
||||
func (i *ItBit) GetFee(maker bool) float64 {
|
||||
@@ -203,7 +194,7 @@ func (i *ItBit) GetTradeHistory(currency, timestamp string) bool {
|
||||
}
|
||||
|
||||
func (i *ItBit) GetWallets(params url.Values) {
|
||||
params.Set("userId", i.UserID)
|
||||
params.Set("userId", i.ClientID)
|
||||
path := "/wallets?" + params.Encode()
|
||||
|
||||
err := i.SendAuthenticatedHTTPRequest("GET", path, nil)
|
||||
@@ -224,7 +215,7 @@ func (e *ItBit) GetExchangeAccountInfo() (ExchangeAccountInfo, error) {
|
||||
func (i *ItBit) CreateWallet(walletName string) {
|
||||
path := "/wallets"
|
||||
params := make(map[string]interface{})
|
||||
params["userId"] = i.UserID
|
||||
params["userId"] = i.ClientID
|
||||
params["name"] = walletName
|
||||
|
||||
err := i.SendAuthenticatedHTTPRequest("POST", path, params)
|
||||
@@ -394,7 +385,7 @@ func (i *ItBit) SendAuthenticatedHTTPRequest(method string, path string, params
|
||||
signature := common.Base64Encode(hmac)
|
||||
|
||||
headers := make(map[string]string)
|
||||
headers["Authorization"] = i.ClientKey + ":" + signature
|
||||
headers["Authorization"] = i.ClientID + ":" + signature
|
||||
headers["X-Auth-Timestamp"] = timestamp
|
||||
headers["X-Auth-Nonce"] = nonceStr
|
||||
headers["Content-Type"] = "application/json"
|
||||
|
||||
20
kraken.go
20
kraken.go
@@ -11,6 +11,7 @@ import (
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -40,18 +41,9 @@ const (
|
||||
)
|
||||
|
||||
type Kraken struct {
|
||||
Name string
|
||||
Enabled bool
|
||||
Verbose bool
|
||||
Websocket bool
|
||||
RESTPollingDelay time.Duration
|
||||
AuthenticatedAPISupport bool
|
||||
ClientKey, APISecret string
|
||||
FiatFee, CryptoFee float64
|
||||
BaseCurrencies []string
|
||||
AvailablePairs []string
|
||||
EnabledPairs []string
|
||||
Ticker map[string]KrakenTicker
|
||||
exchange.ExchangeBase
|
||||
CryptoFee, FiatFee float64
|
||||
Ticker map[string]KrakenTicker
|
||||
}
|
||||
|
||||
func (k *Kraken) SetDefaults() {
|
||||
@@ -102,7 +94,7 @@ func (k *Kraken) Start() {
|
||||
}
|
||||
|
||||
func (k *Kraken) SetAPIKeys(apiKey, apiSecret string) {
|
||||
k.ClientKey = apiKey
|
||||
k.APIKey = apiKey
|
||||
k.APISecret = apiSecret
|
||||
}
|
||||
|
||||
@@ -666,7 +658,7 @@ func (k *Kraken) SendAuthenticatedHTTPRequest(method string, values url.Values)
|
||||
}
|
||||
|
||||
headers := make(map[string]string)
|
||||
headers["API-Key"] = k.ClientKey
|
||||
headers["API-Key"] = k.APIKey
|
||||
headers["API-Sign"] = signature
|
||||
|
||||
resp, err := common.SendHTTPRequest("POST", KRAKEN_API_URL+path, headers, strings.NewReader(values.Encode()))
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -30,17 +31,7 @@ const (
|
||||
)
|
||||
|
||||
type LakeBTC struct {
|
||||
Name string
|
||||
Enabled bool
|
||||
Verbose bool
|
||||
Websocket bool
|
||||
RESTPollingDelay time.Duration
|
||||
AuthenticatedAPISupport bool
|
||||
APIKey, APISecret string
|
||||
TakerFee, MakerFee float64
|
||||
BaseCurrencies []string
|
||||
AvailablePairs []string
|
||||
EnabledPairs []string
|
||||
exchange.ExchangeBase
|
||||
}
|
||||
|
||||
type LakeBTCTicker struct {
|
||||
|
||||
17
liquihttp.go
17
liquihttp.go
@@ -11,6 +11,7 @@ import (
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -32,19 +33,9 @@ const (
|
||||
)
|
||||
|
||||
type Liqui struct {
|
||||
Name string
|
||||
Enabled bool
|
||||
Verbose bool
|
||||
Websocket bool
|
||||
RESTPollingDelay time.Duration
|
||||
AuthenticatedAPISupport bool
|
||||
APIKey, APISecret string
|
||||
Fee float64
|
||||
BaseCurrencies []string
|
||||
AvailablePairs []string
|
||||
EnabledPairs []string
|
||||
Ticker map[string]LiquiTicker
|
||||
Info LiquiInfo
|
||||
exchange.ExchangeBase
|
||||
Ticker map[string]LiquiTicker
|
||||
Info LiquiInfo
|
||||
}
|
||||
|
||||
type LiquiTicker struct {
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -27,17 +28,7 @@ const (
|
||||
)
|
||||
|
||||
type LocalBitcoins struct {
|
||||
Name string
|
||||
Enabled bool
|
||||
Verbose bool
|
||||
Websocket bool
|
||||
RESTPollingDelay time.Duration
|
||||
AuthenticatedAPISupport bool
|
||||
Password, APIKey, APISecret string
|
||||
TakerFee, MakerFee float64
|
||||
BaseCurrencies []string
|
||||
AvailablePairs []string
|
||||
EnabledPairs []string
|
||||
exchange.ExchangeBase
|
||||
}
|
||||
|
||||
func (l *LocalBitcoins) SetDefaults() {
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/gorilla/websocket"
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -70,22 +71,11 @@ var (
|
||||
)
|
||||
|
||||
type OKCoin struct {
|
||||
Name string
|
||||
Enabled bool
|
||||
Verbose bool
|
||||
Websocket bool
|
||||
WebsocketURL string
|
||||
RESTPollingDelay time.Duration
|
||||
AuthenticatedAPISupport bool
|
||||
APIUrl, PartnerID, SecretKey string
|
||||
TakerFee, MakerFee float64
|
||||
RESTErrors map[string]string
|
||||
WebsocketErrors map[string]string
|
||||
BaseCurrencies []string
|
||||
AvailablePairs []string
|
||||
EnabledPairs []string
|
||||
FuturesValues []string
|
||||
WebsocketConn *websocket.Conn
|
||||
exchange.ExchangeBase
|
||||
RESTErrors map[string]string
|
||||
WebsocketErrors map[string]string
|
||||
FuturesValues []string
|
||||
WebsocketConn *websocket.Conn
|
||||
}
|
||||
|
||||
type OKCoinTicker struct {
|
||||
@@ -252,8 +242,8 @@ func (o *OKCoin) SetURL(url string) {
|
||||
}
|
||||
|
||||
func (o *OKCoin) SetAPIKeys(apiKey, apiSecret string) {
|
||||
o.PartnerID = apiKey
|
||||
o.SecretKey = apiSecret
|
||||
o.APIKey = apiKey
|
||||
o.APISecret = apiSecret
|
||||
}
|
||||
|
||||
func (o *OKCoin) GetFee(maker bool) float64 {
|
||||
@@ -1222,8 +1212,8 @@ func (o *OKCoin) GetFuturesUserPosition4Fix(symbol, contractType string) {
|
||||
}
|
||||
|
||||
func (o *OKCoin) SendAuthenticatedHTTPRequest(method string, v url.Values, result interface{}) (err error) {
|
||||
v.Set("api_key", o.PartnerID)
|
||||
hasher := common.GetMD5([]byte(v.Encode() + "&secret_key=" + o.SecretKey))
|
||||
v.Set("api_key", o.APIKey)
|
||||
hasher := common.GetMD5([]byte(v.Encode() + "&secret_key=" + o.APISecret))
|
||||
v.Set("sign", strings.ToUpper(common.HexEncodeToString(hasher)))
|
||||
|
||||
encoded := v.Encode()
|
||||
|
||||
@@ -340,9 +340,9 @@ func (o *OKCoin) ConvertToURLValues(values map[string]string) url.Values {
|
||||
}
|
||||
|
||||
func (o *OKCoin) WebsocketSign(values map[string]string) string {
|
||||
values["api_key"] = o.PartnerID
|
||||
values["api_key"] = o.APIKey
|
||||
urlVals := o.ConvertToURLValues(values)
|
||||
return strings.ToUpper(common.HexEncodeToString(common.GetMD5([]byte(urlVals.Encode() + "&secret_key=" + o.SecretKey))))
|
||||
return strings.ToUpper(common.HexEncodeToString(common.GetMD5([]byte(urlVals.Encode() + "&secret_key=" + o.APISecret))))
|
||||
}
|
||||
|
||||
func (o *OKCoin) AddChannelAuthenticated(channel string, values map[string]string) {
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -46,17 +47,7 @@ const (
|
||||
)
|
||||
|
||||
type Poloniex struct {
|
||||
Name string
|
||||
Enabled bool
|
||||
Verbose bool
|
||||
Websocket bool
|
||||
RESTPollingDelay time.Duration
|
||||
AuthenticatedAPISupport bool
|
||||
AccessKey, SecretKey string
|
||||
Fee float64
|
||||
BaseCurrencies []string
|
||||
AvailablePairs []string
|
||||
EnabledPairs []string
|
||||
exchange.ExchangeBase
|
||||
}
|
||||
|
||||
type PoloniexTicker struct {
|
||||
@@ -117,8 +108,8 @@ func (p *Poloniex) Start() {
|
||||
}
|
||||
|
||||
func (p *Poloniex) SetAPIKeys(apiKey, apiSecret string) {
|
||||
p.AccessKey = apiKey
|
||||
p.SecretKey = apiSecret
|
||||
p.APIKey = apiKey
|
||||
p.APISecret = apiSecret
|
||||
}
|
||||
|
||||
func (p *Poloniex) GetFee() float64 {
|
||||
@@ -1015,7 +1006,7 @@ func (p *Poloniex) ToggleAutoRenew(orderNumber int64) (bool, error) {
|
||||
func (p *Poloniex) SendAuthenticatedHTTPRequest(method, endpoint string, values url.Values, result interface{}) error {
|
||||
headers := make(map[string]string)
|
||||
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||
headers["Key"] = p.AccessKey
|
||||
headers["Key"] = p.APIKey
|
||||
|
||||
nonce := time.Now().UnixNano()
|
||||
nonceStr := strconv.FormatInt(nonce, 10)
|
||||
@@ -1023,7 +1014,7 @@ func (p *Poloniex) SendAuthenticatedHTTPRequest(method, endpoint string, values
|
||||
values.Set("nonce", nonceStr)
|
||||
values.Set("command", endpoint)
|
||||
|
||||
hmac := common.GetHMAC(common.HASH_SHA512, []byte(values.Encode()), []byte(p.SecretKey))
|
||||
hmac := common.GetHMAC(common.HASH_SHA512, []byte(values.Encode()), []byte(p.APISecret))
|
||||
headers["Sign"] = common.HexEncodeToString(hmac)
|
||||
|
||||
path := fmt.Sprintf("%s/%s", POLONIEX_API_URL, POLONIEX_API_TRADING_ENDPOINT)
|
||||
|
||||
Reference in New Issue
Block a user