diff --git a/bitfinexhttp.go b/bitfinexhttp.go index 794d09b6..26766e08 100644 --- a/bitfinexhttp.go +++ b/bitfinexhttp.go @@ -99,6 +99,11 @@ func (b *Bitfinex) IsEnabled() (bool) { return b.Enabled } +func (b *Bitfinex) SetAPIKeys(apiKey, apiSecret string) { + b.APIKey = apiKey + b.APISecret = apiSecret +} + func (b *Bitfinex) SendAuthenticatedHTTPRequest(path string, params map[string]interface{}) (err error) { request := make(map[string]interface{}) request["request"] = "/v1/" + path diff --git a/bitstamphttp.go b/bitstamphttp.go index 9d71e418..6f647eee 100644 --- a/bitstamphttp.go +++ b/bitstamphttp.go @@ -88,6 +88,12 @@ func (b *Bitstamp) IsEnabled() (bool) { return b.Enabled } +func (b *Bitstamp) SetAPIKeys(clientID, apiKey, apiSecret string) { + b.ClientID = clientID + b.APIKey = apiKey + b.APISecret = apiSecret +} + func (b *Bitstamp) GetTicker() (BitstampTicker) { err := SendHTTPRequest(BITSTAMP_API_URL + BITSTAMP_API_TICKER, true, &b.Ticker) diff --git a/btcchinahttp.go b/btcchinahttp.go index 893ada00..05602dae 100644 --- a/btcchinahttp.go +++ b/btcchinahttp.go @@ -57,6 +57,11 @@ func (b *BTCChina) IsEnabled() (bool) { return b.Enabled } +func (b *BTCChina) SetAPIKeys(apiKey, apiSecret string) { + b.APIKey = apiKey + b.APISecret = apiSecret +} + func (b *BTCChina) GetTicker(symbol string) (BTCChinaTicker) { type Response struct { Ticker BTCChinaTicker diff --git a/btcehttp.go b/btcehttp.go index 6e93d1a3..8c83e3d8 100644 --- a/btcehttp.go +++ b/btcehttp.go @@ -60,6 +60,11 @@ func (b *BTCE) IsEnabled() (bool) { return b.Enabled } +func (b *BTCE) SetAPIKeys(apiKey, apiSecret string) { + b.APIKey = apiKey + b.APISecret = apiSecret +} + func (b *BTCE) GetTicker(symbol string) (BTCeTicker) { type Response struct { Ticker BTCeTicker diff --git a/btcmarkets.go b/btcmarkets.go index 7f928fb1..a04b02e1 100644 --- a/btcmarkets.go +++ b/btcmarkets.go @@ -50,6 +50,11 @@ func (b *BTCMarkets) IsEnabled() (bool) { return b.Enabled } +func (b *BTCMarkets) SetAPIKeys(apiKey, apiSecret string) { + b.APIKey = apiKey + b.APISecret = apiSecret +} + func (b *BTCMarkets) GetTicker(symbol string) (BTCMarketsTicker) { ticker := BTCMarketsTicker{} path := fmt.Sprintf("/market/%s/AUD/tick", symbol) diff --git a/config.go b/config.go index fbb8d4b9..23ba733c 100644 --- a/config.go +++ b/config.go @@ -14,6 +14,7 @@ type Exchanges struct { Enabled bool APIKey string APISecret string + ClientID string Pairs string BaseCurrencies string } diff --git a/config_example.json b/config_example.json index 5ada4cd4..aa9262ac 100644 --- a/config_example.json +++ b/config_example.json @@ -11,6 +11,7 @@ { "Name": "Bitstamp", "Pairs": "BTCUSD", + "ClientID": "ClientID", "APIKey": "Key", "APISecret": "Secret", "BaseCurrencies": "USD", diff --git a/huobihttp.go b/huobihttp.go index 937ec907..92966e09 100644 --- a/huobihttp.go +++ b/huobihttp.go @@ -54,6 +54,11 @@ func (h *HUOBI) IsEnabled() (bool) { return h.Enabled } +func (h *HUOBI) SetAPIKeys(apiKey, apiSecret string) { + h.AccessKey = apiKey + h.SecretKey = apiSecret +} + func (h *HUOBI) GetTicker(symbol string) (HuobiTicker) { resp := HuobiTickerResponse{} path := fmt.Sprintf("http://market.huobi.com/staticmarket/ticker_%s_json.js", symbol) diff --git a/itbithttp.go b/itbithttp.go index d8b684cf..62753242 100644 --- a/itbithttp.go +++ b/itbithttp.go @@ -63,6 +63,11 @@ func (i *ItBit) IsEnabled() (bool) { return i.Enabled } +func (i *ItBit) SetAPIKeys(apiKey, apiSecret string) { + i.ClientKey = apiKey + i.APISecret = apiSecret +} + func (i *ItBit) GetTicker(currency string) (ItBitTicker) { path := ITBIT_API_URL + "/markets/" + currency + "/ticker" var itbitTicker ItBitTicker diff --git a/lakebtchttp.go b/lakebtchttp.go index 327449ef..4d51384a 100644 --- a/lakebtchttp.go +++ b/lakebtchttp.go @@ -65,6 +65,11 @@ func (l *LakeBTC) IsEnabled() (bool) { return l.Enabled } +func (l *LakeBTC) SetAPIKeys(apiKey, apiSecret string) { + l.Email = apiKey + l.APISecret = apiSecret +} + func (l *LakeBTC) GetTicker() (LakeBTCTickerResponse) { response := LakeBTCTickerResponse{} err := SendHTTPRequest(LAKEBTC_API_URL + LAKEBTC_TICKER, true, &response) diff --git a/main.go b/main.go index 02c551cc..23ecc737 100644 --- a/main.go +++ b/main.go @@ -68,6 +68,7 @@ func main() { log.Printf("%s disabled.\n", exch.Name) } else { log.Printf("%s enabled.\n", exch.Name) + exchange.btcchina.SetAPIKeys(exch.APIKey, exch.APISecret) } } else if exchange.bitstamp.GetName() == exch.Name { if !exch.Enabled { @@ -75,6 +76,7 @@ func main() { log.Printf("%s disabled.\n", exch.Name) } else { log.Printf("%s enabled.\n", exch.Name) + exchange.bitstamp.SetAPIKeys(exch.ClientID, exch.APIKey, exch.APISecret) } } else if exchange.bitfinex.GetName() == exch.Name { if !exch.Enabled { @@ -82,6 +84,7 @@ func main() { log.Printf("%s disabled.\n", exch.Name) } else { log.Printf("%s enabled.\n", exch.Name) + exchange.bitfinex.SetAPIKeys(exch.APIKey, exch.APISecret) } } else if exchange.btce.GetName() == exch.Name { if !exch.Enabled { @@ -89,6 +92,7 @@ func main() { log.Printf("%s disabled.\n", exch.Name) } else { log.Printf("%s enabled.\n", exch.Name) + exchange.btce.SetAPIKeys(exch.APIKey, exch.APISecret) } } else if exchange.btcmarkets.GetName() == exch.Name { if !exch.Enabled { @@ -96,6 +100,7 @@ func main() { log.Printf("%s disabled.\n", exch.Name) } else { log.Printf("%s enabled.\n", exch.Name) + exchange.btcmarkets.SetAPIKeys(exch.APIKey, exch.APISecret) } } else if exchange.okcoinChina.GetName() == exch.Name { if !exch.Enabled { @@ -103,6 +108,7 @@ func main() { log.Printf("%s disabled.\n", exch.Name) } else { log.Printf("%s enabled.\n", exch.Name) + exchange.okcoinChina.SetAPIKeys(exch.APIKey, exch.APISecret) } } else if exchange.okcoinIntl.GetName() == exch.Name { if !exch.Enabled { @@ -110,6 +116,7 @@ func main() { log.Printf("%s disabled.\n", exch.Name) } else { log.Printf("%s enabled.\n", exch.Name) + exchange.okcoinIntl.SetAPIKeys(exch.APIKey, exch.APISecret) } } else if exchange.itbit.GetName() == exch.Name { if !exch.Enabled { @@ -117,6 +124,7 @@ func main() { log.Printf("%s disabled.\n", exch.Name) } else { log.Printf("%s enabled.\n", exch.Name) + exchange.itbit.SetAPIKeys(exch.APIKey, exch.APISecret) } } else if exchange.lakebtc.GetName() == exch.Name { if !exch.Enabled { @@ -124,6 +132,7 @@ func main() { log.Printf("%s disabled.\n", exch.Name) } else { log.Printf("%s enabled.\n", exch.Name) + exchange.lakebtc.SetAPIKeys(exch.APIKey, exch.APISecret) } } else if exchange.huobi.GetName() == exch.Name { if !exch.Enabled { @@ -131,6 +140,7 @@ func main() { log.Printf("%s disabled.\n", exch.Name) } else { log.Printf("%s enabled.\n", exch.Name) + exchange.huobi.SetAPIKeys(exch.APIKey, exch.APISecret) } } } diff --git a/okcoinhttp.go b/okcoinhttp.go index ef9420d3..3fa08de3 100644 --- a/okcoinhttp.go +++ b/okcoinhttp.go @@ -77,6 +77,11 @@ func (o *OKCoin) SetURL(url string) { o.APIUrl = url } +func (o *OKCoin) SetAPIKeys(apiKey, apiSecret string) { + o.PartnerID = apiKey + o.SecretKey = apiSecret +} + func (o *OKCoin) GetTicker(symbol string) (OKCoinTicker) { resp := OKCoinTickerResponse{} path := fmt.Sprintf("ticker.do?symbol=%s&ok=1", symbol)