Closed Dr-Nuke closed 3 years ago
Describe the bug upon specific API calls on stock time series data, the returned data has non-unique timestamps with
To Reproduce Steps to reproduce the behavior:
call the API for monthly SPX data and look at the result execute the following code:
from twelvedata import TDClient import pandas as pd # Initialize client - apikey parameter is requiered td = TDClient(apikey=api_key) interval = '1month' symbol = 'SPX' ts = td.time_series( symbol=symbol, interval=interval, outputsize=5000, timezone="UTC", exchange= 'NYSE', start_date= '2000-01-01 00:00:00', # end_date = end_date, order= 'asc', ) # Returns pandas.DataFrame result=ts.as_pandas() print(result[result.index.duplicated(keep=False)])
result of print:
open high low close volume datetime 2006-01-01 1248.29004 1294.90002 1245.73999 1280.07996 0 2006-01-01 1248.29004 1294.90002 1245.73999 1282.45996 0 2006-02-01 1280.07996 1297.56995 1253.60999 1280.66003 0 2006-02-01 1282.45996 1297.56995 1253.60999 1291.23999 0 2006-03-01 1280.66003 1310.88000 1268.42004 1294.82996 0 ... ... ... ... ... ... 2020-01-01 3244.66992 3337.77002 3214.63989 3225.52002 0 2020-02-01 3235.65991 3393.52002 2855.84009 2954.21997 0 2020-02-01 3235.65991 3393.52002 2855.84009 2954.21997 0 2020-03-01 2982.50000 3090.22998 2944.89990 3090.22998 0 2020-03-01 2974.28003 3136.71997 2191.86011 2578.52002 59996936715
we can see many monthly dates with two entries instead of one, and some pairs even have contradicting values.
Expected behavior the print statement should return an empty dataframe
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context Add any other context about the problem here.
This is an issue related to API and not this library. But anyway it is resolved.
Describe the bug upon specific API calls on stock time series data, the returned data has non-unique timestamps with
To Reproduce Steps to reproduce the behavior:
call the API for monthly SPX data and look at the result execute the following code:
result of print:
we can see many monthly dates with two entries instead of one, and some pairs even have contradicting values.
Expected behavior the print statement should return an empty dataframe
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context Add any other context about the problem here.