sammchardy / python-binance

Binance Exchange API python implementation for automated trading
https://python-binance.readthedocs.io/en/latest/
MIT License
5.98k stars 2.2k forks source link

Cannot set long or short mode with futures_change_position_mode() #1204

Open Karlheinzniebuhr opened 2 years ago

Karlheinzniebuhr commented 2 years ago

I'm trying to set long or short mode (default is BOTH). client.futures_change_position_mode(data={'dualSidePosition':'true'})

It is giving me this error

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/ubuntu/.local/lib/python3.8/site-packages/binance/client.py", line 6127, in futures_change_position_mode
    return self._request_futures_api('post', 'positionSide/dual', True, data=params)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/binance/client.py", line 339, in _request_futures_api
    return self._request(method, uri, signed, True, **kwargs)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/binance/client.py", line 315, in _request
    return self._handle_response(self.response)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/binance/client.py", line 324, in _handle_response
    raise BinanceAPIException(response, response.status_code, response.text)
binance.exceptions.BinanceAPIException: APIError(code=-1022): Signature for this request is not valid.

How can I set the position side to long/short? I need this in order to know the current state of the open position in future api requests

anamahoot commented 2 years ago

Can you try? client.futures_change_position_mode(dualPositionMode='true')