I want to get options data from AlphaVantage, which they have recently added. I took my query code from a how-to YouTube video. I am trying to modify that like this:
def datafromav():
sourcefile = open('dataone.txt', 'a')
pd.set_option('display.max_rows', 999)
from alpha_vantage.timeseries import TimeSeries
import time
api_key = 'XXXXXXXX'
ts = TimeSeries.HISTORICAL_OPTIONS(key=api_key, output_format='pandas')
STOCKS = [substock]
data, meta_data = ts.HISTORICAL_OPTIONS(symbol=STOCKS, outputsize = 'compact')
print(data, file = sourcefile)
sourcefile.close()
I get the error message:
AttributeError: type object 'TimeSeries' has no attribute 'HISTORICAL_OPTIONS'
What am I doing wrong? I have taken the code for pulling stocks and changing it for options but not sure what I am doing wrong.
1