I am having a problem using the Binance Python API.

I am using Python3.7 on Ubuntu

Basically, when making the call below, I get an error: {"code":-2015,"msg":"Invalid API-key,

The thing is that this ID has worked fine on the Binance TESTNET for LIMIT and MARKET orders. This is the only order type I am having problems with. I also logged the message here:

https://github.com/ccxt/ccxt/issues/8089

I was attempting to do this on the FUTURES exchange.

retval = self.exchange.private_post_order_oco({
    'symbol': symbol,
    'side': side,
    'quantity': self.exchange.amount_to_precision(symbol, amount),
    'price': self.exchange.currency_to_precision( quote_currency, abs(float( in_last_chance_price ))),
    'stopPrice': self.exchange.currency_to_precision( quote_currency, abs(float(in_stop_price))),
    'stopLimitPrice': self.exchange.currency_to_precision( quote_currency, abs(float( in_limit_price ))),
    'positionSide': self.position_side[side],
    'listClientOrderId' : mainXChangeID,
    'limitClientOrderId': mainXChangeID + '-L',
    'stopClientOrderId' : mainXChangeID + '-S',
})

Any help, hints or advice of what could be going on would be greatly appreciated.

1

There are 1 answers

0
Sam On

Binance SPOT supports OCO orders on production and testnet

Binance FUTURES does not support OCO orders for production or testnet

source