fetch_ohlcv since problem
See original GitHub issueHi, I’m not sure if this is a bug or a feature; the following code won’t work:
since=int(datetime.datetime.strptime('2017-10-23 00:00:00', '%Y-%m-%d %H:%M:%S').strftime("%s"))
ohlc=polo.fetch_ohlcv("ETH/BTC", '5m', since)
It is needed to do the following:
since=int(datetime.datetime.strptime('2017-10-23 00:00:00', '%Y-%m-%d %H:%M:%S').strftime("%s"))
since *=1000
ohlc=polo.fetch_ohlcv("ETH/BTC", '5m', since)
I found this because checking the ccxt source code, I saw that (in Poloniex at least) the start time was calculated doing:
'start': int(since / 1000),
May be this is due to an old problem in Poloniex (I’m just guessing) and then Poloniex fixed the problem but the ccxt code still has the old workaround?. Anyway, this is not a problem, I can just multiply, but I’m not sure if I’m missing something.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
fetchOHLCV requires a since argument to be supplied along ...
I was using fetchOHLCV to get some exchange historical data, and now even when passing it with a 'since' argument, I get the...
Read more >Binance ccxt fetch ohlcv exceeding 1000 limit - Stack Overflow
This isn't exactly the answer you are looking for, but it will definitely solve your problem (ccxt): limit=None.
Read more >Download Historical Data of All Cryptocoins with CCXT for free
In my previous post, I explained how to download historical data for Binance coins. The good news is that it is also possible...
Read more >How to get historical price data using CCXT (over 500 and ...
You can do this with CCXT together with the Binance API using the since argument, like this: 1. 2. 3. 4. 5. import...
Read more >Utility Sub-commands - Freqtrade
This subcommand is useful for finding problems in your environment with loading strategies: modules with strategies that contain errors and failed to load ......
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 FreeTop 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
Top GitHub Comments
Hi, @werewere !
Nope, it’s not a bug, the library works with all timestamps as milliseconds, everywhere. So, yes, you can just do
ohlc=polo.fetch_ohlcv("ETH/BTC", '5m', since * 1000)
.Milliseconds are chosen for portability and cross-exchange compatibility, don’t forget that Poloniex is not the only exchange that implements the since param and fetch_ohlcv. There are other exchanges as well, and most of the time a common subset of milliseconds-range covers all needs for all exchanges, whereas seconds-based ranges are sometimes not sufficiently precise.
I hope this reply answers your question, I’d close this issue for now.
Thx!
OK. Thanks.