Implemented Exchange version variable.

This commit is contained in:
Adrian Gallagher
2015-03-10 15:20:21 +11:00
parent d08fb482be
commit 6fc6c9f116
8 changed files with 10 additions and 2 deletions

View File

@@ -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 {

View File

@@ -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/"

View File

@@ -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)

View File

@@ -14,6 +14,7 @@ import (
const (
BTCMARKETS_API_URL = "https://api.btcmarkets.net"
BTCMARKETS_API_VERSION = "0"
)
type BTCMarkets struct {

View File

@@ -14,6 +14,7 @@ import (
const (
HUOBI_API_URL = "https://api.huobi.com/apiv2.php"
HUOBI_API_VERSION = "2"
)
type HUOBI struct {

View File

@@ -14,6 +14,7 @@ import (
const (
ITBIT_API_URL = "https://api.itbit.com/v1/"
ITBIT_API_VERSION = "1"
)
type ItBit struct {

View File

@@ -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"

View File

@@ -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 {