scenario
Module containing classes for managing financial scenarios.
Classes:
-
Scenario–Represents a single scenario with financial data.
-
ScenarioBuilder–Builder class for constructing a Scenario.
-
ScenarioManager–Manage scenarios with functionalities to add, clear, and retrieve scenarios.
Scenario
Scenario(date: date)
Represents a single scenario with financial data.
Methods:
-
add_term_structure–Add a term structure to the scenario.
add_term_structure
add_term_structure(
term_structure: YieldTermStructure,
) -> None
Add a term structure to the scenario.
ScenarioBuilder
ScenarioBuilder(date: date)
Builder class for constructing a Scenario.
Methods:
-
build–Finalize the construction of the Scenario.
-
with_term_structure–Add a term structure to the Scenario.
with_term_structure
with_term_structure(
term_structure: YieldTermStructure,
) -> ScenarioBuilder
Add a term structure to the Scenario.
ScenarioManager
ScenarioManager()
Manage scenarios with functionalities to add, clear, and retrieve scenarios.
Methods:
-
add_scenario–Add a scenario by date.
-
clear_scenarios–Clear all scenarios.
-
get_available_dates–Extract all dates from the treasury yields DataFrame.
-
get_historical_scenarios–Retrieve historical scenarios in a date range.
-
get_scenario–Retrieve a scenario by date.
-
get_treasury_yields–Retrieve the raw treasury yields data as a DataFrame.
-
has_scenario–Check if a scenario exists for a given date.
-
load_data–Load data using DataLoader and build scenarios.
clear_scenarios
clear_scenarios() -> None
Clear all scenarios.
get_available_dates
get_available_dates() -> list[date]
Extract all dates from the treasury yields DataFrame.
get_historical_scenarios
get_historical_scenarios(
start_date: date, end_date: date
) -> dict[date, Scenario]
Retrieve historical scenarios in a date range.
get_treasury_yields
get_treasury_yields() -> DataFrame
Retrieve the raw treasury yields data as a DataFrame.
has_scenario
has_scenario(date: date) -> bool
Check if a scenario exists for a given date.
load_data
load_data(source_type: str, source_path: str) -> None
Load data using DataLoader and build scenarios.