Trades in fetch_trades should have unified order ASC or DESC
See original GitHub issueSome exchanges (for example poloniex) returns trades history in the descending order and some others in ascending.
- Programming Language: Python
- CCXT version: 1.10.389
- Exchange: binance, poloniex
- Method: fetch_trades
# example 1: ordered by time desc
ccxt.poloniex ({'verbose': True}).fetch_trades(
market['symbol'], # symbol returned by fetch_markets()
since=timestamp
)
# https://poloniex.com/public?command=returnTradeHistory¤cyPair=BTC_NXT&start=1410158341&end=1410499372
# example 2: ordered by time asc
ccxt.binance ({'verbose': True}).fetch_trades(
market['symbol'], # symbol returned by fetch_markets()
since=timestamp
)
# https://api.binance.com/api/v1/aggTrades?symbol=ETHBTC
I think there should be one unified order (ASC as for me).
This issue can be solved by checking first and last trade’s timestamps and applying reversed
iterator if needed.
Posting it because it took me some time to go there and as for me, this behavior is unexpected.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:25 (14 by maintainers)
Top Results From Across the Web
Exchanges — ccxt 2.4.71 documentation
To connect to an exchange and start trading you need to instantiate an exchange ... Python exchange = ccxt.binance ({ 'rateLimit': 10000, #...
Read more >CCXT - 简书
Overview. The ccxt library is a collection of available crypto exchanges or exchange classes. Each class implements the public and private ...
Read more >Coinbase 3 Network Confirmations Poloniex Orderbook
All extra params are exchange-specific non-unified. Thus market orders can be emulated with limit orders where missing. If you only need one how...
Read more >Reset Qr Code Bitstamp Binance Exchange Says Invalid ...
To connect to an exchange and start trading you need to instantiate an exchange ... by timestamp in ascending order, oldest trade first,...
Read more >Spring Cloud
If you need to use newer version of AWS SDK than one configured by Spring Cloud ... In order to interact with the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
okok.
Question: Some exchanges have limitation on max since time. For example, when trying to iterate over exchanges list poloniex will return an undocumented error (can’t return more than 1 month trade history). I think there should be an error or auto adjusting since parameter to maximal available.
fetch_trades reversed order (we already discussed earlier). Python
reversed
return an iterator that hasn’t__getitem__
(so you can’t retrieve order by id) and its type differs from normal behavior (list) so I think it’s a bad idea to return implicitlyreversed
orders iterator.Now my code looks like this:
Maybe we should explicitly return
is_reversed
to force reaction from developer? Like this: