sammchardy / python-binance

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

APIError(code=-2015): Invalid API-key, IP, or permissions for action. #695

Open fireghostea opened 3 years ago

fireghostea commented 3 years ago

I wan to use this lib for sample trade in https://testnet.binancefuture.com/ I use API_KEY and API_SECTERT thats provided in bottom of panel. but when I want do anything like get_account() i get this error i change default client.py base on this link https://github.com/sammchardy/python-binance/pull/578/commits/692992dca2dbbd705d6ffe48921dfae59b6d1375 but problem exist.

Sladerix commented 3 years ago

same error

calebpitts commented 3 years ago

did you guys figure it out? I get the same thing

MHilhorst commented 3 years ago

You need to generate API keys through this website and also use the test api url mentioned in this website:

https://testnet.binance.vision/

abraarsyed commented 3 years ago

Here is a small example code snippet on how you can set the API_KEY, API_SECRET and API_URL:

` from binance.client import Client

api_key = 'YOUR-API-KEY' api_secret = 'YOUR-API-SECRET' api_url = 'YOUR-API-URL'

client = Client(api_key, api_secret) client.API_URL = api_url `

Note: Do not insert confidential data directly into the code

egcodes commented 3 years ago

for test try this

client = Client(api_key, api_secret)
client.API_URL = "https://testnet.binance.vision/api"

but there must be a better way to convert all api to test image

alexrmacleod commented 1 year ago

here is the answer, gotta create a testnet api key which is different to the regular api key via the binance testnet docs

https://stackoverflow.com/questions/67376632/how-to-create-binance-test-api-key

https://testnet.binance.vision/ (click generate api)