Skip to main content

kestrel_chartkit/
lib.rs

1//! Streaming technical-analysis primitives, regime classification, composite scoring, and SVG
2//! chart exports.
3//!
4//! Most consumers should start with the root re-exports. Concrete indicator and engine modules
5//! remain public for advanced composition; the crate is pre-1.0 and does not yet promise API
6//! stability for those lower-level modules.
7
8/// Provider-neutral data-feed and notification integration contracts (traits), plus
9/// dependency-free reference implementations.
10pub mod adapters;
11/// Shared, typed result/artifact models (pivots, zones, profiles, scenarios).
12pub mod artifact;
13/// IANA-timezone, DST-aware exchange calendars. Requires the `calendar` feature.
14#[cfg(feature = "calendar")]
15pub mod calendar;
16/// Versioned state snapshots for long-running engines.
17pub mod checkpoint;
18/// Deterministic clustering and robust adaptive-threshold primitives.
19pub mod clustering;
20/// Market-context and execution-support calculations.
21pub mod engine;
22/// Evaluation records and aggregate trade statistics.
23pub mod evaluation;
24/// Event/alert enrichment: timestamps, instrument/timeframe context, stable IDs, deduplication.
25pub mod event;
26/// Provider-neutral order/fill simulator: orders, partial fills, pyramiding, costs, position state.
27pub mod execution;
28/// Generic composition graph: typed indicator dependencies, shared intermediate outputs, and
29/// centralized warmup/execution ordering.
30pub mod graph;
31/// Streaming indicators and the validated indicator registry.
32pub mod indicator;
33/// Lower-timeframe (intrabar) child-bar grouping under a higher-timeframe parent bucket.
34pub mod intrabar;
35/// Bar lifecycle events and rollback-safe, idempotent recomputation.
36pub mod lifecycle;
37/// Shared OHLCV and market-domain types.
38pub mod model;
39/// Pine-parity fixture harness: standardized reference-value comparison with timestamp
40/// alignment, warmup handling, tolerances, MTF boundaries, and explicit missing values.
41pub mod parity;
42/// Market-regime classification.
43pub mod regime;
44/// Advanced regime-model building blocks: Markov transitions, persistence, predictability,
45/// hysteretic transitions, and adaptive cycle-length tracking.
46pub mod regime_advanced;
47/// Provider-neutral risk and position-sizing: account risk, leverage/notional limits,
48/// scale-in/out plans, break-even/time-stop rules.
49pub mod risk;
50/// Batch and replay execution over a full bar history.
51pub mod runner;
52/// Generic composite scenario state machine: multi-stage progressions with per-stage expiry and
53/// explicit invalidation.
54pub mod scenario;
55/// Indicator scoring and composite aggregation.
56pub mod scoring;
57/// Historical series sliding lookback and event helpers.
58pub mod series;
59/// Trading session and Opening Range Breakout (ORB) tracking.
60pub mod session;
61/// Composite signal data types.
62pub mod signal;
63/// Rolling statistical primitives and linear regression.
64pub mod stats;
65/// Support and resistance discovery and zone lifecycle.
66pub mod structure;
67/// Deterministic synthetic price series and market pattern generators.
68pub mod synthetic;
69/// Custom timeframe types and OHLCV bar resampling.
70pub mod timeframe;
71/// Chart DTOs and static SVG rendering.
72pub mod viz;
73
74pub use adapters::{
75    DataFeedAdapter, InMemoryDataFeed, LoggingNotificationSink, NotificationEvent,
76    NotificationSeverity, NotificationSink, WebhookNotificationSink,
77};
78pub use artifact::{
79    Artifact, PivotArtifact, ProfileArtifact, ProfileBin, ScenarioArtifact, ZoneArtifact,
80};
81#[cfg(feature = "calendar")]
82pub use calendar::{ExchangeCalendar, SessionSegment};
83pub use checkpoint::{Checkpoint, CheckpointStore};
84pub use clustering::{kmeans_1d, KMeansResult, RobustBand, RollingRobustThreshold};
85pub use event::{AlertDeduplicator, AlertEvent, EventPhase};
86pub use execution::{
87    submit_bracket, ExecutionCosts, Fill, FillSimulator, FillSimulatorConfig, Order, OrderKind,
88    OrderSide, OrderStatus, Position,
89};
90pub use graph::{ComposedNode, CompositionGraph, GraphError, GraphIndicator, Leaf};
91pub use indicator::registry::{
92    build, build_checked, build_typed, catalog, ParamValue, RegistryError, TypedParams,
93};
94pub use indicator::{Indicator, IndicatorAlert, IndicatorOutput};
95pub use intrabar::{IntrabarGroup, IntrabarGrouper};
96pub use lifecycle::{BarLifecycle, LifecycleRunner};
97pub use model::{
98    Bar, BarQuality, BarValidationError, InstrumentMeta, InstrumentMetaError, MarketRegime,
99    QualifiedBar, Resolution, RiskPlan, Source, SupportResistanceZone, ZoneKind,
100};
101pub use parity::{
102    ParityFixture, ParityFixtureError, ParityFixtureRow, ParityOutcome, ParityReport,
103};
104pub use regime::classify_regime;
105pub use regime_advanced::{
106    AdaptiveCycleOutput, AdaptiveCycleTracker, HysteresisBand, HysteresisLevel,
107    PredictabilityTracker, RegimeMarkovModel, RegimePersistenceOutput, RegimePersistenceTracker,
108};
109pub use risk::{
110    position_size, AccountRisk, PositionSizeResult, ScaleInStep, ScaleOutStep, ScalePlan,
111    StopDecision, StopManager,
112};
113pub use runner::{run_batch, run_batch_checked, TimestampedOutput};
114pub use scenario::{ScenarioStateMachine, ScenarioStatus, StageConfig};
115pub use scoring::{
116    aggregate_subscores, aggregate_subscores_with_instrument, score_indicator, WeightPreset,
117};
118pub use series::{CumulativeSum, Series, SeriesEvents};
119pub use session::{SessionConfig, SessionConfigError, SessionTracker};
120pub use signal::{CompositeSignal, PermissionGrade, SignalDirection, SubScore};
121pub use stats::{correlation, linear_regression};
122pub use structure::{find_sr_zones, ManagedZone, ZoneRegistry, ZoneState};
123pub use synthetic::{
124    bos_choch_swing_bars, random_walk_bars, trending_bars, wyckoff_schematic_bars, SimpleRng,
125    SwingDirection, WyckoffGeneratorConfig,
126};
127pub use timeframe::{BarResampler, ConfirmedResampler, Timeframe, TimeframeError};