Analyzing economies and markets, sharpened by AI.
I'm Jeroen Bouma, Quantitative Investment Strategist in asset management. I turn market developments into investment conclusions on strategic asset allocation, ALM, lifecycle investing and Solvency II internal model calculations, combined with deep expertise in AI. I also created the open-source Finance Toolkit and Finance Database, used by thousands of analysts.
Experience and education
Explore
Everything in one place
Experience
Investment strategy at a.s.r., ALM at PGGM and product management at OpenBB.
ResumeOpen Source Projects
The Finance Toolkit, Finance Database and an MCP server that brings them to AI assistants.
ProjectsFinancial Modelling
A practical guide to building financial models in Python that stay maintainable.
GuideInsights
Analysis of markets, companies and economies, talks at universities and conferences, and a curated reading list.
InsightsFeatured project
The Finance Toolkit
An open-source Python library with 1100+ financial methods, from ratios and valuation models to risk, performance and econometrics. Every formula is written out, so you can see exactly how a number is calculated. The MCP server makes all of it available to AI assistants such as Claude and ChatGPT.
from financetoolkit import Discovery
discovery = Discovery(api_key="FINANCIAL_MODELING_PREP_KEY")
# The semiconductor companies on NASDAQ worth more than $100 billion
discovery.get_stock_screener(
industry="Semiconductors",
country="US",
exchange="NASDAQ",
market_cap_higher=100_000_000_000,
is_etf=False,
)
# The P/E ratio of each sector on NASDAQ
discovery.get_sector_pe()
# The daily return of each sector this year, compounded
sectors = discovery.get_sectors_performance(start_date="2026-01-01")
(1 + sectors).cumprod() - 1
# Every company added to or removed from the S&P 500
discovery.get_index_constituent_changes()
# The US companies worth more than $200 billion, with their
# beta and dividend
discovery.get_stock_screener(
market_cap_higher=200_000_000_000,
country="US",
is_etf=False,
primary_only=True,
)
# The US companies worth more than $10 billion, with their sector
discovery.get_stock_screener(
market_cap_higher=10_000_000_000,
country="US",
is_etf=False,
primary_only=True,
limit=5000,
)
Ask your AI assistant
Which semiconductor companies on NASDAQ are worth more than 100 billion dollars, what is the P/E ratio of each sector on NASDAQ, how much has each sector returned since 1 January 2026, how many companies were added to and removed from the S&P 500 in each year since 2000, what are the beta and dividend of the US companies worth more than 200 billion dollars, and how many US companies worth more than 10 billion dollars does each sector have?
Works in Claude, ChatGPT or any other client connected to the Finance Toolkit MCP server.
from financetoolkit import Toolkit
companies = Toolkit(
["NVDA", "AMD", "INTC"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2017-12-31",
end_date="2025-12-31",
)
# Weekly prices and returns, with the S&P 500 as the benchmark
companies.get_historical_data(period="weekly")
# The 14-week Relative Strength Index
companies.technicals.get_relative_strength_index(
period="weekly", window=14)
nvidia = Toolkit(
["NVDA"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2024-10-01",
end_date="2025-12-31",
)
# Nvidia's daily prices with its 20-day Bollinger bands and 14-day RSI
nvidia.get_historical_data(period="daily")
nvidia.technicals.get_bollinger_bands(window=20, num_std_dev=2)
nvidia.technicals.get_relative_strength_index(window=14)
large_companies = Toolkit(
["AAPL", "AMGN", "AMZN", "AXP", "BA", "CAT", "CRM", "CSCO",
"CVX", "DIS", "GS", "HD", "HON", "IBM", "JNJ", "JPM", "KO",
"MCD", "MMM", "MRK", "MSFT", "NKE", "NVDA", "PG", "SHW",
"TRV", "UNH", "V", "VZ", "WMT", "AMD", "INTC"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2017-12-31",
end_date="2025-12-31",
)
# The return over the past 252 trading days of each company
large_companies.technicals.get_rate_of_change(window=252)
nvidia_since_2023 = Toolkit(
["NVDA"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2023-01-01",
end_date="2025-12-31",
)
# The range of Nvidia's volatility over windows of 10 to 120 days
nvidia_since_2023.technicals.get_volatility_cone()
nvidia_since_2024 = Toolkit(
["NVDA"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2024-01-01",
end_date="2025-12-31",
)
# Nvidia's Ichimoku cloud (9, 26 and 52 days)
nvidia_since_2024.technicals.get_ichimoku_cloud()
Ask your AI assistant
What were the weekly cumulative returns and the 14-week RSI of Nvidia, AMD, Intel and the S&P 500 from 2018 to 2025, Nvidia's 20-day Bollinger bands and 14-day RSI in 2025, the 252-day rate of change at the end of 2025 of Apple, Amgen, Amazon, American Express, Boeing, Caterpillar, Salesforce, Cisco, Chevron, Disney, Goldman Sachs, Home Depot, Honeywell, IBM, Johnson and Johnson, JPMorgan Chase, Coca-Cola, McDonald's, 3M, Merck, Microsoft, Nike, Nvidia, Procter and Gamble, Sherwin-Williams, Travelers, UnitedHealth, Visa, Verizon, Walmart, AMD and Intel, the volatility cone of Nvidia from 2023 to 2025, and Nvidia's Ichimoku cloud in 2025?
Works in Claude, ChatGPT or any other client connected to the Finance Toolkit MCP server.
from financetoolkit import Toolkit
companies = Toolkit(
["NVDA", "AMD"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2017-12-31",
end_date="2025-12-31",
)
# Every profitability ratio of Nvidia and AMD
companies.ratios.collect_profitability_ratios()
large_companies = Toolkit(
["AAPL", "AMGN", "AMZN", "AXP", "BA", "CAT", "CRM", "CSCO",
"CVX", "DIS", "GS", "HD", "HON", "IBM", "JNJ", "JPM", "KO",
"MCD", "MMM", "MRK", "MSFT", "NKE", "NVDA", "PG", "SHW",
"TRV", "UNH", "V", "VZ", "WMT", "AMD", "INTC"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2017-12-31",
end_date="2025-12-31",
)
# The current assets over the current liabilities of each company
large_companies.ratios.get_current_ratio()
# The return on invested capital of each company
large_companies.ratios.get_return_on_invested_capital()
# The enterprise value over EBITDA
large_companies.ratios.get_ev_to_ebitda_ratio()
# The free cash flow over the market cap
large_companies.ratios.get_free_cash_flow_yield()
# The operating margin in each fiscal year
large_companies.ratios.get_operating_margin()
# The cash flow statement, with the free cash flow of each year
large_companies.get_cash_flow_statement()
Ask your AI assistant
How did the gross, operating and net profit margins and the return on invested capital of Nvidia and AMD change each fiscal year from 2018 to 2024, and what were the current ratio, the return on invested capital, the EV/EBITDA, the free cash flow yield, the operating margin and the free cash flow of Apple, Amgen, Amazon, American Express, Boeing, Caterpillar, Salesforce, Cisco, Chevron, Disney, Goldman Sachs, Home Depot, Honeywell, IBM, Johnson and Johnson, JPMorgan Chase, Coca-Cola, McDonald's, 3M, Merck, Microsoft, Nike, Nvidia, Procter and Gamble, Sherwin-Williams, Travelers, UnitedHealth, Visa, Verizon, Walmart, AMD and Intel in each fiscal year?
Works in Claude, ChatGPT or any other client connected to the Finance Toolkit MCP server.
from financetoolkit import Toolkit
companies = Toolkit(
["NVDA", "AMD", "INTC"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2017-12-31",
end_date="2025-12-31",
)
# The weighted average cost of capital
companies.models.get_weighted_average_cost_of_capital()
chipmakers = Toolkit(
["NVDA", "AMD", "INTC", "AVGO", "QCOM", "TXN", "MU", "ADI"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2017-12-31",
end_date="2025-12-31",
)
# The Piotroski F-score, nine pass or fail tests of financial strength
chipmakers.models.get_piotroski_score()
large_companies = Toolkit(
["AAPL", "AMGN", "AMZN", "AXP", "BA", "CAT", "CRM", "CSCO",
"CVX", "DIS", "GS", "HD", "HON", "IBM", "JNJ", "JPM", "KO",
"MCD", "MMM", "MRK", "MSFT", "NKE", "NVDA", "PG", "SHW",
"TRV", "UNH", "V", "VZ", "WMT", "AMD", "INTC"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2017-12-31",
end_date="2025-12-31",
)
# The Altman Z-score, a measure of the risk of bankruptcy
large_companies.models.get_altman_z_score()
# The cash flow growth that the share price implies (reverse DCF)
large_companies.models.get_reverse_discounted_cash_flow()
# The return on invested capital minus the WACC
large_companies.models.get_economic_value_added()
# The Beneish M-score, a test for earnings manipulation
large_companies.models.get_beneish_m_score()
Ask your AI assistant
Give the Piotroski F-score of Nvidia, AMD, Intel, Broadcom, Qualcomm, Texas Instruments, Micron and Analog Devices and the weighted average cost of capital of Nvidia, AMD and Intel for each fiscal year from 2018 to 2024, and the Altman Z-score in each of those years, the growth implied by the share price in a reverse DCF, the economic value added spread and the Beneish M-score of Apple, Amgen, Amazon, American Express, Boeing, Caterpillar, Salesforce, Cisco, Chevron, Disney, Goldman Sachs, Home Depot, Honeywell, IBM, Johnson and Johnson, JPMorgan Chase, Coca-Cola, McDonald's, 3M, Merck, Microsoft, Nike, Nvidia, Procter and Gamble, Sherwin-Williams, Travelers, UnitedHealth, Visa, Verizon, Walmart, AMD and Intel.
Works in Claude, ChatGPT or any other client connected to the Finance Toolkit MCP server.
from financetoolkit import Toolkit
large_companies = Toolkit(
["AAPL", "AMGN", "AMZN", "AXP", "BA", "CAT", "CRM", "CSCO",
"CVX", "DIS", "GS", "HD", "HON", "IBM", "JNJ", "JPM", "KO",
"MCD", "MMM", "MRK", "MSFT", "NKE", "NVDA", "PG", "SHW",
"TRV", "UNH", "V", "VZ", "WMT", "AMD", "INTC"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2017-12-31",
end_date="2025-12-31",
)
# The deepest fall within each year
large_companies.risk.get_maximum_drawdown(
period="yearly", within_period=True)
# The daily volatility, exponentially weighted
large_companies.risk.get_ewma_volatility(lambda_=0.94)
# The skewness and kurtosis of the daily returns of each company
large_companies.risk.get_skewness()
large_companies.risk.get_kurtosis()
# The volatility of each company in each year
large_companies.risk.get_volatility()
# The average loss on the worst 5% of days (CVaR)
large_companies.risk.get_conditional_value_at_risk()
# The days from the peak to the bottom of the deepest fall
large_companies.risk.get_maximum_drawdown_duration()
Ask your AI assistant
For Apple, Amgen, Amazon, American Express, Boeing, Caterpillar, Salesforce, Cisco, Chevron, Disney, Goldman Sachs, Home Depot, Honeywell, IBM, Johnson and Johnson, JPMorgan Chase, Coca-Cola, McDonald's, 3M, Merck, Microsoft, Nike, Nvidia, Procter and Gamble, Sherwin-Williams, Travelers, UnitedHealth, Visa, Verizon, Walmart, AMD and Intel and the S&P 500, from 2018 to 2025: what was the deepest drawdown within each year, the EWMA volatility at the end of each week, the skewness and kurtosis of the daily returns, the volatility and the deepest drawdown in 2025, the 95 percent CVaR and the days from peak to bottom of the deepest drawdown?
Works in Claude, ChatGPT or any other client connected to the Finance Toolkit MCP server.
from financetoolkit import Toolkit
companies = Toolkit(
["NVDA", "AMD", "INTC"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2017-12-31",
end_date="2025-12-31",
)
# The annualized Sharpe ratio of each year
companies.performance.get_sharpe_ratio(
period="yearly", annualize=True)
# The return of each month
companies.performance.get_calendar_returns()
nvidia = Toolkit(
["NVDA"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2004-12-31",
end_date="2025-12-31",
)
# How much of the S&P 500's gains and losses Nvidia captured each year
nvidia.performance.get_capture_ratios()
large_companies = Toolkit(
["AAPL", "AMGN", "AMZN", "AXP", "BA", "CAT", "CRM", "CSCO",
"CVX", "DIS", "GS", "HD", "HON", "IBM", "JNJ", "JPM", "KO",
"MCD", "MMM", "MRK", "MSFT", "NKE", "NVDA", "PG", "SHW",
"TRV", "UNH", "V", "VZ", "WMT", "AMD", "INTC"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2017-12-31",
end_date="2025-12-31",
)
# The return and the volatility of each company in each year
large_companies.get_historical_data(period="yearly")
large_companies.risk.get_volatility()
# The exposure to the five Fama-French factors in each year
large_companies.performance.get_fama_and_french_model()
# The Sortino ratio in each year, annualized
large_companies.performance.get_sortino_ratio(annualize=True)
Ask your AI assistant
What were the annualized Sharpe ratio of Nvidia, AMD and Intel in each year from 2018 to 2025, Nvidia's return in each month, its upside and downside capture ratios against the S&P 500 in each year since 2005, and the yearly return, volatility, five-factor Fama-French slopes and annualized Sortino ratio of Apple, Amgen, Amazon, American Express, Boeing, Caterpillar, Salesforce, Cisco, Chevron, Disney, Goldman Sachs, Home Depot, Honeywell, IBM, Johnson and Johnson, JPMorgan Chase, Coca-Cola, McDonald's, 3M, Merck, Microsoft, Nike, Nvidia, Procter and Gamble, Sherwin-Williams, Travelers, UnitedHealth, Visa, Verizon, Walmart, AMD and Intel in each year?
Works in Claude, ChatGPT or any other client connected to the Finance Toolkit MCP server.
from financetoolkit import Toolkit
companies = Toolkit(
["NVDA", "AMD", "INTC", "AVGO", "MU"],
api_key="FINANCIAL_MODELING_PREP_KEY",
)
# The delta and gamma of calls up to 30 days to expiration,
# for strike prices up to 25% from the share price
companies.options.get_delta(
strike_price_range=0.25, strike_step_size=5,
expiration_time_range=30)
companies.options.get_gamma(
strike_price_range=0.25, strike_step_size=5,
expiration_time_range=30)
# The implied volatility of the calls that expire on 15 January 2027
companies.options.get_implied_volatility(expiration_date="2027-01-15")
# An SSVI volatility surface fitted to the calls of six expirations
companies.options.get_volatility_surface(
expiration_dates=["2026-12-18", "2027-01-15", "2027-03-19",
"2027-05-21", "2027-12-17", "2028-06-16"],
method="ssvi")
# The volatility of the daily returns over the past year, annualized
returns = companies.get_historical_data(period="daily")["Return"]
returns.tail(252).std() * 252 ** 0.5
option_companies = Toolkit(
["NVDA", "AAPL", "MSFT", "AMZN", "META", "GOOGL", "TSLA", "AVGO",
"AMD", "NFLX", "JPM", "XOM", "LLY", "WMT", "COST"],
api_key="FINANCIAL_MODELING_PREP_KEY",
)
# The open interest in puts over calls by expiration
option_companies.options.get_put_call_ratio()
# The implied volatility of at-the-money options by expiration
option_companies.options.get_implied_volatility_term_structure()
# The 30-day implied volatility minus the realized volatility
option_companies.options.get_volatility_risk_premium()
Ask your AI assistant
What are the delta and gamma of Nvidia call options that expire in 30 days, for strike prices up to 25 percent from the share price, how does the implied volatility of the at-the-money calls of Nvidia, AMD, Intel, Broadcom and Micron that expire on 15 January 2027 compare with the volatility of their daily returns over the past year, what does a volatility surface fitted to the Nvidia calls of six expirations from December 2026 to June 2028 look like, and what are the put-call ratio, the at-the-money implied volatility by expiration and the volatility risk premium of Nvidia, Apple, Microsoft, Amazon, Meta, Alphabet, Tesla, Broadcom, AMD, Netflix, JPMorgan Chase, Exxon Mobil, Eli Lilly, Walmart and Costco?
Works in Claude, ChatGPT or any other client connected to the Finance Toolkit MCP server.
from financetoolkit import Economics, FixedIncome
fixedincome = FixedIncome(
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2018-01-01",
end_date="2025-12-31",
)
# The daily U.S. Treasury par yield curve
treasury_rates = fixedincome.get_treasury_rates()
# The curve on the last trading day of each year
treasury_rates.groupby(treasury_rates.index.year).last()
# The gap between the 10-year and the 2-year yield
treasury_rates["10 Year"] - treasury_rates["2 Year"]
economics = Economics(
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2018-01-01",
end_date="2025-12-31",
)
# The policy rate of each central bank at the end of each month
economics.get_central_bank_policy_rate(period="monthly")
# The 10-year government bond yield of each country, monthly
economics.get_long_term_interest_rate(period="monthly")
fixedincome_to_today = FixedIncome(
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2018-01-01",
)
# The spread of US corporate bonds over Treasuries by rating
fixedincome_to_today.get_ice_bofa_option_adjusted_spread(
maturity=False)
# The term premium of Treasuries by maturity
fixedincome_to_today.get_term_premium()
Ask your AI assistant
What did the U.S. Treasury yield curve look like on the last trading day of each year from 2018 to 2025, what were the policy rates of the United States, the Euro Area, the United Kingdom and Japan each month, the gap between the 10-year and 2-year Treasury yield, the 10-year government bond yield of each country last month, the option-adjusted spread of US corporate bonds by credit rating and the 10-year Treasury term premium since 2018?
Works in Claude, ChatGPT or any other client connected to the Finance Toolkit MCP server.
import pandas as pd
from financetoolkit import Econometrics, Toolkit
tickers = ["NVDA", "AMD", "INTC", "AVGO", "MU"]
companies = Toolkit(
tickers,
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2017-12-31",
end_date="2025-12-31",
)
# The US 10-year real yield and inflation expectations each month
real_yield = companies.economics.get_real_yield_curve(
"United States", period="monthly")
inflation_expectations = (
companies.economics.get_breakeven_inflation_expectations(
"United States", period="monthly"))
# The monthly returns next to the monthly change in both
data = companies.get_historical_data(period="monthly")["Return"]
data = data[tickers]
data["Real Yield"] = real_yield[("United States", "10Y")].diff()
data["Inflation Expectations"] = (
inflation_expectations[("United States", "10Y")].diff())
econometrics = Econometrics(data=data, changes=None)
# Regress each company's return on both changes
pd.concat({
ticker: econometrics.get_ols(
dependent_ticker=ticker,
independent_tickers=["Real Yield", "Inflation Expectations"])
for ticker in tickers
})
# The beta to the S&P 500 of each month, with the Kalman filter
companies.econometrics.get_time_varying_beta(period="monthly")
sector_funds = Toolkit(
["XLK", "XLF", "XLE", "XLV", "XLY", "XLP",
"XLI", "XLU", "XLB", "XLRE", "XLC"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2019-01-01",
end_date="2025-12-31",
benchmark_ticker=None,
)
# A calm and a volatile regime of each sector fund's daily returns,
# and the probability of each day being in either
sector_funds.econometrics.get_markov_regime_switching()
sector_funds.econometrics.get_markov_regime_switching(probabilities=True)
# How much of each sector's variance comes from the others
sector_funds.econometrics.get_connectedness()
chipmakers = Toolkit(
["NVDA", "AMD", "INTC", "AVGO", "MU"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2019-01-01",
end_date="2025-12-31",
)
# The correlation of each pair over time (DCC-GARCH), weekly
chipmakers.econometrics.get_dcc_garch(period="weekly")
large_companies = Toolkit(
["AAPL", "AMGN", "AMZN", "AXP", "BA", "CAT", "CRM", "CSCO",
"CVX", "DIS", "GS", "HD", "HON", "IBM", "JNJ", "JPM", "KO",
"MCD", "MMM", "MRK", "MSFT", "NKE", "NVDA", "PG", "SHW",
"TRV", "UNH", "V", "VZ", "WMT", "AMD", "INTC"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2017-12-31",
end_date="2025-12-31",
)
# The beta to the S&P 500 in each year
large_companies.performance.get_beta()
# The annualized volatility of the daily returns the S&P 500 does not
# explain (a CAPM regression within each year)
large_companies.risk.get_idiosyncratic_volatility(
period="yearly", model="capm", annualize=True)
Ask your AI assistant
How did the beta of Nvidia, AMD, Intel, Broadcom and Micron to the S&P 500 change each month from 2020 to 2025, estimated with the Kalman filter, in which days from 2019 to 2025 were the sector funds XLK, XLF, XLE, XLV, XLY, XLP, XLI, XLU, XLB, XLRE and XLC in a calm or a volatile regime, how connected were they, how did the DCC-GARCH correlation between those five chipmakers change each week, and what were the beta and the idiosyncratic volatility in 2025 of Apple, Amgen, Amazon, American Express, Boeing, Caterpillar, Salesforce, Cisco, Chevron, Disney, Goldman Sachs, Home Depot, Honeywell, IBM, Johnson and Johnson, JPMorgan Chase, Coca-Cola, McDonald's, 3M, Merck, Microsoft, Nike, Nvidia, Procter and Gamble, Sherwin-Williams, Travelers, UnitedHealth, Visa, Verizon, Walmart, AMD and Intel?
Works in Claude, ChatGPT or any other client connected to the Finance Toolkit MCP server.
from financetoolkit import Toolkit
funds = Toolkit(
["SMH", "SOXX", "CHPS", "DRAM"],
api_key="FINANCIAL_MODELING_PREP_KEY",
)
# The share of each fund invested in each country
funds.etf.get_country_weightings()
semiconductor_funds = Toolkit(
["SOXX", "XSD", "PSI", "SMH", "SMHC", "KCHP"],
api_key="FINANCIAL_MODELING_PREP_KEY",
)
# How much every pair of funds holds of the same companies
semiconductor_funds.etf.get_overlap()
smh = Toolkit(["SMH"], api_key="FINANCIAL_MODELING_PREP_KEY")
# The holdings of SMH, the largest first
smh.etf.get_holdings()
broad_funds = Toolkit(
["SPY", "RSP", "QQQ", "DIA", "VTI", "VUG", "VTV", "MGK"],
api_key="FINANCIAL_MODELING_PREP_KEY",
benchmark_ticker=None,
)
# The share of each fund in each sector
broad_funds.etf.get_sector_weightings()
funds = Toolkit(
["SPY", "QQQ", "DIA", "XLK", "XLF",
"XLE", "XLV", "XLP", "XLU", "SMH"],
api_key="FINANCIAL_MODELING_PREP_KEY",
benchmark_ticker=None,
)
# The weight of the largest holdings of each fund
funds.etf.get_concentration()
# The valuation ratios of each fund, from its holdings
funds.etf.get_look_through_valuation()
Ask your AI assistant
In which countries do the semiconductor funds SMH, SOXX, CHPS and DRAM invest, how much do SOXX, XSD, PSI, SMH, SMHC and KCHP hold of the same companies, what are the ten largest holdings of SMH, how are SPY, RSP, QQQ, DIA, VTI, VUG, VTV and MGK spread over sectors, and what are the weight of the ten largest holdings and the price-to-earnings ratio from the holdings of SPY, QQQ, DIA, XLK, XLF, XLE, XLV, XLP, XLU and SMH?
Works in Claude, ChatGPT or any other client connected to the Finance Toolkit MCP server.
from financetoolkit import Toolkit
assets = Toolkit(
["AAPL", "MSFT", "NVDA", "AMZN", "JPM", "V", "JNJ", "UNH",
"XOM", "PG", "KO", "HD", "CAT", "MCD", "WMT"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2021-01-01",
end_date="2025-12-31",
)
# The efficient frontier, with at most 20% in one company
assets.portfolio.get_efficient_frontier(
points=25, maximum_weight=0.2)
# The portfolio with the highest Sharpe ratio
assets.portfolio.get_maximum_sharpe_weights(
maximum_weight=0.2)
# The portfolio with the lowest volatility
assets.portfolio.get_minimum_variance_weights(
maximum_weight=0.2)
# The portfolio in which every asset carries the same share of the risk
assets.portfolio.get_risk_parity_weights()
# Risk parity within clusters of assets that move together
assets.portfolio.get_hierarchical_risk_parity_weights()
# The portfolio least correlated with its own assets
assets.portfolio.get_maximum_diversification_weights(
maximum_weight=0.2)
# The portfolio with the most gains for each unit of losses
assets.portfolio.get_maximum_omega_weights(maximum_weight=0.2)
# The maximum Sharpe ratio portfolio averaged over resampled returns
assets.portfolio.get_resampled_efficient_weights(
maximum_weight=0.2)
# The portfolio with the highest expected growth (the Kelly criterion)
assets.portfolio.get_growth_optimal_weights(maximum_weight=0.2)
# Each method rebalanced every month on the year before,
# against equal weights and the S&P 500: the daily returns
assets.portfolio.get_optimization_backtest(
maximum_weight=0.2, output="returns")
# The risk parity weights as a dictionary of asset and weight
risk_parity = assets.portfolio.get_risk_parity_weights()
weights = risk_parity["Weight"].drop("Portfolio").to_dict()
# The share of the portfolio's volatility from each asset
assets.portfolio.get_risk_contributions(weights=weights)
# The return of the portfolio in past market falls
assets.portfolio.get_stress_test(weights=weights)
# The effective number of independent bets
assets.portfolio.get_diversification_metrics(weights=weights)
Ask your AI assistant
Build the efficient frontier of Apple, Microsoft, Nvidia, Amazon, JPMorgan Chase, Visa, Johnson and Johnson, UnitedHealth, Exxon Mobil, Procter and Gamble, Coca-Cola, Home Depot, Caterpillar, McDonald's and Walmart from 2021 to 2025 with at most 20 percent in one company, compare the weights of the maximum Sharpe ratio, minimum variance, risk parity, hierarchical risk parity, maximum diversification, maximum Omega ratio, resampled efficient and growth optimal portfolios, backtest them with monthly rebalancing, and give each portfolio's risk contribution by asset, its return in past market crashes and its effective number of bets.
Works in Claude, ChatGPT or any other client connected to the Finance Toolkit MCP server.
from financetoolkit import Portfolio, Toolkit
assets = Toolkit(
["SMH", "XLV", "XLE", "TLT", "GLD"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2021-01-01",
end_date="2025-12-31",
)
# The weights in which every asset carries the same share of the risk
risk_parity = assets.portfolio.get_risk_parity_weights()
portfolio = Portfolio(
weights=risk_parity,
start_date="2021-01-01",
rebalancing="yearly",
api_key="FINANCIAL_MODELING_PREP_KEY",
)
# Each position's return against the benchmark, up to today
portfolio.get_portfolio_overview()
# What each position added to the return in each year
portfolio.get_return_contributions(period="yearly")
# The weight of each position on each day, and more
portfolio.get_positions_overview()
# The risk parity weights as a dictionary of asset and weight
weights = risk_parity["Weight"].drop("Portfolio").to_dict()
# The return against the S&P 500 by sector (Brinson)
assets.portfolio.get_brinson_attribution(weights=weights)
# The return from the five Fama-French factors and the rest
assets.portfolio.get_factor_attribution(weights=weights)
# The value of each position at the end of each year
portfolio.get_portfolio_performance()
Ask your AI assistant
Invest 10.1 percent in SMH, 23.6 percent in XLV, 14.8 percent in XLE, 27.5 percent in TLT and 24.0 percent in GLD at the start of 2021, rebalance every year, and compare the return of each position with the S&P 500 up to today, with what each position added in each year, its weight each week, a Brinson attribution by sector, the return from the five Fama-French factors and the value of each position at the end of each year.
Works in Claude, ChatGPT or any other client connected to the Finance Toolkit MCP server.
Writing
Latest insights
“Jeroen was at the intersection of finance, programming and open source, which is a combination that is very hard to find.”
Let's talk
A question about the projects, an idea for a collaboration or a talk? I'm always happy to hear from you.