Rangel Milushev
Rangel Milushev

Reputation: 131

Getting all filled orders from the Binance API

I am working on a trading bot and I wanted to train it by getting a list of my order history from Binance for a specific period of time. I looked at the API documentation here, but it seems that I am always required to provide a ticker symbol. While iterating over all tickers is an option, it will take forever to complete (I'm trying to get data for a full year). Can anyone point me to a less stupid way of doing this?

P.s. I also looked into allOrdersList but that only provides OCO orders and that is different than regular orders. See here. Any help would be greatly appreciated.

Upvotes: 13

Views: 9003

Answers (2)

Simon E.
Simon E.

Reputation: 58461

It's not currently possible (still, as of June 2021).

Many developers are complaining about the lack of such a commonly-used endpoint. See https://dev.binance.vision/t/fetch-all-account-orders/279

The only workarounds seem to be:

  • Looking at the user's current coin balances, and iterating over those relevant trading pairs (although this will miss the trades where the balance is now zero)

  • Iterate over every symbol offered by Binance – and there are a lot! This is ridiculous, and requires careful management of rate limits, but appears to be the only comprehensive solution.

Add your voice to the thread above, so that perhaps Binance might implement a more sane endpoint.

Upvotes: 8

alex
alex

Reputation: 1

Loop over all symbols once to get your entire order history. Then save the distinct symbols to a file/database. Then every time you make a order and it's on a new symbol append that symbol to your file/database.

Upvotes: 0

Related Questions