You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I am working with the Binance TESTNET. I have used this same ID to create LIMIT and MARKET orders with no issue - but - when I try to create an OCO order, I get permission errors.
What am I doing wrong?
TIA
def futures_open_oco_order ( self, in_symbol : str = '' , in_side : str = '', in_amount : float = 0,
in_stop_price : float = 0, in_limit_price : float = 0, in_last_chance_price : float = 0 ):
[... snip ...]
# get the IDs together before going any further
server_params = {}
mainLocalID = t_tradeid.get_unique_id( self.client_id )
mainXChangeID = t_tradeid.generate_xchange_id( mainLocalID )
server_params['newClientOrderId'] = mainXChangeID
response = self.exchange.fapiPrivate_get_positionside_dual()
if not (response['dualSidePosition']):
response = self.exchange.fapiPrivatePostPositionSideDual ({'dualSidePosition':'true'})
# now set up the account so that it is ISOLATED
try:
response = self.exchange.fapiPrivate_post_margintype({ 'symbol': market['id'],
'marginType': 'ISOLATED', })
except ccxt.ExchangeError as f: # issue similar to the -4046 one above
if ( f.args[0].find("-4046") == -1 ): #
raise # (otherwise CONTINUE processing)
[... snip ...]
# set up variables to be passed in
symbol = market['id']
[... snip...]
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',
})
[ ... snip ...]
The error I am getting is as follows:
error binance {"code":-2015,"msg":"Invalid API-key, IP, or permissions for action."}
The ID works with the LIMIT and MARKET order creation functionalities fine.
The text was updated successfully, but these errors were encountered:
I only saw the place where one could obtain the API KEYs (where one does the trades - I tried to upload a picture but was not successful) - My understanding is that the Testnet does not support Margins at this time - correct? Will try this on the SPOT exchange
My understanding is that the Testnet does not support Margins at this time - correct? Will try this on the SPOT exchange
Yes, that's correct, however, I'd still recommend to confirm this with Binance's API support channel on Telegram, so that you have the info first-hand.
Hi, I am working with the Binance TESTNET. I have used this same ID to create LIMIT and MARKET orders with no issue - but - when I try to create an OCO order, I get permission errors.
What am I doing wrong?
TIA
The error I am getting is as follows:
The ID works with the LIMIT and MARKET order creation functionalities fine.
The text was updated successfully, but these errors were encountered: