Expand description
Streaming technical-analysis primitives, regime classification, composite scoring, and SVG chart exports.
Most consumers should start with the root re-exports. Concrete indicator and engine modules remain public for advanced composition; the crate is pre-1.0 and does not yet promise API stability for those lower-level modules.
Re-exports§
pub use adapters::DataFeedAdapter;pub use adapters::InMemoryDataFeed;pub use adapters::LoggingNotificationSink;pub use adapters::NotificationEvent;pub use adapters::NotificationSeverity;pub use adapters::NotificationSink;pub use adapters::WebhookNotificationSink;pub use applicability::check_applicability;pub use applicability::data_requirements;pub use applicability::rule_catalog;pub use applicability::Applicability;pub use applicability::ApplicabilityNote;pub use applicability::ApplicabilityReason;pub use applicability::ApplicabilityTier;pub use applicability::DataRequirements;pub use applicability::RuleDescription;pub use artifact::Artifact;pub use artifact::PivotArtifact;pub use artifact::ProfileArtifact;pub use artifact::ProfileBin;pub use artifact::ScenarioArtifact;pub use artifact::ZoneArtifact;pub use calendar::ExchangeCalendar;pub use calendar::SessionSegment;pub use checkpoint::Checkpoint;pub use checkpoint::CheckpointStore;pub use clustering::kmeans_1d;pub use clustering::KMeansResult;pub use clustering::RobustBand;pub use clustering::RollingRobustThreshold;pub use contract::contract_pnl;pub use contract::contract_tick_value;pub use contract::notional_value;pub use contract::stop_risk_amount;pub use contract::ContractSpec;pub use contract::ContractSpecError;pub use contract::Currency;pub use contract::FxConversionError;pub use contract::FxRate;pub use contract::InstrumentType;pub use contract::ValuationError;pub use event::AlertDeduplicator;pub use event::AlertEvent;pub use event::EventPhase;pub use execution::submit_bracket;pub use execution::ExecutionCosts;pub use execution::Fill;pub use execution::FillSimulator;pub use execution::FillSimulatorConfig;pub use execution::Order;pub use execution::OrderKind;pub use execution::OrderSide;pub use execution::OrderStatus;pub use execution::Position;pub use finance::discount_factor;pub use finance::price_bond;pub use finance::year_fraction;pub use finance::yield_to_maturity;pub use finance::BondPricingResult;pub use finance::BondSpec;pub use finance::BusinessCalendar;pub use finance::BusinessDayConvention;pub use finance::Cashflow;pub use finance::Compounding;pub use finance::CouponSchedule;pub use finance::Date;pub use finance::DayCountConvention;pub use finance::FinanceError;pub use finance::FixedRateBond;pub use finance::ScheduleStub;pub use finance::Weekday;pub use graph::ComposedNode;pub use graph::CompositionGraph;pub use graph::GraphError;pub use graph::GraphIndicator;pub use graph::Leaf;pub use indicator::cvd_intrabar::DeltaAnchor;pub use indicator::cvd_intrabar::DeltaProvenance;pub use indicator::cvd_intrabar::IntrabarCvd;pub use indicator::cvd_intrabar::IntrabarDelta;pub use indicator::cvd_intrabar::UnchangedIntrabarPolicy;pub use indicator::registry::build;pub use indicator::registry::build_checked;pub use indicator::registry::build_typed;pub use indicator::registry::catalog;pub use indicator::registry::ParamValue;pub use indicator::registry::RegistryError;pub use indicator::registry::TypedParams;pub use indicator::Indicator;pub use indicator::IndicatorAlert;pub use indicator::IndicatorOutput;pub use intrabar::IntrabarGroup;pub use intrabar::IntrabarGrouper;pub use lifecycle::BarLifecycle;pub use lifecycle::LifecycleError;pub use lifecycle::LifecycleRunner;pub use model::Bar;pub use model::BarQuality;pub use model::BarValidationError;pub use model::ContinuityKind;pub use model::InstrumentMeta;pub use model::InstrumentMetaError;pub use model::LiquidityTier;pub use model::MarketRegime;pub use model::PriceAdjustment;pub use model::Provenance;pub use model::QualifiedBar;pub use model::Resolution;pub use model::RiskPlan;pub use model::SeriesCapabilities;pub use model::SeriesIdentity;pub use model::SessionKind;pub use model::Source;pub use model::SupportResistanceZone;pub use model::VolumeKind;pub use model::ZoneKind;pub use option::black_76;pub use option::black_scholes_merton;pub use option::implied_volatility;pub use option::normal_cdf;pub use option::normal_pdf;pub use option::verify_put_call_parity;pub use option::BlackScholesInputs;pub use option::OptionError;pub use option::OptionGreeks;pub use option::OptionPricingResult;pub use option::OptionStyle;pub use option::OptionType;pub use parity::ParityFixture;pub use parity::ParityFixtureError;pub use parity::ParityFixtureRow;pub use parity::ParityOutcome;pub use parity::ParityReport;pub use portfolio::calculate_return_metrics;pub use portfolio::cashflow_adjusted_return;pub use portfolio::compute_drawdown;pub use portfolio::evaluate_portfolio;pub use portfolio::historical_var_and_es;pub use portfolio::volatility_targeting_scale;pub use portfolio::CashLedger;pub use portfolio::DrawdownStats;pub use portfolio::HistoricalRiskStats;pub use portfolio::PortfolioError;pub use portfolio::PortfolioSnapshot;pub use portfolio::PositionEvaluation;pub use portfolio::PositionSide;pub use portfolio::PositionSnapshot;pub use portfolio::ReturnMetrics;pub use regime::classify_regime;pub use regime_advanced::AdaptiveCycleOutput;pub use regime_advanced::AdaptiveCycleTracker;pub use regime_advanced::HysteresisBand;pub use regime_advanced::HysteresisLevel;pub use regime_advanced::PredictabilityTracker;pub use regime_advanced::RegimeMarkovModel;pub use regime_advanced::RegimePersistenceOutput;pub use regime_advanced::RegimePersistenceTracker;pub use risk::position_size;pub use risk::position_size_contract;pub use risk::AccountRisk;pub use risk::PositionSizeResult;pub use risk::ScaleInStep;pub use risk::ScaleOutStep;pub use risk::ScalePlan;pub use risk::StopDecision;pub use risk::StopManager;pub use runner::run_batch;pub use runner::run_batch_checked;pub use runner::run_batch_with_applicability;pub use runner::BatchResult;pub use runner::TimestampedOutput;pub use scenario::ScenarioStateMachine;pub use scenario::ScenarioStatus;pub use scenario::StageConfig;pub use scoring::aggregate_subscores;pub use scoring::aggregate_subscores_with_instrument;pub use scoring::score_indicator;pub use scoring::WeightPreset;pub use series::CumulativeSum;pub use series::Series;pub use series::SeriesEvents;pub use session::SessionConfig;pub use session::SessionConfigError;pub use session::SessionTracker;pub use signal::CompositeSignal;pub use signal::PermissionGrade;pub use signal::SignalDirection;pub use signal::SubScore;pub use stats::correlation;pub use stats::linear_regression;pub use stats::longest_run;pub use stats::wilson_interval;pub use stats::ProportionInterval;pub use stress::apply_portfolio_stress;pub use stress::multi_asset_block_bootstrap;pub use stress::simulate_equity_paths;pub use stress::simulate_stop_gap_execution;pub use stress::PathSimulationSummary;pub use stress::StressError;pub use stress::StressScenario;pub use stress::StressedPortfolioResult;pub use structure::find_sr_zones;pub use structure::ManagedZone;pub use structure::ZoneRegistry;pub use structure::ZoneState;pub use synthetic::bos_choch_swing_bars;pub use synthetic::random_walk_bars;pub use synthetic::trending_bars;pub use synthetic::wyckoff_schematic_bars;pub use synthetic::SimpleRng;pub use synthetic::SwingDirection;pub use synthetic::WyckoffGeneratorConfig;pub use timeframe::BarResampler;pub use timeframe::ConfirmedResampler;pub use timeframe::Timeframe;pub use timeframe::TimeframeError;pub use valuation::bootstrap::CalibrationInstrument;pub use valuation::portfolio::MarketScenario;pub use valuation::portfolio::PortfolioReport;pub use valuation::portfolio::PortfolioScenarioResult;pub use valuation::portfolio::PortfolioSensitivities;pub use valuation::portfolio::PortfolioValuation;pub use valuation::portfolio::PositionValuation;pub use valuation::portfolio::SensitivityKind;pub use valuation::portfolio::ValuationModel;pub use valuation::portfolio::ValuationPosition;pub use valuation::portfolio::ValuedInstrument;pub use valuation::volatility::SurfaceValidity;pub use valuation::volatility::VolatilitySurface;pub use valuation::BondCurveValuation;pub use valuation::DiscountCurve;pub use valuation::ForwardCurve;pub use valuation::ValuationContext;pub use valuation::ValuationContextError;pub use valuation::ValuationStamp;pub use valuation::Valued;pub use valuation::YieldCurve;pub use cross_asset::compute_market_breadth;pub use cross_asset::compute_pair_spread;pub use cross_asset::compute_rolling_beta;pub use cross_asset::compute_signal_correlation_matrix;pub use cross_asset::correlation_matrix;pub use cross_asset::relative_strength as relative_strength_ranking;pub use cross_asset::CloseSample;pub use cross_asset::MarketBreadthSnapshot;pub use cross_asset::PairSpreadResult;pub use cross_asset::RollingBetaResult;pub use cross_asset::SignalCorrelationCell;pub use cross_asset::UniverseMemberObservation;pub use scoring::agreement::aggregate_agreement;pub use scoring::agreement::Agreement;pub use scoring::agreement::AgreementStrategy;pub use scoring::agreement::DirectionalStatement;pub use evaluation::price::ForwardPriceOutcome;pub use evaluation::price::PriceDirection;pub use evaluation::price::PriceObservation;pub use evaluation::price::PriceOutcomeSample;pub use evaluation::price::PriceOutcomeStats;pub use evaluation::price::PriceStats;pub use evaluation::probability::block_bootstrap_brier;pub use evaluation::probability::compute_calibration_metrics;pub use evaluation::probability::CalibratedProbability;pub use evaluation::probability::CalibrationMetrics;pub use evaluation::probability::IsotonicCalibrator;pub use evaluation::probability::ValidationExperimentManifest;pub use evaluation::split::split_trades_purged;pub use evaluation::split::PurgedSplitConfig;pub use evaluation::split::PurgedTrainTestSplit;pub use evaluation::split::SplitError;pub use evaluation::split::TradeSpan;
Modules§
- adapters
- Provider-neutral data-feed and notification integration contracts (traits), plus
dependency-free reference implementations.
Provider-neutral integration contracts: a data-feed trait and a notification-sink trait, plus
dependency-free reference implementations (an in-memory feed, a logging sink, and a
transport-agnostic webhook-shaped sink). Tools embedding kestrel-chartkit implement these
traits with their own broker/exchange/webhook specifics; this crate never depends on a
specific provider, and ships no HTTP client —
WebhookNotificationSinktakes the actual transport as an injected closure instead. - analytics
- Pure on-demand market-state and price-level snapshots. On-demand analytical snapshots over chronological OHLCV bars. These are pure computations: no provider, persistence, strategy scheduling or UI dependencies. Callers provide finite input bars and applicable volume data. Timestamp values are not inspected. Output enums/fields preserve the existing consumer wire representation with the serde feature.
- applicability
- Plausibility check between an indicator’s data requirements and a series’ capabilities.
Plausibility check between what an indicator’s calculation needs from a bar series
(
crate::applicability::DataRequirements) and what a series actually provides (crate::model::SeriesCapabilities). - artifact
- Shared, typed result/artifact models (pivots, zones, profiles, scenarios). Shared, typed result/artifact models for indicator outputs.
- calendar
- IANA-timezone, DST-aware exchange calendars. Requires the
calendarfeature. IANA-timezone, DST-aware exchange calendars. - checkpoint
- Versioned state snapshots for long-running engines. Versioned state snapshots for long-running engines.
- clustering
- Deterministic clustering and robust adaptive-threshold primitives. Deterministic clustering and robust adaptive-threshold primitives for regime/tradability engines, so each one stops hand-rolling its own bucketing/outlier-sensitive threshold logic.
- contract
- Contract specifications, currencies, and linear contract valuation models. Provider-neutral instrument contract specifications, currency definitions, and valuation models.
- cross_
asset - Cross-instrument return analysis over aligned close samples. Pairwise return correlation and relative-strength ranking over close samples. Inputs must be finite, chronological, and use a common timestamp convention.
- engine
- Market-context and execution-support calculations.
Composite “engine” layer (plan
kestrel-chartkit-design-plan.md, Anhang E–G): structures that combine severalindicator::*outputs into a higher-level context/state/permission reading, sitting above the per-barIndicatortrait and belowscoring::CompositeSignal. - evaluation
- Evaluation records and aggregate trade statistics.
- event
- Event/alert enrichment: timestamps, instrument/timeframe context, stable IDs, deduplication. Event and alert enrichment model.
- execution
- Provider-neutral order/fill simulator: orders, partial fills, pyramiding, costs, position state. Provider-neutral order/fill simulator: market/limit/stop/stop-limit/trailing orders, partial fills bounded by a per-bar participation cap, pyramiding (multiple same-direction fills accumulating one position), fees/spread/slippage, and explicit position state.
- finance
- Financial day-count conventions, cashflow discounting, and bond valuation. Financial day-count conventions, coupon schedules, cashflow discounting, and bond valuation.
- graph
- Generic composition graph: typed indicator dependencies, shared intermediate outputs, and centralized warmup/execution ordering. Generic composition graph for indicators with typed dependencies.
- indicator
- Streaming indicators and the validated indicator registry.
- intrabar
- Lower-timeframe (intrabar) child-bar grouping under a higher-timeframe parent bucket. Lower-timeframe (intrabar) child-bar grouping.
- lifecycle
- Bar lifecycle events and rollback-safe, idempotent recomputation. Bar lifecycle events and rollback-safe, idempotent recomputation.
- model
- Shared OHLCV and market-domain types.
- option
- European vanilla option pricing, analytical Greeks, and implied volatility solver. European vanilla option pricing, analytical Greeks, and implied volatility solver.
- parity
- Reference-parity fixture harness: standardized reference-value comparison with timestamp alignment, warmup handling, tolerances, MTF boundaries, and explicit missing values. Reference-parity fixture harness: a standardized way to compare a Rust indicator’s output series against confirmed external reference values, with timestamp alignment, automatic warmup handling, per-row or default tolerances, explicit missing-value rows, and an MTF-boundary-aware comparison mode — reusable across the whole porting scope instead of the hand-rolled per-indicator fixture parsing the existing golden tests use.
- portfolio
- Provider-neutral portfolio exposure, cashflow-adjusted equity returns, and risk analytics. Provider-neutral portfolio exposure, cashflow-adjusted equity returns, and risk analytics.
- regime
- Market-regime classification.
- regime_
advanced - Advanced regime-model building blocks: Markov transitions, persistence, predictability,
hysteretic transitions, and adaptive cycle-length tracking.
Advanced regime-model building blocks layered on top of
crate::regime::classify_regime’s single-shot four-class output: empirical Markov transition probabilities, trend persistence (streak length), a streaming predictability index, hysteretic (chatter-free) level transitions, and adaptive swing-length tracking as a dominant-cycle-length proxy. - risk
- Provider-neutral risk and position-sizing: account risk, leverage/notional limits,
scale-in/out plans, break-even/time-stop rules.
Provider-neutral risk and position-sizing: account-risk-based sizing on top of
InstrumentMeta(tick size, not a broker-specific contract spec), leverage/position limits, scale-in/out plans, and break-even/time-stop rules. - runner
- Batch and replay execution over a full bar history. Batch and replay execution over a full bar history.
- scenario
- Generic composite scenario state machine: multi-stage progressions with per-stage expiry and explicit invalidation. Generic composite scenario state machine: a reusable multi-stage progression with per-stage expiry (“Ablauf”) and explicit invalidation, generic over any caller-defined stage enum — rather than one hand-rolled state machine per scenario shape. Ships with three concrete presets matching the doc’s named examples: Edge -> Setup -> Watch -> Trigger, Armed Balance -> Breakout -> Aftermath, and Direct/Pullback/Failure.
- scoring
- Indicator scoring and composite aggregation.
- series
- Historical series sliding lookback and event helpers.
- session
- Trading session and Opening Range Breakout (ORB) tracking.
- signal
- Composite signal data types.
- stats
- Rolling statistical primitives, linear regression, and sample statistics (Wilson interval, longest run). Rolling statistics primitives for streaming series calculations.
- stress
- Stress testing, multi-asset block bootstrapping, path simulation, and execution uncertainty. Stress testing, multi-asset block bootstrapping, path simulation, and execution uncertainty.
- structure
- Support and resistance discovery and zone lifecycle.
- synthetic
- Deterministic synthetic price series and market pattern generators. Deterministic, dependency-free synthetic price series and market pattern generators.
- timeframe
- Custom timeframe types and OHLCV bar resampling.
- transform
- Bar-series transformations that derive alternative candles from observed ones. Bar-series transformations: alternative candles derived from observed ones.
- valuation
- Shared valuation context: valuation date, market-data stamp, curves and FX. A shared valuation context: when we are valuing, on which market data, and with which curves.
- viz
- Chart DTOs and static SVG rendering.
Constants§
- VERSION
- Version dieser Rechenbibliothek, zur Laufzeit lesbar.