I'm trying to access fundamental data from Alpha Vantage's python API, but it's not working. My imports:
from alpha_vantage.timeseries import TimeSeries
from alpha_vantage.fundamentaldata import FundamentalData
The TimeSeries functions work well, e.g. the following works fine:
ts = TimeSeries(key=av_api, output_format='pandas')
data, metadata = ts.get_daily_adjusted(symbol='IMB', outputsize='full')
But the Fundamentals calls don't work. When I call:
FundamentalData.get_income_statement_annual(symbol='IBM')
I get the following error:
TypeError: _format_wrapper() missing 1 required positional argument: 'self'
I've read through the documentation, and the tutorials don't have examples using the fundamentals API call. Can someone help? Thank you.
I checked the source of getting the annual income statement, and it requires specifying self, so in this case, I was able to get it correctly by giving the ts with the APIkey set.
ts = TimeSeries(key=api_key, output_format='pandas')
FundamentalData.get_income_statement_annual(ts,symbol='IBM')
fiscalDateEnding ... netIncome
date ...
1970-01-01 00:00:00.000000000 2020-12-31 ... 5590000000
1970-01-01 00:00:00.000000001 2019-12-31 ... 9431000000
1970-01-01 00:00:00.000000002 2018-12-31 ... 8728000000
1970-01-01 00:00:00.000000003 2017-12-31 ... 5753000000
1970-01-01 00:00:00.000000004 2016-12-31 ... 11872000000
[5 rows x 26 columns], 'IBM')