4

outputsize='compact' is giving last 100 days, and outputsize='full' is giving whole history which is too much data. Any idea how to write a code that extract some specific period?

ts=TimeSeries(key='KEY', output_format='pandas')
data, meta_data = ts.get_daily(symbol='MSFT', outputsize='compact')
print(data)

Thanks.

DellBoy
  • 41
  • 3

1 Answers1

0

This is how I was able to get the dates to work

ts = TimeSeries (key=api_key, output_format = "pandas")
data_daily, meta_data = ts.get_daily_adjusted(symbol=stock_ticker, outputsize ='full')

start_date = datetime.datetime(2000, 1, 1)
end_date = datetime.datetime(2019, 12, 31)


    # Create a filtered dataframe, and change the order it is displayed. 
date_filter = data_daily[(data_daily.index > start_date) & (data_daily.index <= end_date)]
date_filter = date_filter.sort_index(ascending=True)

If you want to iterate trough the rows in the new dataframe

for index, row in date_filter.iterrows():
Jakub
  • 1,260
  • 1
  • 13
  • 40