myTrades does not return consistent info

Calling myTrades with default limits not always produces the same results.
In my example, sometime it returns 114 items while others 116.

Additionally, putting myTrades in a loop starting with “fromId=0” and limit to 50 (or any other number required to have at least two loops) I am having an additional issue.
Indeed, it happens that sometime I get 50, 50, 14 and 2 items, other times 50, 50, 14 and 0 items.
This means that I can’t rely on quitting from the loop when the number of items retrieved are less than the limits, moreover, even in this situation I am getting sometime 114 items, others 116.

This is leading to a severe issue for me as I need to rebuild the orders/trades history per each ticker I am managing.

… snip of my python code …

...
...
...

def get_my_trades(self, **params):
    return self._get('myTrades', True, data=params)

...
...
...

def get_trades(self, symbol):
    my_trades = []
    items_to_collect = 500

try:
    my_trades = self.connect.get_my_trades(symbol=symbol, limit=items_to_collect, fromId=0)
    trades = my_trades
except (BinanceAPIException, BinanceRequestException) as e:
    trades = ""
    self._logger.warning(f'Warning raised by Binance Exceptions: {e}')

# Sometime the items retrieved are less than "items_to_collect" although there are others to pop
# Sometime it happens that not all the items are retrieved ... bug?
while len(my_trades) > 0:
    try:
        my_trades = self.connect.get_my_trades(symbol=symbol, limit=items_to_collect, fromId=my_trades[-1]['id']+1)
        trades += my_trades
    except (BinanceAPIException, BinanceRequestException) as e:
        trades = ""
        self._logger.warning(f'Warning raised by Binance Exceptions: {e}')

return trades

Hi. Thanks for reporting the issue. This has been raised up earlier and we are currently investigating it.

Could you also provide some more information about your case? For example, when were your trades filled and when did you query the records through API?

Sure thing, all my trades refer to the pair ONEUSDT and have been filled between 13/06/2019 18:04:43 and 15/06/2021 08:53:18.
The last two trades are not always collected.
More specifically that referring to a buy dated 15/06/2021 08:50:22 and that referred to a sell dated 15/06/2021 08:53:18.
I am querying for all the trades using python and conda.
What seems strange to me is that if I call myTrades with default limits sometime it returns 114 items, others 116.
While, by changing the limits to 50, I am getting an additional issue.
Indeed sometime I get 50, 50, 14 and 2 items, other times 50, 50, 14 and 0 items.
This means that I can’t rely on quitting from the loop when the number of items retrieved are less than the limits, moreover, even in this situation I am getting sometime 114 items, others 116.

Please do let me know should you need for further info.

Python version: 3.8
Virtual Env: conda
OS: Wiindows 10 Enterprise

Hello, does anybody have any news on this?
Thanks a lot

Hi @aisling, sure … let me check the behaviour in these days and get back
Thanks for asking

Hi. The team is still investigating it.

1 Like

It seems it’s working now, will keep you posted!

Same issue here, mostly with the following tickers: REQBTC, PHABTC, PONDBTC , and seems to happen for mostly recent trades (June / July)

Hi @immadevel and @Alex_M, can you let us know if you’re still facing this issue please?