Skip to main content

Crate kestrel_chartkit

Crate kestrel_chartkit 

Source
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 artifact::Artifact;
pub use artifact::PivotArtifact;
pub use artifact::ProfileArtifact;
pub use artifact::ProfileBin;
pub use artifact::ScenarioArtifact;
pub use artifact::ZoneArtifact;
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 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 graph::ComposedNode;
pub use graph::CompositionGraph;
pub use graph::GraphError;
pub use graph::GraphIndicator;
pub use graph::Leaf;
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::LifecycleRunner;
pub use model::Bar;
pub use model::BarQuality;
pub use model::BarValidationError;
pub use model::InstrumentMeta;
pub use model::InstrumentMetaError;
pub use model::MarketRegime;
pub use model::QualifiedBar;
pub use model::Resolution;
pub use model::RiskPlan;
pub use model::Source;
pub use model::SupportResistanceZone;
pub use model::ZoneKind;
pub use parity::ParityFixture;
pub use parity::ParityFixtureError;
pub use parity::ParityFixtureRow;
pub use parity::ParityOutcome;
pub use parity::ParityReport;
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::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::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 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;

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 — WebhookNotificationSink takes the actual transport as an injected closure instead.
artifact
Shared, typed result/artifact models (pivots, zones, profiles, scenarios). Shared, typed result/artifact models for indicator outputs.
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.
engine
Market-context and execution-support calculations. Composite “engine” layer (plan kestrel-chartkit-design-plan.md, Anhang E–G): structures that combine several indicator::* outputs into a higher-level context/state/permission reading, sitting above the per-bar Indicator trait and below scoring::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.
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.
parity
Pine-parity fixture harness: standardized reference-value comparison with timestamp alignment, warmup handling, tolerances, MTF boundaries, and explicit missing values. Pine-parity fixture harness: a standardized way to compare a Rust indicator’s output series against confirmed Pine 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.
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 and linear regression. Rolling statistics primitives for streaming series calculations.
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.
viz
Chart DTOs and static SVG rendering.