sammchardy / python-binance

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

Testnet APIError(code=-2019) #1234

Closed lenik6 closed 2 years ago

lenik6 commented 2 years ago

Hello. Testnet futures not working. How to see if it's using the right api? Please, help.

from binance.client import Client
api_key = 'my api'
api_secret = 'my secret'
client = Client(api_key=api_key, api_secret=api_secret, testnet=False)
client.API_URL = 'https://testnet.binancefuture.com/fapi'
client.futures_change_leverage(symbol='BTCUSDT', leverage=5)
buyorder = client.futures_create_order(symbol='BTCUSDT', side='BUY', type='MARKET', quantity=0.1)
print(buyorder)

error: binance.exceptions.BinanceAPIException: APIError(code=-2019): Margin is insufficient.

lenik6 commented 2 years ago

Decided.