API overview
The entry points used in these docs. Root-level re-exports are the preferred API; item-level documentation is generated by rustdoc.
Note
The generated documentation for every public item is on
docs.rs, including the optional calendar module. For an
unreleased state, run cargo doc --open in a clone of the repository.
Indicators
catalogpub fn catalog() -> Vec<IndicatorCatalogEntry>Every registered indicator with name, description and default parameters.
output_unitpub fn output_unit(name: &str) -> IndicatorUnitWhat an indicator’s primary output is quoted in: Price, Ratio, Volume or Unitless.
Price means a price level and belongs on the price axis; everything else needs its own scale.
Unknown names return Unitless.
build_checkedpub fn build_checked(
name: &str,
params: &HashMap<String, f64>,
) -> Result<Box<dyn Indicator>, RegistryError>Parameters
name&str- A name from catalog(), e.g. "rsi".
params&HashMap<String, f64>- Parameter overrides. Missing keys take the defaults.
Indicatorpub trait Indicator: Send + Sync {
fn on_bar(&mut self, bar: &Bar) -> Option<IndicatorOutput>;
fn on_checked_bar(&mut self, bar: &Bar) -> Result<Option<IndicatorOutput>, BarValidationError>;
fn alerts(&self) -> Vec<IndicatorAlert>;
fn warmup_period(&self) -> usize;
fn reset(&mut self);
}See Indicators for the output fields.
Market regime
classify_regimepub fn classify_regime(bars: &[Bar], adx_val: f64, atr_val: f64) -> MarketRegimeParameters
bars&[Bar]- History up to the current bar; at least 21 bars.
adx_valf64- Current ADX value.
atr_valf64- Current ATR as a fraction of price (ATR / close).
Composite scoring
score_indicatorpub fn score_indicator(name: &str, output: &IndicatorOutput, alerts: &[IndicatorAlert]) -> SubScoreaggregate_subscorespub fn aggregate_subscores(
subscores: Vec<SubScore>,
weights: Option<&HashMap<String, f64>>,
regime: MarketRegime,
sr_zones: Vec<SupportResistanceZone>,
latest_bar: Option<&Bar>,
atr_val: f64,
) -> CompositeSignalSee Composite scoring for thresholds and grades.
SVG
viz::render_chart_svgpub fn render_chart_svg(data: &ChartRenderData, width: u32, height: u32) -> Stringviz::render_scene_svgpub fn render_scene_svg(scene: &Scene, width: u32, height: u32, theme: &Theme) -> StringSee SVG charts.
Beyond these docs
The crate also exports trade statistics (stats, evaluation), option and bond valuation
(option, finance, valuation), portfolio risk and stress (portfolio, risk, stress),
bar transforms such as Heikin-Ashi (transform) and the optional exchange calendar (calendar).
The README gives an overview.