Core (wraquant.core)¶
Foundation infrastructure: configuration management, type definitions, custom exceptions, structured logging, decorators, and result dataclasses.
Quick Example¶
import wraquant as wq
# Configuration
cfg = wq.get_config()
print(f"Backend: {cfg.backend}")
# Type aliases for consistent function signatures
from wraquant.core.types import PriceSeries, ReturnSeries, OHLCVFrame
# Exceptions
from wraquant.core.exceptions import WQError, ValidationError
# Result dataclasses
from wraquant.core.results import GARCHResult, BacktestResult
API Reference¶
Core utilities: configuration, types, exceptions, logging, and decorators.
This module provides the foundational infrastructure that every other wraquant module depends on. It defines the configuration system, the type coercion layer, canonical exception hierarchy, reusable decorators, and structured result dataclasses.
Key components:
WQConfig / get_config – Global configuration singleton controlling the compute backend (pandas, polars, torch), default frequency, and logging verbosity.
coerce_series / coerce_array / coerce_returns / coerce_dataframe – Coerce-first type system that normalizes heterogeneous inputs (lists, numpy arrays, polars Series) into pandas types before computation.
WQError and subclasses (
DataFetchError,ValidationError,ConfigError,OptimizationError) – Structured exception hierarchy for clear error handling across all modules.@requires_extra – Decorator that gates functions behind optional dependency groups, raising
MissingDependencyErrorwith install instructions when the dependency is absent.@cache_result / @validate_input – Utility decorators for memoization and input validation.
GARCHResult / BacktestResult / ForecastResult – Typed result dataclasses returned by modeling functions for consistent downstream consumption.
Frequency / AssetClass / Currency / ReturnType and other enums – Canonical enumerations used as parameters throughout the library.
Example
>>> from wraquant.core import get_config, coerce_series
>>> cfg = get_config()
>>> cfg.backend
<Backend.PANDAS: 'pandas'>
>>> import numpy as np
>>> s = coerce_series(np.array([1.0, 2.0, 3.0]), name="prices")
Use wraquant.core when you need to configure global settings, coerce
raw inputs into standard types, or handle wraquant-specific exceptions.
Most users interact with this module indirectly through higher-level
modules like wraquant.stats or wraquant.risk.
- coerce_array(data, name='data')[source]¶
Coerce any array-like input to a 1D float64 numpy array.
Accepts: pd.Series, pd.DataFrame (first column), np.ndarray, torch.Tensor, list, tuple, scalar.
- Parameters:
- Return type:
- Returns:
1D float64 numpy array.
- Raises:
TypeError – If data cannot be converted.
Example
>>> import numpy as np >>> from wraquant.core._coerce import coerce_array >>> coerce_array([1.0, 2.0, 3.0]) array([1., 2., 3.]) >>> import pandas as pd >>> coerce_array(pd.Series([10, 20, 30])) array([10., 20., 30.])
- coerce_series(data, name='data')[source]¶
Coerce any array-like input to a pd.Series.
Preserves index if input is already a pd.Series. If the input is a
PriceSeriesorReturnSeries(fromwraquant.frame), returns it directly to preserve financial metadata (frequency, currency, return_type).- Parameters:
- Return type:
- Returns:
pd.Series with float64 dtype.
Example
>>> import numpy as np >>> from wraquant.core._coerce import coerce_series >>> s = coerce_series([1.0, 2.0, 3.0], name="prices") >>> s.name 'prices' >>> len(s) 3
- coerce_returns(data, is_prices=None, name='returns')[source]¶
Coerce input to return series.
Auto-detects whether input is prices or returns based on: - If all values > 0 and mean > 0.5: likely prices -> compute pct_change - Otherwise: likely returns -> pass through
- Parameters:
- Return type:
- Returns:
1D float64 array of returns.
Example
>>> import numpy as np >>> from wraquant.core._coerce import coerce_returns >>> prices = [100, 102, 101, 103] >>> returns = coerce_returns(prices, is_prices=True) >>> len(returns) 3
- coerce_dataframe(data, name='data')[source]¶
Coerce input to pd.DataFrame.
- Parameters:
- Return type:
- Returns:
pd.DataFrame with float64 dtypes.
- Raises:
TypeError – If data cannot be converted to a DataFrame.
Example
>>> import numpy as np >>> from wraquant.core._coerce import coerce_dataframe >>> df = coerce_dataframe({"a": [1, 2], "b": [3, 4]}) >>> df.shape (2, 2)
- class WQConfig[source]¶
Bases:
BaseSettingsGlobal wraquant configuration.
Settings can be overridden via environment variables prefixed with
WQ_.Example
>>> import wraquant as wq >>> cfg = wq.get_config() >>> cfg.backend <Backend.PANDAS: 'pandas'> >>> cfg.backend = Backend.POLARS
- Parameters:
_nested_model_default_partial_update (
bool|None, default:None)_env_prefix_target (
Optional[Literal['variable','alias','all']], default:None)_env_file (
Path|str|Sequence[Path|str] |None, default:PosixPath('.'))_cli_parse_args (
bool|list[str] |tuple[str,...] |None, default:None)_cli_settings_source (
Optional[CliSettingsSource[Any]], default:None)_cli_implicit_flags (
Union[bool,Literal['dual','toggle'],None], default:None)_cli_kebab_case (
Union[bool,Literal['all','no_enums'],None], default:None)_cli_shortcuts (
Mapping[str,str|list[str]] |None, default:None)_secrets_dir (
Path|str|Sequence[Path|str] |None, default:None)_build_sources (
tuple[tuple[PydanticBaseSettingsSource,...],dict[str,Any]] |None, default:None)values (
Any)
- model_config: ClassVar[dict] = {'arbitrary_types_allowed': True, 'case_sensitive': False, 'cli_avoid_json': False, 'cli_enforce_required': False, 'cli_exit_on_error': True, 'cli_flag_prefix_char': '-', 'cli_hide_none_type': False, 'cli_ignore_unknown_args': False, 'cli_implicit_flags': False, 'cli_kebab_case': False, 'cli_parse_args': None, 'cli_parse_none_str': None, 'cli_prefix': '', 'cli_prog_name': None, 'cli_shortcuts': None, 'cli_use_class_docs_for_groups': False, 'enable_decoding': True, 'env_file': '.env', 'env_file_encoding': 'utf-8', 'env_ignore_empty': False, 'env_nested_delimiter': None, 'env_nested_max_split': None, 'env_parse_enums': None, 'env_parse_none_str': None, 'env_prefix': 'WQ_', 'env_prefix_target': 'variable', 'extra': 'ignore', 'json_file': None, 'json_file_encoding': None, 'nested_model_default_partial_update': False, 'protected_namespaces': ('model_validate', 'model_dump', 'settings_customise_sources'), 'secrets_dir': None, 'toml_file': None, 'validate_default': True, 'yaml_config_section': None, 'yaml_file': None, 'yaml_file_encoding': None}¶
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- backend: Backend¶
- cache_dir: Path¶
- get_config()[source]¶
Get the global wraquant configuration singleton.
- Return type:
- Returns:
The global WQConfig instance.
Example
>>> from wraquant.core import get_config >>> cfg = get_config() >>> cfg.backend <Backend.PANDAS: 'pandas'>
- exception MissingDependencyError[source]¶
Bases:
WQError,ImportErrorRaised when an optional dependency is not installed.
- Parameters:
- exception ValidationError[source]¶
Bases:
WQError,ValueErrorRaised when input data fails validation.
- exception OptimizationError[source]¶
Bases:
WQErrorRaised when an optimization problem fails to solve.
- class AssetClass[source]¶
Bases:
StrEnumFinancial asset classes.
- EQUITY = 'equity'¶
- FIXED_INCOME = 'fixed_income'¶
- COMMODITY = 'commodity'¶
- FX = 'fx'¶
- CRYPTO = 'crypto'¶
- DERIVATIVE = 'derivative'¶
- INDEX = 'index'¶
- ETF = 'etf'¶
- FUND = 'fund'¶
- REAL_ESTATE = 'real_estate'¶
- ALTERNATIVE = 'alternative'¶
- __new__(value)¶
- class Currency[source]¶
Bases:
StrEnumMajor world currencies (ISO 4217).
- USD = 'USD'¶
- EUR = 'EUR'¶
- GBP = 'GBP'¶
- JPY = 'JPY'¶
- CHF = 'CHF'¶
- AUD = 'AUD'¶
- CAD = 'CAD'¶
- NZD = 'NZD'¶
- SEK = 'SEK'¶
- NOK = 'NOK'¶
- DKK = 'DKK'¶
- SGD = 'SGD'¶
- HKD = 'HKD'¶
- CNY = 'CNY'¶
- CNH = 'CNH'¶
- INR = 'INR'¶
- KRW = 'KRW'¶
- BRL = 'BRL'¶
- MXN = 'MXN'¶
- ZAR = 'ZAR'¶
- TRY = 'TRY'¶
- PLN = 'PLN'¶
- CZK = 'CZK'¶
- HUF = 'HUF'¶
- THB = 'THB'¶
- TWD = 'TWD'¶
- RUB = 'RUB'¶
- __new__(value)¶
- class Frequency[source]¶
Bases:
StrEnumTime series frequency.
- TICK = 'tick'¶
- SECOND = '1s'¶
- MINUTE = '1min'¶
- FIVE_MIN = '5min'¶
- FIFTEEN_MIN = '15min'¶
- THIRTY_MIN = '30min'¶
- HOURLY = '1h'¶
- FOUR_HOUR = '4h'¶
- DAILY = '1d'¶
- WEEKLY = '1w'¶
- MONTHLY = '1mo'¶
- QUARTERLY = '1q'¶
- YEARLY = '1y'¶
- __new__(value)¶
- class OptionType[source]¶
Bases:
StrEnumOption contract type.
- CALL = 'call'¶
- PUT = 'put'¶
- __new__(value)¶
- class OrderSide[source]¶
Bases:
StrEnumTrade order direction.
- BUY = 'buy'¶
- SELL = 'sell'¶
- __new__(value)¶
- class ReturnType[source]¶
Bases:
StrEnumType of return calculation.
- SIMPLE = 'simple'¶
- LOG = 'log'¶
- EXCESS = 'excess'¶
- __new__(value)¶
- requires_extra(group)[source]¶
Decorator that raises MissingDependencyError if an optional group is missing.
- Parameters:
group (
str) – The PDM optional dependency group name (e.g., ‘market-data’).- Return type:
Callable[[TypeVar(F, bound=Callable[...,Any])],TypeVar(F, bound=Callable[...,Any])]- Returns:
Decorated function that checks for the dependency before execution.
Example
>>> @requires_extra('market-data') ... def fetch_yahoo(symbol: str) -> pd.DataFrame: ... import yfinance ... return yfinance.download(symbol)
- validate_input(func)[source]¶
Decorator that validates function inputs using type hints.
Currently a pass-through that documents the intent for pydantic validation integration in the future.
- class GARCHResult[source]¶
Bases:
objectResult from GARCH-family model fitting.
- params¶
Fitted parameters dict (omega, alpha, beta, …).
- conditional_volatility¶
Time series of conditional std dev.
- standardized_residuals¶
Residuals / conditional vol.
- aic¶
Akaike Information Criterion.
- bic¶
Bayesian Information Criterion.
- log_likelihood¶
Maximized log-likelihood.
- persistence¶
Sum of alpha + beta parameters.
- half_life¶
Periods for shock to decay 50%.
- unconditional_variance¶
Long-run variance.
- model¶
Underlying fitted model object.
- model_name¶
Name of the GARCH model variant.
- Parameters:
- to_var(alpha=0.05)[source]¶
Compute GARCH-based Value at Risk.
Uses the fitted conditional volatility to estimate VaR via
wraquant.risk.var.garch_var.
- plot()[source]¶
Plot conditional volatility using viz module.
- Return type:
- Returns:
Plotly figure object.
- summary()[source]¶
Human-readable summary of GARCH fit.
- Return type:
- Returns:
Multi-line string with key diagnostics.
- __init__(params, conditional_volatility, standardized_residuals, aic, bic, log_likelihood, persistence, half_life, unconditional_variance, model=None, ljung_box=None, model_name='')¶
- class BacktestResult[source]¶
Bases:
objectResult from a backtest run.
- returns¶
Portfolio return series.
- equity_curve¶
Cumulative equity curve (aliased as portfolio_value).
- metrics¶
Dict of performance metrics (Sharpe, max_dd, etc.).
- trades¶
Trade count (int) or list of trade records.
- signals¶
Signal series used.
- positions¶
Position weights over time (if available).
- Parameters:
- to_tearsheet(**kwargs)[source]¶
Generate a comprehensive tearsheet.
Delegates to
wraquant.backtest.tearsheet.comprehensive_tearsheet.
- class ForecastResult[source]¶
Bases:
objectResult from time series forecasting.
- forecast¶
Point forecast values.
- confidence_lower¶
Lower confidence bound.
- confidence_upper¶
Upper confidence bound.
- method¶
Forecasting method used.
- fitted_values¶
In-sample fitted values.
- residuals¶
In-sample residuals.
- metrics¶
Fit metrics (AIC, BIC, RMSE).
- plot()[source]¶
Plot forecast with confidence bounds using viz module.
- Return type:
- Returns:
Plotly figure object.
- summary()[source]¶
Human-readable summary of forecast.
- Return type:
- Returns:
Multi-line string with method and fit metrics.
Configuration¶
Global configuration for wraquant.
Uses pydantic-settings for environment variable support and validation.
Configuration is a singleton accessible via get_config().
- class WQConfig[source]¶
Bases:
BaseSettingsGlobal wraquant configuration.
Settings can be overridden via environment variables prefixed with
WQ_.Example
>>> import wraquant as wq >>> cfg = wq.get_config() >>> cfg.backend <Backend.PANDAS: 'pandas'> >>> cfg.backend = Backend.POLARS
- Parameters:
_nested_model_default_partial_update (
bool|None, default:None)_env_prefix_target (
Optional[Literal['variable','alias','all']], default:None)_env_file (
Path|str|Sequence[Path|str] |None, default:PosixPath('.'))_cli_parse_args (
bool|list[str] |tuple[str,...] |None, default:None)_cli_settings_source (
Optional[CliSettingsSource[Any]], default:None)_cli_implicit_flags (
Union[bool,Literal['dual','toggle'],None], default:None)_cli_kebab_case (
Union[bool,Literal['all','no_enums'],None], default:None)_cli_shortcuts (
Mapping[str,str|list[str]] |None, default:None)_secrets_dir (
Path|str|Sequence[Path|str] |None, default:None)_build_sources (
tuple[tuple[PydanticBaseSettingsSource,...],dict[str,Any]] |None, default:None)values (
Any)
- model_config: ClassVar[dict] = {'arbitrary_types_allowed': True, 'case_sensitive': False, 'cli_avoid_json': False, 'cli_enforce_required': False, 'cli_exit_on_error': True, 'cli_flag_prefix_char': '-', 'cli_hide_none_type': False, 'cli_ignore_unknown_args': False, 'cli_implicit_flags': False, 'cli_kebab_case': False, 'cli_parse_args': None, 'cli_parse_none_str': None, 'cli_prefix': '', 'cli_prog_name': None, 'cli_shortcuts': None, 'cli_use_class_docs_for_groups': False, 'enable_decoding': True, 'env_file': '.env', 'env_file_encoding': 'utf-8', 'env_ignore_empty': False, 'env_nested_delimiter': None, 'env_nested_max_split': None, 'env_parse_enums': None, 'env_parse_none_str': None, 'env_prefix': 'WQ_', 'env_prefix_target': 'variable', 'extra': 'ignore', 'json_file': None, 'json_file_encoding': None, 'nested_model_default_partial_update': False, 'protected_namespaces': ('model_validate', 'model_dump', 'settings_customise_sources'), 'secrets_dir': None, 'toml_file': None, 'validate_default': True, 'yaml_config_section': None, 'yaml_file': None, 'yaml_file_encoding': None}¶
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- backend: Backend¶
- cache_dir: Path¶
Types¶
Type definitions, enums, and type aliases for wraquant.
Provides strongly-typed enumerations for financial concepts and type aliases used throughout the package.
- DateLike¶
Anything that can be interpreted as a date.
alias of
str|date|datetime|Timestamp|datetime64
- ArrayLike¶
Numeric array-like input accepted by most functions.
alias of
ndarray[tuple[Any, …],dtype[floating]] |Series|Sequence[float] |list[float]
- PriceSeries¶
A pandas Series of prices indexed by datetime.
- ReturnSeries¶
A pandas Series of returns indexed by datetime.
- PriceFrame¶
A DataFrame of prices with datetime index and asset columns.
- Parameters:
index (
Union[ExtensionArray,ndarray,Index,Series,SequenceNotStr,range,None], default:None)columns (
Union[ExtensionArray,ndarray,Index,Series,SequenceNotStr,range,None], default:None)dtype (
Union[ExtensionDtype,str,dtype,type[str|complex|bool|object],None], default:None)
- ReturnFrame¶
A DataFrame of returns with datetime index and asset columns.
- Parameters:
index (
Union[ExtensionArray,ndarray,Index,Series,SequenceNotStr,range,None], default:None)columns (
Union[ExtensionArray,ndarray,Index,Series,SequenceNotStr,range,None], default:None)dtype (
Union[ExtensionDtype,str,dtype,type[str|complex|bool|object],None], default:None)
- OHLCVFrame¶
A DataFrame with open/high/low/close/volume columns and datetime index.
- Parameters:
index (
Union[ExtensionArray,ndarray,Index,Series,SequenceNotStr,range,None], default:None)columns (
Union[ExtensionArray,ndarray,Index,Series,SequenceNotStr,range,None], default:None)dtype (
Union[ExtensionDtype,str,dtype,type[str|complex|bool|object],None], default:None)
- WeightsArray¶
Portfolio weight vector.
alias of
ndarray[tuple[Any, …],dtype[floating]] |Series|Sequence[float]
- CovarianceMatrix¶
Covariance matrix (2D).
alias of
ndarray[tuple[Any, …],dtype[floating]] |DataFrame
- class Frequency[source]¶
Bases:
StrEnumTime series frequency.
- TICK = 'tick'¶
- SECOND = '1s'¶
- MINUTE = '1min'¶
- FIVE_MIN = '5min'¶
- FIFTEEN_MIN = '15min'¶
- THIRTY_MIN = '30min'¶
- HOURLY = '1h'¶
- FOUR_HOUR = '4h'¶
- DAILY = '1d'¶
- WEEKLY = '1w'¶
- MONTHLY = '1mo'¶
- QUARTERLY = '1q'¶
- YEARLY = '1y'¶
- __new__(value)¶
- class AssetClass[source]¶
Bases:
StrEnumFinancial asset classes.
- EQUITY = 'equity'¶
- FIXED_INCOME = 'fixed_income'¶
- COMMODITY = 'commodity'¶
- FX = 'fx'¶
- CRYPTO = 'crypto'¶
- DERIVATIVE = 'derivative'¶
- INDEX = 'index'¶
- ETF = 'etf'¶
- FUND = 'fund'¶
- REAL_ESTATE = 'real_estate'¶
- ALTERNATIVE = 'alternative'¶
- __new__(value)¶
- class Currency[source]¶
Bases:
StrEnumMajor world currencies (ISO 4217).
- USD = 'USD'¶
- EUR = 'EUR'¶
- GBP = 'GBP'¶
- JPY = 'JPY'¶
- CHF = 'CHF'¶
- AUD = 'AUD'¶
- CAD = 'CAD'¶
- NZD = 'NZD'¶
- SEK = 'SEK'¶
- NOK = 'NOK'¶
- DKK = 'DKK'¶
- SGD = 'SGD'¶
- HKD = 'HKD'¶
- CNY = 'CNY'¶
- CNH = 'CNH'¶
- INR = 'INR'¶
- KRW = 'KRW'¶
- BRL = 'BRL'¶
- MXN = 'MXN'¶
- ZAR = 'ZAR'¶
- TRY = 'TRY'¶
- PLN = 'PLN'¶
- CZK = 'CZK'¶
- HUF = 'HUF'¶
- THB = 'THB'¶
- TWD = 'TWD'¶
- RUB = 'RUB'¶
- __new__(value)¶
- class ReturnType[source]¶
Bases:
StrEnumType of return calculation.
- SIMPLE = 'simple'¶
- LOG = 'log'¶
- EXCESS = 'excess'¶
- __new__(value)¶
- class OptionType[source]¶
Bases:
StrEnumOption contract type.
- CALL = 'call'¶
- PUT = 'put'¶
- __new__(value)¶
- class OptionStyle[source]¶
Bases:
StrEnumOption exercise style.
- EUROPEAN = 'european'¶
- AMERICAN = 'american'¶
- BERMUDAN = 'bermudan'¶
- ASIAN = 'asian'¶
- __new__(value)¶
- class OrderSide[source]¶
Bases:
StrEnumTrade order direction.
- BUY = 'buy'¶
- SELL = 'sell'¶
- __new__(value)¶
- class RegimeState[source]¶
Bases:
StrEnumMarket regime states.
- BULL = 'bull'¶
- BEAR = 'bear'¶
- SIDEWAYS = 'sideways'¶
- HIGH_VOL = 'high_vol'¶
- LOW_VOL = 'low_vol'¶
- CRISIS = 'crisis'¶
- __new__(value)¶
Exceptions¶
Custom exception hierarchy for wraquant.
- exception MissingDependencyError[source]¶
Bases:
WQError,ImportErrorRaised when an optional dependency is not installed.
- Parameters:
- exception ValidationError[source]¶
Bases:
WQError,ValueErrorRaised when input data fails validation.
Logging¶
Structured logging setup for wraquant.
Uses structlog for structured logging with loguru as the output handler.
- get_logger(name=None)[source]¶
Get a structlog logger instance.
- Parameters:
name (
str|None, default:None) – Logger name, typically__name__.- Return type:
BoundLogger- Returns:
A bound structlog logger.
Example
>>> from wraquant.core.logging import get_logger >>> log = get_logger(__name__) >>> log.info("fetching data", symbol="AAPL")
Decorators¶
Decorators for optional dependency gating, caching, and validation.
- requires_extra(group)[source]¶
Decorator that raises MissingDependencyError if an optional group is missing.
- Parameters:
group (
str) – The PDM optional dependency group name (e.g., ‘market-data’).- Return type:
Callable[[TypeVar(F, bound=Callable[...,Any])],TypeVar(F, bound=Callable[...,Any])]- Returns:
Decorated function that checks for the dependency before execution.
Example
>>> @requires_extra('market-data') ... def fetch_yahoo(symbol: str) -> pd.DataFrame: ... import yfinance ... return yfinance.download(symbol)
Results¶
Standardized result containers for wraquant.
Dataclasses that provide consistent, IDE-friendly access to results from GARCH fitting, backtesting, forecasting, and other operations. Each result type carries chaining methods that lazily import downstream modules, enabling composable workflows:
garch_result.to_var(alpha=0.05) # -> risk/var garch_result.plot() # -> viz backtest_result.to_tearsheet() # -> backtest/tearsheet forecast_result.plot() # -> viz
- class GARCHResult[source]¶
Bases:
objectResult from GARCH-family model fitting.
- params¶
Fitted parameters dict (omega, alpha, beta, …).
- conditional_volatility¶
Time series of conditional std dev.
- standardized_residuals¶
Residuals / conditional vol.
- aic¶
Akaike Information Criterion.
- bic¶
Bayesian Information Criterion.
- log_likelihood¶
Maximized log-likelihood.
- persistence¶
Sum of alpha + beta parameters.
- half_life¶
Periods for shock to decay 50%.
- unconditional_variance¶
Long-run variance.
- model¶
Underlying fitted model object.
- model_name¶
Name of the GARCH model variant.
- Parameters:
- to_var(alpha=0.05)[source]¶
Compute GARCH-based Value at Risk.
Uses the fitted conditional volatility to estimate VaR via
wraquant.risk.var.garch_var.
- plot()[source]¶
Plot conditional volatility using viz module.
- Return type:
- Returns:
Plotly figure object.
- summary()[source]¶
Human-readable summary of GARCH fit.
- Return type:
- Returns:
Multi-line string with key diagnostics.
- __init__(params, conditional_volatility, standardized_residuals, aic, bic, log_likelihood, persistence, half_life, unconditional_variance, model=None, ljung_box=None, model_name='')¶
- class BacktestResult[source]¶
Bases:
objectResult from a backtest run.
- returns¶
Portfolio return series.
- equity_curve¶
Cumulative equity curve (aliased as portfolio_value).
- metrics¶
Dict of performance metrics (Sharpe, max_dd, etc.).
- trades¶
Trade count (int) or list of trade records.
- signals¶
Signal series used.
- positions¶
Position weights over time (if available).
- Parameters:
- to_tearsheet(**kwargs)[source]¶
Generate a comprehensive tearsheet.
Delegates to
wraquant.backtest.tearsheet.comprehensive_tearsheet.
- class ForecastResult[source]¶
Bases:
objectResult from time series forecasting.
- forecast¶
Point forecast values.
- confidence_lower¶
Lower confidence bound.
- confidence_upper¶
Upper confidence bound.
- method¶
Forecasting method used.
- fitted_values¶
In-sample fitted values.
- residuals¶
In-sample residuals.
- metrics¶
Fit metrics (AIC, BIC, RMSE).
- plot()[source]¶
Plot forecast with confidence bounds using viz module.
- Return type:
- Returns:
Plotly figure object.
- summary()[source]¶
Human-readable summary of forecast.
- Return type:
- Returns:
Multi-line string with method and fit metrics.