How to fetch Futures Cumulative Profit & Loss via API?

Is there a way to fetch Futures Cumulative PnL via API?

Checked the API documentation and couldn’t find anything.

Tried calculating and the accurate result isn’t coming.

Talking about the results on -

(PnL Analysis)

Hi. Hope this endpoint includes all the information you want.
GET /fapi/v2/account.

No it doesn’t have the cumulative PnL.

Cumulative Pnl is calculated in the PnL analysis of the futures.

So far there is no specific API providing this info. If you really want cumulated pnl, one approach is to get the income history and calculate it from your end.

I’ve tried this API to get the income, the document states that without passing in the stateTime and endTime, the recent 7-day data will be returned, is it the maximum data we can get, if I want to get more than that, i.e 1 month, 3 months… what should I do? if Binance does support?

@fuatto You are required to paginate the response using the startTime and endTime parameters.

  1. Start off by calling the endpoint with endTime = current time and startTime = endTime - 7 days.
    1a. If the endpoint returns no records or number of records is less than the limit, repeat step 1 with new endTime = old startTime and new startTime = new endTime - 7 days.
    1b. If the endpoint returns number of records equal to the limit, repeat step 1 with new endTime = oldest record’s timestamp and startTime = new endTime - 7 days.

Perform the above till startTime reaches the start of the desirable time window. (Ex. 3 months)

1 Like

it’s very instructive, thank you @tantialex

1 Like