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.

The formula is as follows:

\[\text{AIC} = 2 \cdot k - 2 \cdot \text{Log-Likelihood}\]

Where the Log-Likelihood is that of each family fitted as in get_copula_parameters and k the number of fitted parameters (2 for the Student-T copula, 1 for the others).

Also known as: copula selection, copula comparison.

Best Fitting Copula in Python or via the MCP

Install the Finance Toolkit with:

pip install financetoolkit -U

Then call get_best_fitting_copula as shown below.

from financetoolkit import Toolkit

toolkit = Toolkit(
    ["V", "MA"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2021-01-01",
    end_date="2025-12-31",
)

copulas = toolkit.risk.get_best_fitting_copula("V", "MA")

copulas[["Lower Tail Dependence", "Upper Tail Dependence", "Log-Likelihood", "AIC"]]

Or, after setting up the Finance Toolkit MCP, ask:

Which copula best describes the dependence between the returns of Visa and Mastercard from 2021 to 2025, and what are each copula's tail dependence, log-likelihood and AIC?

Which returns:

Copula Lower Tail Dependence Upper Tail Dependence Log-Likelihood AIC
Student-T 0.5596 0.5596 946.907 -1889.81
Gaussian 0 0 912.208 -1822.42
Gumbel 0 0.7388 892.134 -1782.27
Frank 0 0 826.803 -1651.61
Clayton 0.7852 0 757.472 -1512.94

Parameters

get_best_fitting_copula accepts the following parameters.

ParameterTypeDescriptionExample
ticker_astrThe first asset. Defaults to None, meaning every unique pair of tickers in the Toolkit instance is compared (requires ticker_b to also be None)."AAPL"
ticker_bstrThe second asset. Defaults to None, see ticker_a."MSFT"
periodstrThe 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."weekly"
columnstrThe historical data column to use. Defaults to “Return”."Return"
show_full_resultsboolOnly 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.True
roundingint | NoneThe number of decimals to round the results to. Defaults to None.2
Share