sammchardy / python-binance

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

Testnet create_futures_order always gives Signature invalid. #1320

Closed CerebralSeed closed 1 year ago

CerebralSeed commented 1 year ago

Describe the bug When attempting to create_futures_order on testnet=True, returns APIError(code=-1022): Signature for this request is not valid.

To Reproduce Code snippet to reproduce the behavior:

from binance.client import Client
import time
from binkey import keys

bin_client=Client(keys.testapik, keys.testsk, testnet=True)
time.sleep(0.5)
symbol='BTCUSDT'
print(bin_client.futures_mark_price(symbol=symbol))
# ^^^ OKAY!!! - so it's not an API key issue
close_position = bin_client.futures_create_order(symbol=symbol, type='MARKET', side='BUY', amount=0.01,
                                             params={'reduceOnly': True})
# ^^^ Error!
print(close_position)

Expected behavior I expect a BUY order to close up to 0.01 of my position at MARKET.

Environment (please complete the following information):

Logs or Additional context binance.exceptions.BinanceAPIException: APIError(code=-1022): Signature for this request is not valid.

CerebralSeed commented 1 year ago

Problem was the "amount" parameter should have been "quantity".