question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

fetch_ohlcv since problem

See original GitHub issue

Hi, 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:closed
  • Created 6 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
kroitorcommented, Oct 23, 2017

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!

0reactions
xgdgsccommented, Nov 19, 2017

OK. Thanks.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found