QuantConnect / Lean.Brokerages.Binance

Binance Brokerage Plugin
Apache License 2.0
3 stars 17 forks source link

Binance Crypto Futures v2 API Support #25

Closed fishstoryyy closed 10 months ago

fishstoryyy commented 10 months ago

Expected Behavior

Support crypto futures v2 api per the change log below:

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

Actual Behavior

Currently only supports v1 api.

Potential Solution

Reproducing the Problem

Deploy a Binance Crypto Futures strategy and get back this error message:

During the algorithm initialization, the following exception has occurred: Error getting cash balance from brokerage: BinanceBrokerage.GetCashBalance: request failed: [400] Bad Request, Content: {"code":-5000,"msg":"GET /fapi/v1/account is retired, please use GET /fapi/v2/account"}, ErrorMessage: BinanceBrokerage.GetCashBalance: request failed: [400] Bad Request, Content: {"code":-5000,"msg":"GET /fapi/v1/account is retired, please use GET /fapi/v2/account"}, ErrorMessage:  in BinanceBaseRestApiClient.cs:line 154 BinanceBrokerage.GetCashBalance: request failed: [400] Bad Request, Content: {"code":-5000,"msg":"GET /fapi/v1/account is retired, please use GET /fapi/v2/account"}, ErrorMessage: 
 BinanceBrokerage.GetCashBalance: request failed: [400] Bad Request, Content: {"code":-5000,"msg":"GET /fapi/v1/account is retired, please use GET /fapi/v2/account"}, ErrorMessage:  in BinanceBaseRestApiClient.cs:line 154 BinanceBrokerage.GetCashBalance: request failed: [400] Bad Request, Content: {"code":-5000,"msg":"GET /fapi/v1/account is retired, please use GET /fapi/v2/account"}, ErrorMessage:

System Information

Checklist