"""Fixed-income portfolio analytics and typed public result surfaces.

The package exposes the main portfolio container, typed holdings and
classification helpers, and the analytics surfaces for risk, spreads, yield,
liquidity, ETF, benchmark, contribution, bucketing, and stress workflows.
Values are expressed using the library's fixed-income conventions: prices are
typically percent-of-par, spreads and rates are raw decimals unless a
``*_bps`` or ``*_pct`` field states otherwise, and portfolio analytics are
settled on the valuation date passed to each helper.
"""

from __future__ import annotations

from .analytics import (
    KeyRateProfile,
    NavBreakdown,
    PortfolioAnalytics,
    aggregate_key_rate_profile,
    calculate_nav_breakdown,
    calculate_portfolio_analytics,
    estimate_days_to_liquidate,
    partial_dv01s,
    total_cs01,
    total_dv01,
    weighted_convexity,
    weighted_current_yield,
    weighted_duration,
    weighted_spreads,
    weighted_ytc,
    weighted_ytm,
    weighted_ytw,
)
from .benchmark import (
    ActiveWeight,
    ActiveWeights,
    BenchmarkComparison,
    BenchmarkMetrics,
    DurationComparison,
    PortfolioBenchmark,
    RatingComparison,
    RiskComparison,
    SectorComparison,
    SpreadComparison,
    TrackingErrorEstimate,
    YieldComparison,
    active_weights,
    benchmark_comparison,
    estimate_tracking_error,
)
from .bucketing import (
    BucketMetrics,
    Bucketing,
    ClassifierDistribution,
    CustomDistribution,
    DEFAULT_BUCKETS,
    MaturityDistribution,
    RatingDistribution,
    SectorDistribution,
    bucket_by_classifier,
    bucket_by_country,
    bucket_by_currency,
    bucket_by_custom_field,
    bucket_by_issuer,
    bucket_by_maturity,
    bucket_by_rating,
    bucket_by_region,
    bucket_by_sector,
)
from .comparison import compare_portfolios
from .contribution import (
    AggregatedAttribution,
    AttributionInput,
    BucketContribution,
    Cs01Contributions,
    Contribution,
    DurationContributions,
    Dv01Contributions,
    HoldingAttribution,
    HoldingContribution,
    PortfolioAttribution,
    SectorAttribution,
    SpreadContributions,
    aggregated_attribution,
    calculate_attribution,
    cs01_contributions,
    duration_difference_by_sector,
    duration_contributions,
    dv01_contributions,
    estimate_income_returns,
    estimate_rate_returns,
    estimate_spread_returns,
    spread_contributions,
    spread_difference_by_sector,
)
from .etf import (
    BasketAnalysis,
    BasketComponent,
    BasketFlowSummary,
    ComplianceCheck,
    ComplianceSeverity,
    CreationBasket,
    DistributionYield,
    ExpenseMetrics,
    EtfComplianceReport,
    EtfNavMetrics,
    PremiumDiscountPoint,
    PremiumDiscountStats,
    SecYield,
    SecYieldInput,
    analyze_etf_basket,
    approximate_sec_yield,
    arbitrage_opportunity,
    build_creation_basket,
    calculate_distribution_yield,
    calculate_etf_nav,
    calculate_etf_nav_metrics,
    calculate_inav,
    calculate_sec_yield,
    cs01_per_share,
    dv01_per_share,
    etf_compliance_checks,
    estimate_yield_from_holdings,
    premium_discount,
    premium_discount_stats,
)
from .liquidity import (
    DaysToLiquidate,
    LiquidityBucket,
    LiquidityDistribution,
    LiquidityMetrics,
    calculate_liquidity_metrics,
    liquidity_distribution,
    weighted_bid_ask_spread,
    weighted_liquidity_score,
)
from .portfolio import Portfolio, PortfolioBuilder
from .risk import (
    CreditMetrics,
    CreditQualityMetrics,
    FallenAngelRisk,
    MigrationRisk,
    QualityTiers,
    RiskMetrics,
    RisingStarRisk,
    SpreadMetrics,
    YieldMetrics,
    calculate_credit_metrics,
    calculate_credit_quality,
    calculate_migration_risk,
    calculate_risk_metrics,
    calculate_spread_metrics,
    calculate_yield_metrics,
    weighted_asw,
    weighted_best_duration,
    weighted_best_spread,
    weighted_best_yield,
    weighted_effective_convexity,
    weighted_effective_duration,
    weighted_g_spread,
    weighted_i_spread,
    weighted_macaulay_duration,
    weighted_modified_duration,
    weighted_oas,
    weighted_spread_duration,
    weighted_z_spread,
)
from .stress import (
    KeyRateShiftScenario,
    RateScenario,
    RateShockScenario,
    SpreadScenario,
    SpreadShockScenario,
    Stress,
    StressScenario,
    StressSummary,
    TenorShift,
    best_case,
    key_rate_shift_impact,
    key_rate_shift_result,
    parallel_shift_impact,
    rate_shock_impact,
    run_stress_scenario,
    run_stress_scenarios,
    spread_shock_impact,
    spread_shock_result,
    summarize_results,
    standard_scenarios,
    stress_scenarios,
    worst_case,
)
from .types import (
    AnalyticsConfig,
    BucketResult,
    CashPosition,
    Classification,
    CreditRating,
    Holding,
    HoldingAnalytics,
    HoldingBuilder,
    MaturityBucket,
    PortfolioMetrics,
    Position,
    PositionAnalytics,
    RatingBucket,
    RatingInfo,
    Sector,
    SectorInfo,
    Seniority,
    SeniorityInfo,
    StressResult,
    WeightingMethod,
)

__all__ = [
    "aggregate_key_rate_profile",
    "AggregatedAttribution",
    "ActiveWeight",
    "ActiveWeights",
    "approximate_sec_yield",
    "analyze_etf_basket",
    "AnalyticsConfig",
    "AttributionInput",
    "BasketAnalysis",
    "BasketComponent",
    "BasketFlowSummary",
    "BenchmarkComparison",
    "BenchmarkMetrics",
    "BucketContribution",
    "BucketMetrics",
    "BucketResult",
    "Bucketing",
    "ClassifierDistribution",
    "CreditRating",
    "CustomDistribution",
    "bucket_by_classifier",
    "bucket_by_country",
    "bucket_by_currency",
    "bucket_by_custom_field",
    "bucket_by_issuer",
    "bucket_by_maturity",
    "bucket_by_rating",
    "bucket_by_region",
    "bucket_by_sector",
    "calculate_credit_metrics",
    "calculate_credit_quality",
    "aggregated_attribution",
    "calculate_attribution",
    "calculate_etf_nav_metrics",
    "calculate_distribution_yield",
    "calculate_etf_nav",
    "calculate_inav",
    "calculate_liquidity_metrics",
    "calculate_migration_risk",
    "calculate_nav_breakdown",
    "calculate_portfolio_analytics",
    "calculate_risk_metrics",
    "calculate_sec_yield",
    "calculate_spread_metrics",
    "calculate_yield_metrics",
    "CashPosition",
    "compare_portfolios",
    "Classification",
    "CreditMetrics",
    "CreditQualityMetrics",
    "Cs01Contributions",
    "cs01_per_share",
    "ComplianceCheck",
    "ComplianceSeverity",
    "Contribution",
    "CreationBasket",
    "DaysToLiquidate",
    "DEFAULT_BUCKETS",
    "DistributionYield",
    "ExpenseMetrics",
    "duration_difference_by_sector",
    "duration_contributions",
    "DurationComparison",
    "DurationContributions",
    "dv01_contributions",
    "dv01_per_share",
    "Dv01Contributions",
    "EtfComplianceReport",
    "EtfNavMetrics",
    "etf_compliance_checks",
    "estimate_yield_from_holdings",
    "estimate_income_returns",
    "estimate_days_to_liquidate",
    "estimate_rate_returns",
    "estimate_spread_returns",
    "estimate_tracking_error",
    "FallenAngelRisk",
    "HoldingAttribution",
    "Holding",
    "HoldingAnalytics",
    "HoldingBuilder",
    "HoldingContribution",
    "KeyRateProfile",
    "key_rate_shift_impact",
    "key_rate_shift_result",
    "KeyRateShiftScenario",
    "LiquidityBucket",
    "LiquidityDistribution",
    "liquidity_distribution",
    "LiquidityMetrics",
    "MaturityDistribution",
    "MaturityBucket",
    "MigrationRisk",
    "NavBreakdown",
    "Portfolio",
    "PortfolioAttribution",
    "PortfolioBuilder",
    "PortfolioAnalytics",
    "PortfolioBenchmark",
    "PortfolioMetrics",
    "Position",
    "PositionAnalytics",
    "PremiumDiscountPoint",
    "PremiumDiscountStats",
    "partial_dv01s",
    "arbitrage_opportunity",
    "build_creation_basket",
    "premium_discount",
    "premium_discount_stats",
    "QualityTiers",
    "RateScenario",
    "RatingDistribution",
    "RatingBucket",
    "RatingInfo",
    "RatingComparison",
    "rate_shock_impact",
    "RateShockScenario",
    "RiskComparison",
    "RiskMetrics",
    "RisingStarRisk",
    "run_stress_scenario",
    "run_stress_scenarios",
    "best_case",
    "Sector",
    "SectorAttribution",
    "SectorComparison",
    "SectorDistribution",
    "SectorInfo",
    "Seniority",
    "SeniorityInfo",
    "SpreadComparison",
    "SpreadMetrics",
    "SpreadScenario",
    "spread_contributions",
    "spread_difference_by_sector",
    "parallel_shift_impact",
    "spread_shock_impact",
    "spread_shock_result",
    "SpreadShockScenario",
    "SpreadContributions",
    "standard_scenarios",
    "Stress",
    "StressScenario",
    "stress_scenarios",
    "StressResult",
    "StressSummary",
    "SecYield",
    "SecYieldInput",
    "summarize_results",
    "TenorShift",
    "TrackingErrorEstimate",
    "total_cs01",
    "total_dv01",
    "active_weights",
    "benchmark_comparison",
    "cs01_contributions",
    "weighted_asw",
    "weighted_best_duration",
    "weighted_best_spread",
    "weighted_best_yield",
    "weighted_bid_ask_spread",
    "weighted_convexity",
    "weighted_current_yield",
    "weighted_duration",
    "weighted_effective_convexity",
    "weighted_effective_duration",
    "weighted_g_spread",
    "weighted_i_spread",
    "weighted_liquidity_score",
    "weighted_macaulay_duration",
    "weighted_modified_duration",
    "weighted_oas",
    "weighted_spread_duration",
    "weighted_spreads",
    "weighted_ytc",
    "weighted_ytm",
    "weighted_ytw",
    "weighted_z_spread",
    "WeightingMethod",
    "worst_case",
    "YieldComparison",
    "YieldMetrics",
]
