Update Bitfinex API

Ref: https://github.com/thrasher-/gocryptotrader/issues/59
This commit is contained in:
Adrian Gallagher
2017-11-01 16:10:21 +11:00
parent 55c8b02d1d
commit 9e1ddf0468
2 changed files with 12 additions and 3 deletions

View File

@@ -140,9 +140,11 @@ func (b *Bitfinex) GetFundingBook(symbol string) (FundingBook, error) {
return response, common.SendHTTPGetRequest(path, true, b.Verbose, &response)
}
// GetOrderbook retieves the entire orderbook bid and ask price on a currency
// pair
// GetOrderbook retieves the orderbook bid and ask price points for a currency
// pair - By default the response will return 25 bid and 25 ask price points.
// CurrencyPair - Example "BTCUSD"
// Values can contain limit amounts for both the asks and bids - Example
// "limit_bids" = 1000
func (b *Bitfinex) GetOrderbook(currencyPair string, values url.Values) (Orderbook, error) {
response := Orderbook{}
path := common.EncodeURLValues(
@@ -153,7 +155,10 @@ func (b *Bitfinex) GetOrderbook(currencyPair string, values url.Values) (Orderbo
}
// GetTrades returns a list of the most recent trades for the given curencyPair
// By default the response will return 100 trades
// CurrencyPair - Example "BTCUSD"
// Values can contain limit amounts for the number of trades returned - Example
// "limit_trades" = 1000
func (b *Bitfinex) GetTrades(currencyPair string, values url.Values) ([]TradeStructure, error) {
response := []TradeStructure{}
path := common.EncodeURLValues(

View File

@@ -2,6 +2,7 @@ package bitfinex
import (
"log"
"net/url"
"github.com/thrasher-/gocryptotrader/common"
"github.com/thrasher-/gocryptotrader/currency/pair"
@@ -78,7 +79,10 @@ func (b *Bitfinex) GetOrderbookEx(p pair.CurrencyPair, assetType string) (orderb
// UpdateOrderbook updates and returns the orderbook for a currency pair
func (b *Bitfinex) UpdateOrderbook(p pair.CurrencyPair, assetType string) (orderbook.Base, error) {
var orderBook orderbook.Base
orderbookNew, err := b.GetOrderbook(p.Pair().String(), nil)
var vals url.Values
vals.Set("limit_bids", "100")
vals.Set("limit_asks", "100")
orderbookNew, err := b.GetOrderbook(p.Pair().String(), vals)
if err != nil {
return orderBook, err
}