mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-31 23:16:54 +00:00
exchanges/kraken,bittrex,gemini: Resolve Kraken panic, lint corrections, Bittrex batch tickers, set Gemini order limits and update tradable pairs (#1372)
* fix kraken, batch bittrex, fix lint * surprise gemini! * thought this happened automatically * fix before shazbert sees * fixes annoying atoi bug * rm futures from gemini * lint * bittrex UpdatedAt, gemini Limits, stats relook * STATS used HARDEN!(improve stats package) * Whoopsies in your Daisies * rm RWMutex, json stringeroo * fixes additional index issues 😆 😭
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -87,6 +88,7 @@ func (b *Bittrex) SetDefaults() {
|
||||
Websocket: true,
|
||||
RESTCapabilities: protocol.Features{
|
||||
TickerFetching: true,
|
||||
TickerBatching: true,
|
||||
KlineFetching: true,
|
||||
TradeFetching: true,
|
||||
OrderbookFetching: true,
|
||||
@@ -297,8 +299,36 @@ func (b *Bittrex) UpdateTradablePairs(ctx context.Context, forceUpdate bool) err
|
||||
}
|
||||
|
||||
// UpdateTickers updates the ticker for all currency pairs of a given asset type
|
||||
func (b *Bittrex) UpdateTickers(_ context.Context, _ asset.Item) error {
|
||||
return common.ErrFunctionNotSupported
|
||||
func (b *Bittrex) UpdateTickers(ctx context.Context, a asset.Item) error {
|
||||
if a != asset.Spot {
|
||||
return fmt.Errorf("%w %v", asset.ErrNotSupported, a)
|
||||
}
|
||||
tickers, err := b.GetTickers(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
summaries, err := b.GetMarketSummaries(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for x := range tickers {
|
||||
for y := range summaries {
|
||||
if !strings.EqualFold(summaries[y].Symbol, tickers[x].Symbol) {
|
||||
continue
|
||||
}
|
||||
var pair currency.Pair
|
||||
pair, err = currency.NewPairFromString(tickers[x].Symbol)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
tickerPrice := b.constructTicker(tickers[x], &summaries[y], pair, a)
|
||||
err = ticker.ProcessTicker(tickerPrice)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// UpdateTicker updates and returns the ticker for a currency pair
|
||||
|
||||
Reference in New Issue
Block a user