Skip to content

Instantly share code, notes, and snippets.

@marcosan93
Last active October 27, 2021 23:34
Show Gist options
  • Select an option

  • Save marcosan93/5b0a86ce64e20afbd051e14bbe085cc0 to your computer and use it in GitHub Desktop.

Select an option

Save marcosan93/5b0a86ce64e20afbd051e14bbe085cc0 to your computer and use it in GitHub Desktop.
def getMultipleFunds(tickers, api_token):
"""
Gets fundamental data from multiple stock tickers given as a list. Returns
a large dataframe containing the concatenated information for all the given
tickers.
"""
# Verifying if the list of tickers is compatible
available = client.get_exchange_symbols("US")
available = set(i['Code'] for i in available)
tickers = [i for i in tickers if i in available]
# If no valid tickers
if len(tickers)==0:
return "No valid tickers found."
# Iterating through the tickers
dfs = {}
for ticker in tickers:
dfs[ticker] = formatFundamentals(ticker)
return pd.concat(dfs, axis=0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment