Skip to main content

Crate volas

Crate volas 

Source
Expand description

§volas

A Rust-backed, OHLCV-shaped DataFrame for candlestick / market time-series, with a technical-indicator directive engine.

volas is intentionally narrow: it is not a general-purpose DataFrame. It targets live OHLCV pipelines — append a new bar, keep indicator columns cached, and recompute only the stale tail (O(lookback + new rows), not O(n)).

This is the umbrella crate. It re-exports the everyday types at the top level and groups the rest under modules:

use volas::{Column, DataFrame};
use volas::directive::{execute, parse};

let df = DataFrame::new(
    vec!["close".to_string()],
    vec![Column::f64(vec![1.0, 2.0, 3.0, 4.0])],
    None,
)?;

// `ma:2` is a 2-period simple moving average over `close`.
let directive = parse("ma:2")?;
let ma = execute(&df, &directive)?;
assert_eq!(ma.len(), 4);
assert_eq!(ma.to_f64_vec()[3], 3.5); // (3.0 + 4.0) / 2

Re-exports§

pub use volas_core as core;

Modules§

compute
Numeric kernels and technical indicators — pure functions over slices, usable without a DataFrame.
directive
The directive engine: parse a directive string (e.g. "ma:20", "macd.signal", "close > open") into an Ast, then [execute] it against a DataFrame to get a Column.
time
Time-frame cumulation (OHLCV resampling): aggregate finer bars into a coarser TimeFrame.

Structs§

DataFrame
A 2-D, column-oriented, time-indexed table. All columns share one index and have equal length (height).
Index
Row labels plus an optional name.
ReadCsvOptions
Options controlling read_csv.
Series
A one-dimensional, named, indexed column.

Enums§

Column
A typed, contiguous column of values. The buffer is Arc-shared (cheap clone) and mutated copy-on-write.
DType
The logical data type of a crate::Column.
IndexKind
The label storage backing an Index.
Label
A single row-index label: an integer / datetime (I64, ns) or a string (Str). It decouples label lookup from the index’s storage so the same .loc / .at / .loc[a:b] / drop paths serve every index kind.
Scalar
The result of a dtype-preserving scalar reduction (Column::sum etc.), carrying the value in its pandas result dtype so the binding can box it as the matching numpy scalar (np.int64 / np.float64 / np.bool_).
TimeFrame
An OHLCV sampling period.
Tz
The timezone attached to a DatetimeIndex. Storage is always UTC epoch-ns; this drives wall-clock conversion only.
VolasError
Errors raised by the volas core. The Python binding maps each variant to a typed exception (see volas-python).

Functions§

read_csv
Read a CSV file into a DataFrame, inferring each column’s dtype (i64 -> f64 -> bool -> str).

Type Aliases§

Result
Convenience result alias used throughout the core.