nautechsystems / nautilus_trader

A high-performance algorithmic trading platform and event-driven backtester
https://nautilustrader.io
GNU Lesser General Public License v3.0
1.71k stars 402 forks source link

BinanceFuturesInstrumentProvider loading MIN_NOTIONAL from wrong field #1771

Closed AnthonyVince closed 2 days ago

AnthonyVince commented 2 days ago

Bug Report

Expected Behavior

min_notional values are provided by Binance in the exchange info filters. They are critical to live trading since rejects can occur.

Actual Behavior

min_notional values are always zero in self.cache.instrument(self.instrument_id).min_notional

Steps to Reproduce the Problem

  1. Put a breakpoint in line 266 in adapters/binance/futures/providers.py
  2. Run a script that loads Binance USDt Futures in testnet or live
  3. Notice that min_notional_filter.minNotional is always None. The correct value seems to be in min_notional_filter.notional

This code works min_notional = Money(min_notional_filter.notional, currency=quote_currency)

See Binance trading rules here

Specifications

cjdsellers commented 2 days ago

Hi @AnthonyVince

Thanks for the report here!

You're quite right, it seems Spot is different to Futures. The Spot instrument provider goes for minNotional from the NOTIONAL filter which looks correct, where as Futures has a MIN_NOTIONAL filter and the notional field is indeed correct.

I've pushed the fix to develop 8b78be6108016e98c868f93395a2eb67277deca5.