From 6fc6c9f11679cc56592ba0123258c4d73c122b05 Mon Sep 17 00:00:00 2001 From: Adrian Gallagher Date: Tue, 10 Mar 2015 15:20:21 +1100 Subject: [PATCH] Implemented Exchange version variable. --- bitfinexhttp.go | 3 ++- bitstamphttp.go | 1 + btcehttp.go | 3 ++- btcmarkets.go | 1 + huobihttp.go | 1 + itbithttp.go | 1 + lakebtchttp.go | 1 + okcoinhttp.go | 1 + 8 files changed, 10 insertions(+), 2 deletions(-) diff --git a/bitfinexhttp.go b/bitfinexhttp.go index 4464915a..db6a4fd4 100644 --- a/bitfinexhttp.go +++ b/bitfinexhttp.go @@ -15,6 +15,7 @@ import ( const ( BITFINEX_API_URL = "https://api.bitfinex.com/v1/" + BITFINEX_API_VERSION = "1" BITFINEX_TICKER = "pubticker/" BITFINEX_STATS = "stats/" BITFINEX_ORDERBOOK = "book/" @@ -238,7 +239,7 @@ func (b *Bitfinex) GetAccountFeeInfo() (bool, error) { func (b *Bitfinex) SendAuthenticatedHTTPRequest(method, path string, params map[string]interface{}, result interface{}) (err error) { request := make(map[string]interface{}) - request["request"] = "/v1/" + path + request["request"] = fmt.Sprintf("/v%s/%s", BITFINEX_API_VERSION, path) request["nonce"] = strconv.FormatInt(time.Now().UnixNano(), 10) if params != nil { diff --git a/bitstamphttp.go b/bitstamphttp.go index 75ddb6a4..8fb52a9b 100644 --- a/bitstamphttp.go +++ b/bitstamphttp.go @@ -15,6 +15,7 @@ import ( const ( BITSTAMP_API_URL = "https://www.bitstamp.net/api/" + BITSTAMP_API_VERSION = "0" BITSTAMP_API_TICKER = "ticker/" BITSTAMP_API_ORDERBOOK = "order_book/" BITSTAMP_API_TRANSACTIONS = "transactions/" diff --git a/btcehttp.go b/btcehttp.go index 2862c046..063b1601 100644 --- a/btcehttp.go +++ b/btcehttp.go @@ -15,6 +15,7 @@ import ( const ( BTCE_API_URL = "https://btc-e.com/tapi" + BTCE_API_VERSION = "2" BTCE_GET_INFO = "getInfo" BTCE_TRANSACTION_HISTORY = "TransHistory" BTCE_TRADE_HISTORY = "TradeHistory" @@ -78,7 +79,7 @@ func (b *BTCE) GetTicker(symbol string) (BTCeTicker) { } response := Response{} - req := fmt.Sprintf("https://btc-e.com/api/2/%s/ticker", symbol) + req := fmt.Sprintf("https://btc-e.com/api/%s/%s/ticker", BTCE_API_VERSION, symbol) err := SendHTTPRequest(req, true, &response) if err != nil { log.Println(err) diff --git a/btcmarkets.go b/btcmarkets.go index 863a5fbc..79f9a58a 100644 --- a/btcmarkets.go +++ b/btcmarkets.go @@ -14,6 +14,7 @@ import ( const ( BTCMARKETS_API_URL = "https://api.btcmarkets.net" + BTCMARKETS_API_VERSION = "0" ) type BTCMarkets struct { diff --git a/huobihttp.go b/huobihttp.go index 805c9518..ccdaa868 100644 --- a/huobihttp.go +++ b/huobihttp.go @@ -14,6 +14,7 @@ import ( const ( HUOBI_API_URL = "https://api.huobi.com/apiv2.php" + HUOBI_API_VERSION = "2" ) type HUOBI struct { diff --git a/itbithttp.go b/itbithttp.go index af83dbe0..67b8e466 100644 --- a/itbithttp.go +++ b/itbithttp.go @@ -14,6 +14,7 @@ import ( const ( ITBIT_API_URL = "https://api.itbit.com/v1/" + ITBIT_API_VERSION = "1" ) type ItBit struct { diff --git a/lakebtchttp.go b/lakebtchttp.go index 1b2a573c..a8bc72a8 100644 --- a/lakebtchttp.go +++ b/lakebtchttp.go @@ -14,6 +14,7 @@ import ( const ( LAKEBTC_API_URL = "https://www.LakeBTC.com/api_v1/" + LAKEBTC_API_VERSION = "1" LAKEBTC_TICKER = "ticker" LAKEBTC_ORDERBOOK = "bcorderbook" LAKEBTC_ORDERBOOK_CNY = "bcorderbook_cny" diff --git a/okcoinhttp.go b/okcoinhttp.go index 91026522..4fe905ba 100644 --- a/okcoinhttp.go +++ b/okcoinhttp.go @@ -14,6 +14,7 @@ import ( const ( OKCOIN_API_URL = "https://www.okcoin.com/api/v1/" OKCOIN_API_URL_CHINA = "https://www.okcoin.cn/api/v1/" + OKCOIN_API_VERSION = "1" ) type OKCoin struct {