# This file is automatically generated by pyo3_stub_gen
# ruff: noqa: E501

import typing

from nautilus_trader import model
from nautilus_trader.analysis.config import GridLayout as GridLayout
from nautilus_trader.analysis.config import (
    TearsheetBarsWithFillsChart as TearsheetBarsWithFillsChart,
)
from nautilus_trader.analysis.config import TearsheetChart as TearsheetChart
from nautilus_trader.analysis.config import TearsheetConfig as TearsheetConfig
from nautilus_trader.analysis.config import TearsheetCustomChart as TearsheetCustomChart
from nautilus_trader.analysis.config import TearsheetDistributionChart as TearsheetDistributionChart
from nautilus_trader.analysis.config import TearsheetDrawdownChart as TearsheetDrawdownChart
from nautilus_trader.analysis.config import TearsheetEquityChart as TearsheetEquityChart
from nautilus_trader.analysis.config import (
    TearsheetMonthlyReturnsChart as TearsheetMonthlyReturnsChart,
)
from nautilus_trader.analysis.config import (
    TearsheetRollingSharpeChart as TearsheetRollingSharpeChart,
)
from nautilus_trader.analysis.config import TearsheetRunInfoChart as TearsheetRunInfoChart
from nautilus_trader.analysis.config import TearsheetStatsTableChart as TearsheetStatsTableChart
from nautilus_trader.analysis.config import (
    TearsheetYearlyReturnsChart as TearsheetYearlyReturnsChart,
)
from nautilus_trader.analysis.reporter import ReportProvider as ReportProvider
from nautilus_trader.analysis.statistic import PortfolioStatistic as PortfolioStatistic
from nautilus_trader.analysis.tearsheet import create_bars_with_fills as create_bars_with_fills
from nautilus_trader.analysis.tearsheet import create_drawdown_chart as create_drawdown_chart
from nautilus_trader.analysis.tearsheet import create_equity_curve as create_equity_curve
from nautilus_trader.analysis.tearsheet import (
    create_monthly_returns_heatmap as create_monthly_returns_heatmap,
)
from nautilus_trader.analysis.tearsheet import (
    create_returns_distribution as create_returns_distribution,
)
from nautilus_trader.analysis.tearsheet import create_rolling_sharpe as create_rolling_sharpe
from nautilus_trader.analysis.tearsheet import create_tearsheet as create_tearsheet
from nautilus_trader.analysis.tearsheet import (
    create_tearsheet_from_stats as create_tearsheet_from_stats,
)
from nautilus_trader.analysis.tearsheet import create_yearly_returns as create_yearly_returns
from nautilus_trader.analysis.tearsheet import get_chart as get_chart
from nautilus_trader.analysis.tearsheet import list_charts as list_charts
from nautilus_trader.analysis.tearsheet import register_chart as register_chart
from nautilus_trader.analysis.tearsheet import register_tearsheet_chart as register_tearsheet_chart
from nautilus_trader.analysis.themes import get_theme as get_theme
from nautilus_trader.analysis.themes import list_themes as list_themes
from nautilus_trader.analysis.themes import register_theme as register_theme

__all__ = [
    "CAGR",
    "Alpha",
    "AvgLoser",
    "AvgWinner",
    "BetaRatio",
    "CalmarRatio",
    "DownCaptureRatio",
    "Expectancy",
    "ExpectedShortfall",
    "InformationRatio",
    "LongRatio",
    "MaxDrawdown",
    "MaxLoser",
    "MaxWinner",
    "MinLoser",
    "MinWinner",
    "OmegaRatio",
    "PortfolioAnalyzer",
    "PortfolioStatistics",
    "ProfitFactor",
    "ReturnsAverage",
    "ReturnsAverageLoss",
    "ReturnsAverageWin",
    "ReturnsKurtosis",
    "ReturnsSkewness",
    "ReturnsVolatility",
    "RiskReturnRatio",
    "SharpeRatio",
    "SortinoRatio",
    "TailRatio",
    "TrackingError",
    "TreynorRatio",
    "UlcerIndex",
    "UpCaptureRatio",
    "ValueAtRisk",
    "WinRate",
]

@typing.final
class Alpha:
    def __init__(self, period: int | None = None, risk_free_rate: float | None = None) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_returns(self, _returns: typing.Mapping[int, float]) -> float | None: ...
    def calculate_from_realized_pnls(
        self, _realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_positions(
        self, _positions: typing.Sequence[model.Position]
    ) -> float | None: ...
    def calculate_from_returns_with_benchmark(
        self, returns: typing.Mapping[int, float], benchmark: typing.Mapping[int, float]
    ) -> float | None: ...

@typing.final
class AvgLoser:
    def __init__(self) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_realized_pnls(
        self, realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_returns(self, _returns: typing.Mapping[int, float]) -> float | None: ...
    def calculate_from_positions(
        self, _positions: typing.Sequence[model.Position]
    ) -> float | None: ...

@typing.final
class AvgWinner:
    def __init__(self) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_realized_pnls(
        self, realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_returns(self, _returns: typing.Mapping[int, float]) -> float | None: ...
    def calculate_from_positions(
        self, _positions: typing.Sequence[model.Position]
    ) -> float | None: ...

@typing.final
class BetaRatio:
    def __init__(self) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_returns(self, _returns: typing.Mapping[int, float]) -> float | None: ...
    def calculate_from_realized_pnls(
        self, _realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_positions(
        self, _positions: typing.Sequence[model.Position]
    ) -> float | None: ...
    def calculate_from_returns_with_benchmark(
        self, returns: typing.Mapping[int, float], benchmark: typing.Mapping[int, float]
    ) -> float | None: ...

@typing.final
class CAGR:
    def __init__(self, period: int | None = None) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_returns(self, raw_returns: typing.Mapping[int, float]) -> float | None: ...
    def calculate_from_realized_pnls(
        self, _realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_positions(
        self, _positions: typing.Sequence[model.Position]
    ) -> float | None: ...

@typing.final
class CalmarRatio:
    def __init__(self, period: int | None = None) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_returns(self, raw_returns: typing.Mapping[int, float]) -> float | None: ...
    def calculate_from_realized_pnls(
        self, _realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_positions(
        self, _positions: typing.Sequence[model.Position]
    ) -> float | None: ...

@typing.final
class DownCaptureRatio:
    def __init__(self, period: int | None = None) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_returns(self, _returns: typing.Mapping[int, float]) -> float | None: ...
    def calculate_from_realized_pnls(
        self, _realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_positions(
        self, _positions: typing.Sequence[model.Position]
    ) -> float | None: ...
    def calculate_from_returns_with_benchmark(
        self, returns: typing.Mapping[int, float], benchmark: typing.Mapping[int, float]
    ) -> float | None: ...

@typing.final
class Expectancy:
    def __init__(self) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_realized_pnls(
        self, realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_returns(self, _returns: typing.Mapping[int, float]) -> float | None: ...
    def calculate_from_positions(
        self, _positions: typing.Sequence[model.Position]
    ) -> float | None: ...

@typing.final
class ExpectedShortfall:
    def __init__(self, confidence: float | None = None) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_returns(self, raw_returns: typing.Mapping[int, float]) -> float | None: ...
    def calculate_from_realized_pnls(
        self, _realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_positions(
        self, _positions: typing.Sequence[model.Position]
    ) -> float | None: ...

@typing.final
class InformationRatio:
    def __init__(self, period: int | None = None) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_returns(self, _returns: typing.Mapping[int, float]) -> float | None: ...
    def calculate_from_realized_pnls(
        self, _realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_positions(
        self, _positions: typing.Sequence[model.Position]
    ) -> float | None: ...
    def calculate_from_returns_with_benchmark(
        self, returns: typing.Mapping[int, float], benchmark: typing.Mapping[int, float]
    ) -> float | None: ...

@typing.final
class LongRatio:
    def __init__(self, precision: int | None = None) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_positions(
        self, positions: typing.Sequence[model.Position]
    ) -> float | None: ...
    def calculate_from_realized_pnls(
        self, _realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_returns(self, _returns: typing.Mapping[int, float]) -> float | None: ...

@typing.final
class MaxDrawdown:
    def __init__(self) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_returns(self, raw_returns: typing.Mapping[int, float]) -> float | None: ...
    def calculate_from_realized_pnls(
        self, _realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_positions(
        self, _positions: typing.Sequence[model.Position]
    ) -> float | None: ...

@typing.final
class MaxLoser:
    def __init__(self) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_realized_pnls(
        self, realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_returns(self, _returns: typing.Mapping[int, float]) -> float | None: ...
    def calculate_from_positions(
        self, _positions: typing.Sequence[model.Position]
    ) -> float | None: ...

@typing.final
class MaxWinner:
    def __init__(self) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_realized_pnls(
        self, realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_returns(self, returns: typing.Mapping[int, float]) -> float | None: ...
    def calculate_from_positions(
        self, _positions: typing.Sequence[model.Position]
    ) -> float | None: ...

@typing.final
class MinLoser:
    def __init__(self) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_realized_pnls(
        self, realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_returns(self, _returns: typing.Mapping[int, float]) -> float | None: ...
    def calculate_from_positions(
        self, _positions: typing.Sequence[model.Position]
    ) -> float | None: ...

@typing.final
class MinWinner:
    def __init__(self) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_realized_pnls(
        self, realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_returns(self, _returns: typing.Mapping[int, float]) -> float | None: ...
    def calculate_from_positions(
        self, _positions: typing.Sequence[model.Position]
    ) -> float | None: ...

@typing.final
class OmegaRatio:
    def __init__(self, threshold: float | None = None) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_returns(self, raw_returns: typing.Mapping[int, float]) -> float | None: ...
    def calculate_from_realized_pnls(
        self, _realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_positions(
        self, _positions: typing.Sequence[model.Position]
    ) -> float | None: ...

@typing.final
class PortfolioAnalyzer:
    def __init__(self) -> None: ...
    def currencies(self) -> list[model.Currency]: ...
    def get_performance_stats_returns(self) -> dict[str, float]: ...
    def get_performance_stats_position_returns(self) -> dict[str, float]: ...
    def get_performance_stats_portfolio_returns(self) -> dict[str, float]: ...
    def get_performance_stats_returns_vs_benchmark(
        self, benchmark: typing.Mapping[int, float]
    ) -> dict[str, float]: ...
    def get_performance_stats_pnls(
        self, currency: model.Currency | None = ..., unrealized_pnl: model.Money | None = ...
    ) -> dict[str, float]: ...
    def get_performance_stats_general(self) -> dict[str, float]: ...
    def add_position_return(self, timestamp: int, value: float) -> None: ...
    def add_return(self, timestamp: int, value: float) -> None: ...
    def reset(self) -> None: ...
    def register_statistic(self, statistic: typing.Any) -> None: ...
    def deregister_statistic(self, statistic: typing.Any) -> None: ...
    def deregister_statistics(self) -> None: ...
    def add_positions(self, positions: typing.Sequence[typing.Any]) -> None: ...
    def add_trade(
        self, position_id: model.PositionId, ts_event: int, realized_pnl: model.Money
    ) -> None: ...
    def record_trade(
        self, position_id: model.PositionId, ts_event: int, realized_pnl: model.Money
    ) -> None: ...
    def statistic(self, name: str) -> str | None: ...
    def returns(self) -> typing.Any: ...
    def position_returns(self) -> typing.Any: ...
    def portfolio_returns(self) -> typing.Any: ...
    def realized_pnls(self, currency: model.Currency | None = ...) -> typing.Any: ...
    def total_pnl(
        self, currency: model.Currency | None = ..., unrealized_pnl: model.Money | None = ...
    ) -> float: ...
    def total_pnl_percentage(
        self, currency: model.Currency | None = ..., unrealized_pnl: model.Money | None = ...
    ) -> float: ...
    def get_stats_pnls_formatted(
        self, currency: model.Currency | None = ..., unrealized_pnl: model.Money | None = ...
    ) -> list[str]: ...
    def get_stats_returns_formatted(self) -> list[str]: ...
    def get_stats_position_returns_formatted(self) -> list[str]: ...
    def get_stats_portfolio_returns_formatted(self) -> list[str]: ...
    def get_stats_general_formatted(self) -> list[str]: ...

@typing.final
class PortfolioStatistics:
    @property
    def pnls(self) -> dict[str, dict[str, float]]: ...
    @property
    def returns(self) -> dict[str, float]: ...
    @property
    def general(self) -> dict[str, float]: ...
    @property
    def returns_series(self) -> dict[int, float]: ...

@typing.final
class ProfitFactor:
    def __init__(self) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_returns(self, raw_returns: typing.Mapping[int, float]) -> float | None: ...
    def calculate_from_realized_pnls(
        self, _realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_positions(
        self, _positions: typing.Sequence[model.Position]
    ) -> float | None: ...

@typing.final
class ReturnsAverage:
    def __init__(self) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_returns(self, raw_returns: typing.Mapping[int, float]) -> float | None: ...
    def calculate_from_realized_pnls(
        self, _realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_positions(
        self, _positions: typing.Sequence[model.Position]
    ) -> float | None: ...

@typing.final
class ReturnsAverageLoss:
    def __init__(self) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_returns(self, raw_returns: typing.Mapping[int, float]) -> float | None: ...
    def calculate_from_realized_pnls(
        self, _realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_positions(
        self, _positions: typing.Sequence[model.Position]
    ) -> float | None: ...

@typing.final
class ReturnsAverageWin:
    def __init__(self) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_returns(self, raw_returns: typing.Mapping[int, float]) -> float | None: ...
    def calculate_from_realized_pnls(
        self, _realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_positions(
        self, _positions: typing.Sequence[model.Position]
    ) -> float | None: ...

@typing.final
class ReturnsKurtosis:
    def __init__(self) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_returns(self, raw_returns: typing.Mapping[int, float]) -> float | None: ...
    def calculate_from_realized_pnls(
        self, _realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_positions(
        self, _positions: typing.Sequence[model.Position]
    ) -> float | None: ...

@typing.final
class ReturnsSkewness:
    def __init__(self) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_returns(self, raw_returns: typing.Mapping[int, float]) -> float | None: ...
    def calculate_from_realized_pnls(
        self, _realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_positions(
        self, _positions: typing.Sequence[model.Position]
    ) -> float | None: ...

@typing.final
class ReturnsVolatility:
    def __init__(self, period: int | None = None) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_returns(self, raw_returns: typing.Mapping[int, float]) -> float | None: ...
    def calculate_from_realized_pnls(
        self, _realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_positions(
        self, _positions: typing.Sequence[model.Position]
    ) -> float | None: ...

@typing.final
class RiskReturnRatio:
    def __init__(self) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_returns(self, raw_returns: typing.Mapping[int, float]) -> float | None: ...
    def calculate_from_realized_pnls(
        self, _realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_positions(
        self, _positions: typing.Sequence[model.Position]
    ) -> float | None: ...

@typing.final
class SharpeRatio:
    def __init__(self, period: int | None = None) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_returns(self, raw_returns: typing.Mapping[int, float]) -> float | None: ...
    def calculate_from_realized_pnls(
        self, _realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_positions(
        self, _positions: typing.Sequence[model.Position]
    ) -> float | None: ...

@typing.final
class SortinoRatio:
    def __init__(self, period: int | None = None) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_returns(self, raw_returns: typing.Mapping[int, float]) -> float | None: ...
    def calculate_from_realized_pnls(
        self, _realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_positions(
        self, _positions: typing.Sequence[model.Position]
    ) -> float | None: ...

@typing.final
class TailRatio:
    def __init__(self) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_returns(self, raw_returns: typing.Mapping[int, float]) -> float | None: ...
    def calculate_from_realized_pnls(
        self, _realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_positions(
        self, _positions: typing.Sequence[model.Position]
    ) -> float | None: ...

@typing.final
class TrackingError:
    def __init__(self, period: int | None = None) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_returns(self, _returns: typing.Mapping[int, float]) -> float | None: ...
    def calculate_from_realized_pnls(
        self, _realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_positions(
        self, _positions: typing.Sequence[model.Position]
    ) -> float | None: ...
    def calculate_from_returns_with_benchmark(
        self, returns: typing.Mapping[int, float], benchmark: typing.Mapping[int, float]
    ) -> float | None: ...

@typing.final
class TreynorRatio:
    def __init__(self, period: int | None = None, risk_free_rate: float | None = None) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_returns(self, _returns: typing.Mapping[int, float]) -> float | None: ...
    def calculate_from_realized_pnls(
        self, _realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_positions(
        self, _positions: typing.Sequence[model.Position]
    ) -> float | None: ...
    def calculate_from_returns_with_benchmark(
        self, returns: typing.Mapping[int, float], benchmark: typing.Mapping[int, float]
    ) -> float | None: ...

@typing.final
class UlcerIndex:
    def __init__(self) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_returns(self, raw_returns: typing.Mapping[int, float]) -> float | None: ...
    def calculate_from_realized_pnls(
        self, _realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_positions(
        self, _positions: typing.Sequence[model.Position]
    ) -> float | None: ...

@typing.final
class UpCaptureRatio:
    def __init__(self, period: int | None = None) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_returns(self, _returns: typing.Mapping[int, float]) -> float | None: ...
    def calculate_from_realized_pnls(
        self, _realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_positions(
        self, _positions: typing.Sequence[model.Position]
    ) -> float | None: ...
    def calculate_from_returns_with_benchmark(
        self, returns: typing.Mapping[int, float], benchmark: typing.Mapping[int, float]
    ) -> float | None: ...

@typing.final
class ValueAtRisk:
    def __init__(self, confidence: float | None = None) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_returns(self, raw_returns: typing.Mapping[int, float]) -> float | None: ...
    def calculate_from_realized_pnls(
        self, _realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_positions(
        self, _positions: typing.Sequence[model.Position]
    ) -> float | None: ...

@typing.final
class WinRate:
    def __init__(self) -> None: ...
    @property
    def name(self) -> str: ...
    def calculate_from_realized_pnls(
        self, realized_pnls: typing.Sequence[float]
    ) -> float | None: ...
    def calculate_from_returns(self, _returns: typing.Mapping[int, float]) -> float | None: ...
    def calculate_from_positions(
        self, _positions: typing.Sequence[model.Position]
    ) -> float | None: ...
