ccxt / ccxt

A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading API with support for more than 100 bitcoin/altcoin exchanges
https://docs.ccxt.com
MIT License
32.92k stars 7.51k forks source link

Can't change binance endpoint version: #18828

Closed PabloAliArgentina closed 1 year ago

PabloAliArgentina commented 1 year ago

Operating System

Linux

Programming Languages

Python

CCXT Version

free

Description

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

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.

Code

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

18768 Facing the same issue

PabloAliArgentina commented 1 year ago

It seems to be an old version of ccxt. I found v2 was updated recently: https://github.com/ccxt/ccxt/issues/18768 So I updated the version to latest and despite other errors that appeared due to the version change, this issue seems to have been resolved. I will be testing it, and give further conclusions.