sammchardy / python-binance

Binance Exchange API python implementation for automated trading
https://python-binance.readthedocs.io/en/latest/
MIT License
6.04k stars 2.2k forks source link

MIN_NOTATIONAL in oco order with max sell #739

Open RubenTGT opened 3 years ago

RubenTGT commented 3 years ago

I can't find a way to place an oco order with 100% sell quantity, i try with this but MIN_NOTATIONAL error appears

balance = float(client.get_asset_balance(asset='VIA', recvWindow=10000)['free'])  
orderooco = client.create_oco_order(
    symbol = 'VIABTC',
    side = 'SELL',
    price = '0.00001770',
    quantity = balance,
    stopPrice = '0.00001745',
    stopLimitPrice = '0.00001740',
    stopLimitTimeInForce = 'GTC'
)

I also try with this

    def sellAmount(coin):
    balanceSell = float(client.get_asset_balance(coin,
    recvWindow=10000)['free'])
    maxSell = round(balanceSell * .995, 5)
    return balanceSell

orderooco = client.create_oco_order(
    symbol = 'VIABTC',
    side = 'SELL',
    price = '0.00001770',
    quantity = sellAmount('VIA'),
    stopPrice = '0.00001745',
    stopLimitPrice = '0.00001740',
    stopLimitTimeInForce = 'GTC'
)

Expected behavior Place an oco sell order with all coin quantity.

Bob12345 commented 3 years ago

Are you processing the "Binance filters" and adjusting your buy/sell amounts accordingly? https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md#filters You need to calculate the minimum notional amount yourself for each and every trading pair, or Binance won't honor your trade request!