You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to write a for loop to pull cash statements for all the tickers in the NYSE. The for loop below contains a try-except block for when quarterly cash statements for a given ticker cannot be returned from Polygon from the last ten years:
cash_statements = {}
for ticker in nyse.symbol:
try:
cash_statements[ticker] = obb.equity.fundamental.cash(ticker, provider="polygon", limit=40, period='quarter').to_df()
except:
print('{} not available'.format(ticker))
A sample of the output is shown below, with the following tickers not having cash statements available as the for loop is executing:
Note that "JPM not available" is underlined. The quarterly cash statements from the last 10 years couldn't be pulled using the for loop. However, when I call the code below to pull JPM's cash statements, I do get an output: obb.equity.fundamental.cash('JPM', provider="polygon", limit=40, period='quarter').to_df()
(The dataframe has been truncated for the sake of brevity.)
Do you know what could be causing this inconsistency, for the stand-alone cash statement query to work for JPM but not when it's run in a for loop? Is there a better way you would recommend pulling the cash statements for multiple tickers? Thanks.
OS: Windows 11
Python version 3.11.8
The text was updated successfully, but these errors were encountered:
I'm trying to write a for loop to pull cash statements for all the tickers in the NYSE. The for loop below contains a try-except block for when quarterly cash statements for a given ticker cannot be returned from Polygon from the last ten years:
A sample of the output is shown below, with the following tickers not having cash statements available as the for loop is executing:
Note that "JPM not available" is underlined. The quarterly cash statements from the last 10 years couldn't be pulled using the for loop. However, when I call the code below to pull JPM's cash statements, I do get an output:
obb.equity.fundamental.cash('JPM', provider="polygon", limit=40, period='quarter').to_df()
(The dataframe has been truncated for the sake of brevity.)
Do you know what could be causing this inconsistency, for the stand-alone cash statement query to work for JPM but not when it's run in a for loop? Is there a better way you would recommend pulling the cash statements for multiple tickers? Thanks.
The text was updated successfully, but these errors were encountered: