sammchardy / python-binance

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

OCO order example from docs produces APIError(code=-1106): Parameter 'stopLimitTimeInForce' sent when not required. Other options of parameters give 1013 and 1104 #1300

Open astr0gator opened 1 year ago

astr0gator commented 1 year ago

Describe the bug OCO order example from the docs (client.create_oco_order) produces APIError(code=-1106): Parameter 'stopLimitTimeInForce' sent when not required

To Reproduce Code snippet to reproduce the behavior: Code is taken from docs: https://python-binance.readthedocs.io/en/latest/account.html#id2

from binance.enums import *
order = client.create_oco_order(
    symbol='BNBBTC',
    side=SIDE_SELL,
    stopLimitTimeInForce=TIME_IN_FORCE_GTC,
    quantity=100,
    stopPrice='0.00001',
    price='0.00002')

Expected behavior Order is created. Other orders work, OCO doesn't.

Environment (please complete the following information):

Logs or Additional context If I'm not sending 'stopLimitTimeInForce', I got APIError(code=-1013): Stop loss orders are not supported for this symbol. Same error for other symbols (i.e. 'ETHUSDT').

TIME_IN_FORCE_GTC and other constants are loaded before client.create_oco_order is triggered.

If I'm sending timeInForce=TIME_IN_FORCE_GTC, I got APIError(code=-1104): Not all sent parameters were read; read '7' parameter(s) but was sent '8'.

What I'm doing wrong?