python-binance
python-binance copied to clipboard
How do you open furures trade via python on binance, or how do you open short positions
i want to be able to short but i dont know how to laverage on marigin or how to trade on futures on binance
Example: open Long market in HEGDE MODE client.futures_create_order(symbol='BTTUSDT',side='BUY',type='MARKET',positionSide='LONG',quantity=100000)
do you maybe know how to use laverage on this?
APIError(code=-4061): Order's position side does not match user's setting.
I get this error if i try to buy like you said.
@cryptobot123-123 You need to assure that the trading settings reflect your intentions. In particular, you need to set the position mode to be in hedge mode to be able to use positionSide=LONG
:
client.futures_change_position_mode(dualPositionMode='true')
If you want to trade futures on USDⓈ-M with leverage, you need to set the leverage for the corresponding symbol before creating an order:
client.futures_change_leverage(symbol='BTTUSDT', leverage=5)
where leverage
would set your orders to have a 5× leverage.
I'm trying to call
client.futures_change_position_mode(dualPositionMode='true')
But it's giving me this error
APIError(code=-1102): Mandatory parameter 'dualSidePosition' was not sent, was empty/null, or malformed.
Formatting it like this isn't working either, what am I missing?
client.futures_change_position_mode(data={'dualPositionMode':'true'})
APIError(code=-1022): Signature for this request is not valid.