Problem with {"code":-4061,"msg":"Order's position side does not match user's setting."} while creating futures order on CCTX Binance

I'm trying to create simple future order on CCTX binance exchange using this code and get -4061 problem:

import ccxt
import asyncio
import json
import config
exchange = ccxt.binance({ 'apiKey': config.apiKey, 'secret': config.secret, 'enableRateLimit': True,
})
exchange.options = {'defaultType': 'future', # or 'margin' or 'spot' 'adjustForTimeDifference': True, 'newOrderRespType': 'FULL', 'defaultTimeInForce': 'GTC'}
markets = exchange.load_markets()
symbol = 'BTC/USDT'
type ='MARKET'
side = 'buy'
amount = 0.001
price = 26000
order = exchange.createOrder(symbol, type, side, amount, price)
open_orders = exchange.fetchOrders('BTC/USDT')
data = json.dumps(open_orders, indent=4, separators=(',', ': ') )
ccxt.base.errors.ExchangeError: binance {"code":-4061,"msg":"Order's position side does not match user's setting."}

I've tried to use several things like:

exchange.fapiPrivatePostPositionSideDual ({'dualSidePosition':'true'}) 

or

exchange.set_position_mode(hedged=True, symbol=symbol)

Or setting my Position setting to Hedge-mode on binance website but nothing have helped me

1 Related questions 12 How to make a binance futures order with ccxt in python? 0 ccxt.base.errors.InvalidOrder: binance Order would trigger immediately 17 How to place a futures market order using python-binance: APIError(code=-1111): Precision is over the maximum defined for this asset Related questions 12 How to make a binance futures order with ccxt in python? 0 ccxt.base.errors.InvalidOrder: binance Order would trigger immediately 17 How to place a futures market order using python-binance: APIError(code=-1111): Precision is over the maximum defined for this asset 1 sell order in binance python API 1 CCXT Binance Future Order 1 Unable to place a trailing stop loss order with ccxt 1 Binance API Futures - {'code': -1117, 'msg': 'Invalid side.'} 2 Short Order on Binance futures testnet resulting in APIError (ReduceOnly Order is Rejected) 0 Trying to place a binance futures trailing stop order using python? 1 Place Binance Future Order using python-binance wrapper. Error: APIError(code=-1102): Mandatory parameter '5e-05' was not sent Load 7 more related questions Show fewer related questions Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like