Has anybody ever been able to utilize binance testnet API for "futures"??????? Because there is no testnet api for "futures" at binance!!!!!!!!!!!!!!!!!!

#binance #futures #testnet #api

Edditing notes: since this website does not allow more than two links in the created topics. I received this message after trying to post my topic: Sorry, new users can only put 2 links in a post. I am going to define the links as follows:
binance_testnet_vision_link = “https://testnet.binance.vision/
binance_testnet_future_link = “https://testnet.binancefuture.com/

HAS ANYBODY EVER BEEN ABLE TO UTILIZE BINANCE TESTNET API FOR “FUTURES”???

following the instructions we can easily setup testnet API for “spot” trading
-create API keys at binance_testnet_vision_link

from binance.client import Client

#api keys from binance testnetfutures
api_key = “your api key created at binance vision”
api_secret = “your api secret created on binance vision”
client = Client(api_key, api_secret)
#changing the client api url to use the testnet
client.API_URL = binance_testnet_vision_link + ‘/api’

******** now you can successfully use the testnet API for spot trading

  • testing for futures

get balances for futures account

print(client.futures_account_balance())

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

*******unfortunatly this does not work for futures and a new API key&secret must
be created for futures at binance_testnet_future_link

– ok let’s make an account at binance_testnet_future_link
– after login in the API key and secret can be accessed at by scrolling down to API
Key

– let’s use the new keys

  • testing for futures

get balances for futures account

print(client.futures_account_balance())
#the same ERROR was populated
ERROR: APIError(code=-2015): Invalid API-key, IP, or permissions for action

********** let’s change the client API URL maybe it works!

#useing the new API Key with the following API URL
client.API_URL = binance_testnet_future_link + “/api”

  • testing for futures

get balances for futures account

print(client.futures_account_balance())
#the same ERROR was populated
ERROR: APIError(code=-2015): Invalid API-key, IP, or permissions for action

********* At this point I have nothing to say but that the binance testnet API for futures is not a possibility or at least no one knows how to use it if there is one. Well I doubt if there is one.

The Binance Futures USD-M Testnet URL is https://testnet.binancefuture.com/fapi not https://testnet.binancefuture.com/api.

COIN-M Testnet URL is https://testnet.binancefuture.com/dapi

1 Like

I tried fapi and dapi, I still receive the same error.

from binance.client import Client

futures_testnet_link = “https://testnet.binancefuture.com/

#I made api key and secret after making an account at futures_testnet_link
api_key = “copy and past from futures_testnet_link”
api_secret = “copy and past from futures_testnet_link”

client = Client(api_key, api_secret)

client.API_URL = “https://testnet.binancefuture.com/fapi

print(client.futures_account_balance())

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

Set the testnet argument to True to direct traffic to the testnet service

client = Client(api_key, api_secret,testnet=True)

print(client.futures_account_balance())

1 Like

It works now, thank you so much Tantialex :smiley: :+1:

I still get error trying to run this code:

client = Client(api_key, api_secret,testnet=True)

print(client.futures_account_balance())

Invalid API-key, IP, or permissions for action

Please confirm the API credentials are valid and generated from the correct environment. (Production API credentials will not work on the testnet environment)