mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-07 23:16:53 +00:00
Exchanges: Include format pair in wrapper functions and test for formatting issues via tool wrapper issues (#582)
* Adds formatting of pair within binance wrapper, adds return of error from cli.ShowCommmandHelp * Add formatting function to submit order wrapper functions * Remove superfluous functionality * Updated exchange wrapper issues to create a disruptive pair to see which exchanges require attention, updates currency code generation and matching * reinstated format check, fixed tests * fixed niterinos * fix test * fix spelling mistake * make html file more aesthetic * Add missing format pairs * add formatting to pair for BTC Markets func * fix spelling
This commit is contained in:
@@ -183,13 +183,18 @@ func (b *Bitflyer) UpdateTradablePairs(forceUpdate bool) error {
|
||||
|
||||
// UpdateTicker updates and returns the ticker for a currency pair
|
||||
func (b *Bitflyer) UpdateTicker(p currency.Pair, assetType asset.Item) (*ticker.Price, error) {
|
||||
tickerNew, err := b.GetTicker(b.CheckFXString(p).String())
|
||||
fPair, err := b.FormatExchangeCurrency(p, assetType)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
tickerNew, err := b.GetTicker(b.CheckFXString(fPair).String())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = ticker.ProcessTicker(&ticker.Price{
|
||||
Pair: p,
|
||||
Pair: fPair,
|
||||
Ask: tickerNew.BestAsk,
|
||||
Bid: tickerNew.BestBid,
|
||||
Last: tickerNew.Last,
|
||||
@@ -200,14 +205,19 @@ func (b *Bitflyer) UpdateTicker(p currency.Pair, assetType asset.Item) (*ticker.
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return ticker.GetTicker(b.Name, p, assetType)
|
||||
return ticker.GetTicker(b.Name, fPair, assetType)
|
||||
}
|
||||
|
||||
// FetchTicker returns the ticker for a currency pair
|
||||
func (b *Bitflyer) FetchTicker(p currency.Pair, assetType asset.Item) (*ticker.Price, error) {
|
||||
tick, err := ticker.GetTicker(b.Name, p, assetType)
|
||||
fPair, err := b.FormatExchangeCurrency(p, assetType)
|
||||
if err != nil {
|
||||
return b.UpdateTicker(p, assetType)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
tick, err := ticker.GetTicker(b.Name, fPair, assetType)
|
||||
if err != nil {
|
||||
return b.UpdateTicker(fPair, assetType)
|
||||
}
|
||||
return tick, nil
|
||||
}
|
||||
@@ -223,18 +233,28 @@ func (b *Bitflyer) CheckFXString(p currency.Pair) currency.Pair {
|
||||
|
||||
// FetchOrderbook returns the orderbook for a currency pair
|
||||
func (b *Bitflyer) FetchOrderbook(p currency.Pair, assetType asset.Item) (*orderbook.Base, error) {
|
||||
ob, err := orderbook.Get(b.Name, p, assetType)
|
||||
fPair, err := b.FormatExchangeCurrency(p, assetType)
|
||||
if err != nil {
|
||||
return b.UpdateOrderbook(p, assetType)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ob, err := orderbook.Get(b.Name, fPair, assetType)
|
||||
if err != nil {
|
||||
return b.UpdateOrderbook(fPair, assetType)
|
||||
}
|
||||
return ob, nil
|
||||
}
|
||||
|
||||
// UpdateOrderbook updates and returns the orderbook for a currency pair
|
||||
func (b *Bitflyer) UpdateOrderbook(p currency.Pair, assetType asset.Item) (*orderbook.Base, error) {
|
||||
fPair, err := b.FormatExchangeCurrency(p, assetType)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
orderBook := new(orderbook.Base)
|
||||
|
||||
orderbookNew, err := b.GetOrderBook(b.CheckFXString(p).String())
|
||||
orderbookNew, err := b.GetOrderBook(b.CheckFXString(fPair).String())
|
||||
if err != nil {
|
||||
return orderBook, err
|
||||
}
|
||||
@@ -247,7 +267,7 @@ func (b *Bitflyer) UpdateOrderbook(p currency.Pair, assetType asset.Item) (*orde
|
||||
orderBook.Bids = append(orderBook.Bids, orderbook.Item{Price: orderbookNew.Bids[x].Price, Amount: orderbookNew.Bids[x].Size})
|
||||
}
|
||||
|
||||
orderBook.Pair = p
|
||||
orderBook.Pair = fPair
|
||||
orderBook.ExchangeName = b.Name
|
||||
orderBook.AssetType = assetType
|
||||
|
||||
@@ -256,7 +276,7 @@ func (b *Bitflyer) UpdateOrderbook(p currency.Pair, assetType asset.Item) (*orde
|
||||
return orderBook, err
|
||||
}
|
||||
|
||||
return orderbook.Get(b.Name, p, assetType)
|
||||
return orderbook.Get(b.Name, fPair, assetType)
|
||||
}
|
||||
|
||||
// UpdateAccountInfo retrieves balances for all enabled currencies on the
|
||||
|
||||
Reference in New Issue
Block a user