11197
October 15, 2021, 4:20pm
1
Hi! Please help. I can’t connect to testnet futures
I use the python-binance v1.0.15 library.
What argument should I pass to the “Client” class to connect to testnet.binancefuture.com .
from binance import Client
client = Client(api_key = ‘###’, api_secret=’###’)
ishuen
October 16, 2021, 1:34am
2
Hi. I’m not familiar with this library since it is developed by the community. But I think there is a small mistake at the first line. It should be from binance import Client
.
Also, when you are initiating the Client, you should be able to specify the environment. Here is the definition:
COIN_FUTURE_TO_SPOT = "CMFUTURE_MAIN" MARGIN_CROSS_TO_SPOT = "MARGIN_MAIN" MARGIN_CROSS_TO_USDT_FUTURE = "MARGIN_UMFUTURE" MINING_TO_SPOT = "MINING_MAIN" MINING_TO_USDT_FUTURE = "MINING_UMFUTURE" MINING_TO_FIAT = "MINING_C2C" def __init__( self, api_key: Optional[str] = None, api_secret: Optional[str] = None, requests_params: Dict[str, str] = None, tld: str = 'com', testnet: bool = False ): """Binance API Client constructor :param api_key: Api Key :type api_key: str. :param api_secret: Api Secret :type api_secret: str. :param requests_params: optional - Dictionary of requests params to use for all calls :type requests_params: dict. :param testnet: Use testnet environment - only available for vanilla options at the moment
1 Like
client = Client(api_key = ‘###’, api_secret=’###’, testnet=True)
1 Like