-1

I am running a bot using CCXT library to operate with Binance Futures API. It was working like a charm so far. However, now I'm getting the following error:

binance {"code":-5000,"msg":"GET /fapi/v1/positionRisk is retired, please use GET /fapi/v2/positionRisk

I understand the nature of the problem, and I see in the changelog that some endpoints has been deprecated in v1 of endpoints and Binance ask for moving to v2 endpoints:

2023-06-28

Notice:

REST

The following endpoints will no longer be supported from 2023-07-15:
    GET /fapi/v1/account
    GET /fapi/v1/balance
    GET /fapi/v1/positionRisk
Please switch to corresponding v2 endpoints:
    GET /fapi/v2/account
    GET /fapi/v2/balance
    GET /fapi/v2/positionRisk

I've tried to solve the problem adding a "version" entrance in my Exchange instance:

self.ccxt_client = ccxt.binance({'apiKey':API_KEY,
                                        'secret':API_SECRET,
                                        'timeout': 30000,
                                        'enableRateLimit': True,
                                        'ratelimit': 300,
                                        'adjustForTimeDifference': True,
                                        'options':{'defaultType': 'future'},
                                        'version': 'v2'
                                        })

According to documentation, this 'v2' string, is attached at the end of the endpoint base name. However the same error appears, as if v1 where still being called.

Pablo A
  • 1
  • 2

1 Answers1

0

I found the solution, after updating CCXT version to the latest, automatically works with Binance v2 API endpoint. It generated new compatibility issues related with pairs nomenclature. EX: BTC/USDT has to be written as "BTC/USDT:USDT" but the original issue was completely solved.

Pablo A
  • 1
  • 2