Finnhub-API
Finnhub-API copied to clipboard
When sending timestamp with trailing .0 no error is given
I recently found a pretty nasty bug in my program which used finnhub data. thx btw for that service!
I used candles based on different time frames and found that I got the wrong time frame back. Why? My python code constructed the timestamp with a trailing .0
which was accepted by the API but misinterpreted.
Compare the result of
$ curl "https://finnhub.io/api/v1/stock/candle?symbol=AAPL&resolution=1&from=1572651390&to=1572910590&token=TK"
(returns data from 1572651420
to 1572910560
).
with
$ curl "https://finnhub.io/api/v1/stock/candle?symbol=AAPL&resolution=1&from=1572651390.0&to=1572910590.0&token=TK"
(returns data from 1572595440
to 1572910560
).
I'd expect the second call to either return the same result as the first call, or to give an error message saying that the parameter format was wrong.
Btw, I used finnhub_client.stock_candles(symbol, '1', start, end)
. I was not sure whether to open the issue here or at Finnhub-Stock-API/finnhub-python
We have released a new patch to raise error on invalid timestamp.
Hope that helps !