exchange_wrapper_coverage: deploy context value, fix panics (#1119)

* exchange_wrapper_coverage: deploy context value, fix panics at the disco.

* wrap_cov: skip ftx impl. protect racey result map, reset verbosity when random wrapper functions are called.

* fixed ocd trigger sequence

* triggernometry eased

Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
This commit is contained in:
Ryan O'Hara-Reid
2023-01-24 16:15:38 +11:00
committed by GitHub
parent 03a24b3ab1
commit 1d779c301b
3 changed files with 40 additions and 7 deletions

View File

@@ -634,6 +634,8 @@ func (b *Binance) FetchTicker(ctx context.Context, p currency.Pair, assetType as
func (b *Binance) FetchOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error) {
ob, err := orderbook.Get(b.Name, p, assetType)
if err != nil {
// TODO: Disconnect update orderbook functionality from fetch orderbook
// functionality across all wrappers as this mutes potential errors.
return b.UpdateOrderbook(ctx, p, assetType)
}
return ob, nil
@@ -659,6 +661,8 @@ func (b *Binance) UpdateOrderbook(ctx context.Context, p currency.Pair, assetTyp
orderbookNew, err = b.UFuturesOrderbook(ctx, p, 1000)
case asset.CoinMarginedFutures:
orderbookNew, err = b.GetFuturesOrderbook(ctx, p, 1000)
default:
return nil, fmt.Errorf("[%s] %w", assetType, asset.ErrNotSupported)
}
if err != nil {
return book, err

View File

@@ -182,12 +182,17 @@ func (by *Bybit) SetDefaults() {
// Setup takes in the supplied exchange configuration details and sets params
func (by *Bybit) Setup(exch *config.Exchange) error {
err := exch.Validate()
if err != nil {
return err
}
if !exch.Enabled {
by.SetEnabled(false)
return nil
}
err := by.SetupDefaults(exch)
err = by.SetupDefaults(exch)
if err != nil {
return err
}