Best Fitting Copula
Calibrate all five supported copula families (see get_copula_parameters) between ticker_a and ticker_b, and compare them by AIC (Akaike Information Criterion) – the lower the AIC, the better the fit relative to its number of parameters, so the top row is the best-fitting family.
When ticker_a/ticker_b are not given, every unique pair among the Toolkit’s tickers is compared instead.
Also known as: copula selection, copula comparison.
No programming experience? With the Finance Toolkit MCP server, AI assistants such as Claude and ChatGPT can calculate the Best Fitting Copula for you. Just ask in plain English.
Calculate the Best Fitting Copula in Python
The Best Fitting Copula is available in the Risk module of the open-source Finance Toolkit. Install it with:
pip install financetoolkit -U
Then call get_best_fitting_copula as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(["AMZN", "TSLA"], api_key="FINANCIAL_MODELING_PREP_KEY")
toolkit.risk.get_best_fitting_copula("AAPL", "MSFT", period="weekly")
Which returns:
| Copula | Lower Tail Dependence | Upper Tail Dependence | Log-Likelihood | AIC |
|---|---|---|---|---|
| Student-T | 0.1915 | 0.1915 | 51.9971 | -99.9942 |
| Frank | 0 | 0 | 49.2452 | -96.4903 |
| Gumbel | 0 | 0.4256 | 48.9139 | -95.8277 |
| Gaussian | 0 | 0 | 42.908 | -83.816 |
| Clayton | 0.389 | 0 | 33.6247 | -65.2495 |
Parameters
get_best_fitting_copula accepts the following parameters:
- ticker_a (str, optional): The first asset. Defaults to None, meaning every unique pair of
tickers in the Toolkit instance is compared (requires
ticker_bto also be None). - ticker_b (str, optional): The second asset. Defaults to None, see
ticker_a. - period (str, optional): The data frequency (daily, weekly, monthly, quarterly, or yearly). Defaults to “daily”, since a dependence estimate needs far more observations than a lower frequency provides – at “yearly” a decade of history is only ten observations.
- column (str, optional): The historical data column to use. Defaults to “Return”.
- show_full_results (bool, optional): Only relevant when neither ticker is given. When False (the default), returns a square ticker-by-ticker grid of just the winning copula family per pair. When True, returns one row per pair instead, with the winning family’s fitted parameter(s), Lower and Upper Tail Dependence, Log-Likelihood, AIC and the number of observations used. Defaults to False.
- rounding (int | None, optional): The number of decimals to round the results to. Defaults to None.
Related Risk Metrics
The Risk module page introduces the module, and the sidebar lists all of its functions.