twelvedata / twelvedata-python

Twelve Data Python Client - Financial data API & WebSocket
https://twelvedata.com
MIT License
382 stars 56 forks source link

[Bug] Duplicate dates in time_series #54

Closed SimonDamberg closed 2 years ago

SimonDamberg commented 2 years ago

Describe the bug A clear and concise description of what the bug is.

When fetching time_series data, a large majority of assets in the NASDAQ 100 and OMX Stockholm GI has duplicate values for a lot of dates, sometimes with different values. I have not tried any other exchanges.

This seems to not only be a bug with the python library, since the web requests return the same results. However, I have not been able to receive a response from the support team, so I thought I would try here as well.

To Reproduce Some example queries

https://api.twelvedata.com/time_series?apikey=INSERTAPIKEY&interval=1day&start_date=2020-01-01 00:00:00&end_date=2020-02-01 00:00:00&symbol=AMD

https://api.twelvedata.com/time_series?apikey=INSERTAPIKEY&interval=1day&start_date=2020-01-01 00:00:00&end_date=2020-02-01 00:00:00&symbol=META

https://api.twelvedata.com/time_series?apikey=INSERTAPIKEY&interval=1day&start_date=2020-01-01 00:00:00&end_date=2020-02-01 00:00:00&symbol=ASML

Expected behavior A time series with an interval of 1 day between each consecutive datapoint.

midasSSS commented 2 years ago

The issue is not related to this package; however, it was fixed on the API side.

SimonDamberg commented 2 years ago

@midasSSS Yes, sorry. However, is it still not fixed on the API side. Setting outputsize seems to lead to duplicate dates, see below.

https://api.twelvedata.com/time_series?apikey=INSERTAPIKEY&interval=1day&start_date=2020-02-01 00:00:00&end_date=2020-02-28 00:00:00&symbol=AMD&outputsize=200

https://api.twelvedata.com/time_series?apikey=INSERTAPIKEY&interval=1day&start_date=2020-02-01 00:00:00&end_date=2020-02-28 00:00:00&symbol=MSFT&outputsize=200

Even when outputsize is less than the specified range, duplicates are returned.

https://api.twelvedata.com/time_series?apikey=INSERTAPIKEY&interval=1day&start_date=2020-02-01 00:00:00&end_date=2020-02-28 00:00:00&symbol=AMD&outputsize=15

However, not setting outputsize leads to outputs that have dates not in the expected range. For example, the query below should start at 2020-02-01 but starts at 2020-01-07

https://api.twelvedata.com/time_series?apikey=INSERTAPIKEY&interval=1day&start_date=2020-01-01 00:00:00&end_date=2020-02-01 00:00:00&symbol=AMD

https://api.twelvedata.com/time_series?apikey=INSERTAPIKEY&interval=1day&start_date=2020-02-01 00:00:00&end_date=2020-02-28 00:00:00&symbol=MSFT

midasSSS commented 2 years ago

Thanks for the feedback. I believe that now it should be resolved.

SimonDamberg commented 2 years ago

@midasSSS No, still not fixed. I tried some other symbols and they all have duplicate data like the initial bug...

https://api.twelvedata.com/time_series?apikey=INSERTAPIKEY&interval=1day&start_date=2020-01-01 00:00:00&end_date=2020-02-01 00:00:00&symbol=AMC

https://api.twelvedata.com/time_series?apikey=INSERTAPIKEY&interval=1day&start_date=2020-01-01 00:00:00&end_date=2020-02-01 00:00:00&symbol=MMM

https://api.twelvedata.com/time_series?apikey=INSERTAPIKEY&interval=1day&start_date=2020-01-01 00:00:00&end_date=2020-02-01 00:00:00&symbol=IVACC&country=Sweden

midasSSS commented 2 years ago

Our team checked again, and there should be no duplicates now.

SimonDamberg commented 2 years ago

@midasSSS Still not fixed... Just to name a few examples:

https://api.twelvedata.com/time_series?apikey=INSERTAPIKEY&interval=1day&start_date=2020-01-01 00:00:00&end_date=2020-02-01 00:00:00&symbol=KESKOB

https://api.twelvedata.com/time_series?apikey=INSERTAPIKEY&interval=1day&start_date=2020-01-01 00:00:00&end_date=2020-02-01 00:00:00&symbol=CGCBV

https://api.twelvedata.com/time_series?apikey=INSERTAPIKEY&interval=1day&start_date=2020-01-01 00:00:00&end_date=2020-02-01 00:00:00&symbol=FORTUM

midasSSS commented 2 years ago

@SimonDamberg, this market should be correct now.

SimonDamberg commented 2 years ago

@midasSSS Not completely correct. The query below has duplicate dates for 2018-03-22, its first listed date on the market.

https://api.twelvedata.com/time_series?apikey=INSERTAPIKEY&interval=1day&start_date=2018-03-15 00:00:00&end_date=2020-03-31 00:00:00&symbol=HARVIA

SimonDamberg commented 2 years ago

@midasSSS Here are more examples for duplicates. Please check this issue on all your assets, I've had to ask five times now...

https://api.twelvedata.com/time_series?apikey=INSERTAPIKEY&interval=1day&start_date=2021-02-05 00:00:00&end_date=2021-02-06 00:00:00&symbol=EQNR&country=Norway

https://api.twelvedata.com/time_series?apikey=INSERTAPIKEY&interval=1day&start_date=2021-02-05 00:00:00&end_date=2021-02-06 00:00:00&symbol=AKAST&country=Norway

And on Copenhagen exchange

https://api.twelvedata.com/time_series?apikey=INSERTAPIKEY&interval=1day&start_date=2020-10-20 00:00:00&end_date=2020-10-21 00:00:00&symbol=VWS

https://api.twelvedata.com/time_series?apikey=INSERTAPIKEY&interval=1day&start_date=2020-10-20 00:00:00&end_date=2020-10-21 00:00:00&symbol=BAVA

https://api.twelvedata.com/time_series?apikey=INSERTAPIKEY&interval=1day&start_date=2020-10-20 00:00:00&end_date=2020-10-21 00:00:00&symbol=CHR&country=denmark