mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-14 07:26:47 +00:00
Update Bitfinex API
Ref: https://github.com/thrasher-/gocryptotrader/issues/59
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user