Fetch all account orders

Hi
fetching history of Trades and order is one of mandatory features for developers who are trying to have their own software to work with Binance.
To calculate profit/loss from the beginning or have a portfolio management software we have to fetch list of full orders and trades in the past.
Fetching history by symbol is the only way that we can use just now, but still there are some problems to do that. iterating over symbols need symbol list from binance that can be fetched using various endpoints like ExchangeInfo. but it shows only active pairs and if you have orders and trades on pairs that were active in past and now they are unlisted from binance you will never reach them. so there is no way to fetch full history of trades and orders.
It would be very useful if binance can provide endpoints to fetch full history of orders/trades
or at least have an endpoint to fetch all traded/ordered pairs of an account

19 Likes

You don’t need external services to get your full history, but yes, you are completely right, it is a mess currently to get all that data:

  • Fetch Exchange Info to get all trading pairs information
  • Fetch User’s Account Information to get current balances (and hope that user never converted dust to BNB)
  • Finally, go through user’s assets and match them with trading pairs from “Exchange Info” response and go fetch all possible trading pairs for each asset (since we cannot tell which pair user actually traded)

As far as I understood, if user converted some asset to BNB (e.g. dust), you won’t be able to tell that user ever traded that asset, so you will have hard time to get trading history for that asset’s pairs…

4 Likes

Being able to fetch all trade without ticker and in a paginated way is really a mandatory feature.

It’s a win win, since it will ease developers life, while requiring less charge on binance server, since binance servers won’t be spammed with batch of requests for all existing pairs (when most of them probably do not have any trade records)
As well as solving issues like disabled pairs etc…

11 Likes

Any idea if this is on the backlog or ever will see the light of day? Would LOVE to have this endpoint. Bruteforcing it by pair is just way too expensive.

People have been waiting an endpoint like this for years;


10 Likes

Totally agree with all posts above. I need it too. Loop over each pair is a really bad practice… Hope sincerely you could do something very soon! Thank you.

8 Likes

This API method would do well for everyone!

7 Likes

I asked this already a few times, it is really a mess to try to get your closed orders, and have to loop many time evry check, but somehow they refuse to do, while all other exchanges can do. Online you can do also, takes 10 sec

3 Likes

I’m just going to bump this post until we get some response from the team.

3 Likes

Please binance have a look :slight_smile:

3 Likes

Guys, maybe all together open tickets support or send email to them with this feature request?

3 Likes

the best way to do this is to let user manually sync their assets, so you dont need to loop every time. Or you could check tokens the user already own and try to check those orders, ppl always order the same tokens over and over, then if active token value does not match the balance of all orders combined, loop through the rest because clearly a piece is missing.

It’s a good alternative, but it still requires you to unnecessarily loop through the symbol to get all the historical orders. This shouldn’t be necessary in the first place. I imagine an endpoint like /api/v3/futures/historical-orders or /api/v3/spot/historical-orders or get all historical orders using /api/v3/all/historical-orders without having to add the symbol as parameter.

1 Like

any updates on that? no endpoint is no solution! :laughing:

3 Likes

I too need this obvious endpoint, its very very weak that it doesn’t exist. Many other exchange apis support it, and the result is pointless hammering of the current endpoint one symbol at a time that slows down getting the data and probably chokes up the endpoint bandwidth.

The websocket is no use if there is no persistent connection to the users running application.

3rd party developers help build Binance’s overall business by providing tools for users to help them trade, So its really poor that this very basic user api endpoint doesn’t work intelligently.

If it was my API I would be embarrassed, frankly, especially since you are on V3 of the api!!

3 Likes

This is getting ridiculous when using a lot of sub-accounts or creating a 3rd party service as others pointed at. With 100+ sub accounts, hundred of thousands of calls are needed to check the history for all symbols for all subs.
I feel like this forum is only for very basic questions and that any feature request is completely ignored :thinking:

3 Likes

feedback, suggestions are all reviewed and forward to the team if they are reasonable.

For this concern, there are already plenty discussions.

With 100+ sub accounts, client can easily consume all request limits in short time. But with websocket, it can be handy to just subscribe and listen for account changes.

Spot websocket support up to 1024 streams per connection, so you can listen all sub accounts in just one connection to server, without request limit concern, it’s the best practice to get all orders.

The problem is to get the historical data, not the realtime.

You already confirmed that it is not possible and that we need to use the rest endpoint, leading to a lot of requests.

Providing a better endpoint would considerably reduce the number of requests needed to get an account or sub-account historical orders/trades.

3 Likes

Hey Dino, thanks for the reply to this issue. You can see many people have problems with this. The websocket doesn’t allow fetching historical data, so if the users app is off or not on the network, there is no way to use that to get the full info of a users orders and trades without hammering the current endpoint.

In practice, the vast majority of endpoint calls return no results, so it’s hugely inefficient. There are ~1300 symbols and climbing, and any given user might have orders across only a very small percentage of those, yet we have no way of predicting what new symbol they might order on next.

Surely a getAllOrders endpoint should be able to return all orders for that user. If it still has the optional “since” timestamp, fromId and result number limits we could get recent results in one call and all results in a handful of calls for the vast majority of users.

Even if it had a big fat Rate limit like only allowing a few calls per minute it would STILL be far faster and involve less server time and load than the current process.

Please consider escalating this issue, it’s the one deal breaker in an otherwise good API.

5 Likes

I truly believe it can’t be that difficult: you have your account, distinguished by e-mail, and somewhere in their databases there must be some sort of relationship between the account ans the spot orders. Thus, you just need to fetch the associated orders.

I believe in you guys, you can do this!

2 Likes

I reckon it’s the ONE main deal breaker to efficient use of the API. Rate limit the hell out of it, its still gonna be 100x quicker than doing the one symbol at a time search where the overwhelming majority of calls return zero, always. Less load on the servers as well I expect.

C’mon Binance Devs, feel our pain, I reckon it could be done in one sprint, let’s have it for an Easter Egg. I bet this endpoint exists already within the Binance internal codebase. You just need to expose it with the right structure and limits in place.

Also, please stop trying to side track the issue by saying to use the websocket. The websocket is no solution to apps that are not always connected (ie vast majority of mobile apps)

Frankly, the only reason I can imagine they haven’t implemented it after so long is a business decision, but I’m blowed if I can see how this helps protect their business. I can see no good technical reason blocking this endpoint change.

9 Likes