Skip to content

FinanceToolkit v1.4.1

Compare
Choose a tag to compare
@JerBouma JerBouma released this 20 Oct 13:15
· 424 commits to main since this release

I've added in the Dividend Calendar which can be shown by get_dividend_calendar():

from financetoolkit import Toolkit

API_KEY = "FINANCIAL_MODELING_PREP_KEY"

# Initialize the Toolkit with company tickers
companies = Toolkit(
    ["AAPL", "MSFT", "GOOGL", "AMZN"], api_key=API_KEY, start_date="2005-01-01"
)

companies.get_dividend_calendar()

Which returns:

image

Next to that, this release introduces historical data from FinancialModelingPrep. This is enabled by default when you provide an API key but can be changed back by setting historical_source to "YahooFinance" when initialising the Toolkit. When you don't provide an API key it defaults to Yahoo Finance.

This is done to prevent rate limits from becoming an issue when you have purchased a FinancialModelingPrep subscription given that Yahoo Finance will rate limit at some point. It of course makes little sense that you are paying and still get rate limited!

E.g. the following will net you the same result:

from financetoolkit import Toolkit

API_KEY = "FINANCIAL_MODELING_PREP_KEY"

# Use FinancialModelingPrep to obtain Historical Data
companies = Toolkit(
    ["AAPL", "MSFT", "GOOGL", "AMZN"], api_key=API_KEY, start_date="2005-01-01"
)

companies.get_historical_data()

# Use Yahoo Finance to obtain Historical Data even though you set a FinancialModelingPrep API Key
companies = Toolkit(
    ["AAPL", "MSFT", "GOOGL", "AMZN"], api_key=API_KEY, start_date="2005-01-01", historical_source='YahooFinance'
)

companies.get_historical_data()

# Use Yahoo Finance to obtain Historical Data without needing to set an API Key
companies = Toolkit(
    ["AAPL", "MSFT", "GOOGL", "AMZN"], start_date="2005-01-01"
)

companies.get_historical_data()

Which returns:

image