kestrel-chartkitv0.11.3

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

fncatalog
pub fn catalog() -> Vec<IndicatorCatalogEntry>

Every registered indicator with name, description and default parameters.

fnoutput_unit
pub fn output_unit(name: &str) -> IndicatorUnit

What 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.

fnbuild_checked
pub 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.
traitIndicator
pub 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

fnclassify_regime
pub fn classify_regime(bars: &[Bar], adx_val: f64, atr_val: f64) -> MarketRegime

Parameters

bars
&[Bar]
History up to the current bar; at least 21 bars.
adx_val
f64
Current ADX value.
atr_val
f64
Current ATR as a fraction of price (ATR / close).

Composite scoring

fnscore_indicator
pub fn score_indicator(name: &str, output: &IndicatorOutput, alerts: &[IndicatorAlert]) -> SubScore
fnaggregate_subscores
pub fn aggregate_subscores(
  subscores: Vec<SubScore>,
  weights: Option<&HashMap<String, f64>>,
  regime: MarketRegime,
  sr_zones: Vec<SupportResistanceZone>,
  latest_bar: Option<&Bar>,
  atr_val: f64,
) -> CompositeSignal

See Composite scoring for thresholds and grades.

SVG

fnviz::render_chart_svg
pub fn render_chart_svg(data: &ChartRenderData, width: u32, height: u32) -> String
fnviz::render_scene_svg
pub fn render_scene_svg(scene: &Scene, width: u32, height: u32, theme: &Theme) -> String

See 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.

Edit this page on GitHub · Docs for v0.11.3