python-binance icon indicating copy to clipboard operation
python-binance copied to clipboard

How do you open furures trade via python on binance, or how do you open short positions

Open cryptobot123-123 opened this issue 3 years ago • 5 comments

i want to be able to short but i dont know how to laverage on marigin or how to trade on futures on binance

cryptobot123-123 avatar May 05 '21 16:05 cryptobot123-123

Example: open Long market in HEGDE MODE client.futures_create_order(symbol='BTTUSDT',side='BUY',type='MARKET',positionSide='LONG',quantity=100000)

hoangdh5 avatar May 06 '21 03:05 hoangdh5

do you maybe know how to use laverage on this?

cryptobot123-123 avatar May 07 '21 08:05 cryptobot123-123

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 avatar May 07 '21 08:05 cryptobot123-123

@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.

dnlfrst avatar May 19 '21 15:05 dnlfrst

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.

Karlheinzniebuhr avatar Jun 16 '22 19:06 Karlheinzniebuhr