Binance Future api : APIError(code=-2015): Invalid API-key, IP, or permissions for action, request ip
Asked Answered
E

4

11

I used Binance Python api in my algotrading bot, but I get an error when I use future market api. ''' BinanceAPIException: APIError(code=-2015): Invalid API-key, IP, or permissions for action, request ip ''' I am sure that my API-key is true and I enabled Future api permissions in setting. I get this error only when I used that for future market. It was perfectly work for spot Market. what should I do to fix this?

Eisenstein answered 17/11, 2020 at 6:20 Comment(0)
M
8

In my code, I have a "client" variable:

client = Client(config.API_KEY, config.API_SECRET, tld='us')

and, here's the thing:

if you are using a non-US version of Binance, and you have not registered your account on the US website, then remove tld='us'

And vice-versa!

Mele answered 28/4, 2021 at 12:34 Comment(1)
Thank you so much for pointing that one out. The tld='us' seemed optional at first until you pointed out the Binance.US difference. This fixed my issuesTransplant
P
6

Before creating your API key you must open a Futures Account. Then go and create the API key. Then tap the "Edit Restrictions" button and check the option "Enable Futures". After you do it you will see this:

Playoff answered 24/7, 2021 at 15:55 Comment(0)
C
1

Binance Futures has both a testing environment, and a live environment.

By default, the Python SDK you're using connects to the Testnet. You can see this behaviour in the constant/system.py file.

You can either:

  • modify the system.py file to use Live urls by default instead
  • or specify it into your instance of RequestClient directly. RequestClient(api_key=xxx, secret_key=xxx, url='https://fapi.binance.com')

Related issue: https://github.com/Binance-docs/Binance_Futures_python/issues/60

Celio answered 18/11, 2020 at 9:26 Comment(0)
T
0

In your code you have use this .... client = Client(config.API_KEY, config.API_SECRET, tld='us') then change as per your account such as, binance.com, then use tld='com'. binance.us, then use tld ='us'.

And also change the restriction and enable Spot & Margin trading.

Temporal answered 28/3, 2023 at 9:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.