I am coding with python and ccxt library. I am trying to make a bot for binance futures. My bot is supposed to run on Hedge mode, everything seemed to be working great until i changed my preference to Hedge mode from one-way mode. I searched and tried everything i could, to resolve the problem. This is the error I am having -:
binance {"code":-4061,"msg":"Order's position side does not match user's setting."}
Bellow is all the code.
import ccxt
exchange = ccxt.binance({
'base_url': 'https://testnet.binancefuture.com',
'account_info': '/api/v3/account',
'enableRateLimit': True,
'apiKey': '...',
'secret': '...',
'hedgeMode': True,
'options': {
'defaultType': 'future',
},
})
exchange.set_sandbox_mode(True)
balance = exchange.fetch_balance()
balance
The above code works just fine I have also changed my API credentials a bit for safety reasons although i am using a test net, apart from that everything is as it is.
My problem is with the code bellow
symbol = 'ETH/USDT'
typee = 'market' # or 'market', other types aren't unified yet
side1 = 'buy'
side2 = 'sell'
amount = 0.1 # your amount
#price = 0.21 # your price
# overrides
params = {
'position_side': 'LONG' and 'SHORT'
#'stopPrice': ,# your stop price
}
buy_market_order = exchange.create_order(symbol, typee, side1, amount, params)
#INCLUDE 'price' IF NEEDED
sell_market_order = exchange.create_order(symbol, typee, side2, amount, params)