1 个不稳定版本

0.1.0 2021年2月27日

#828 in 数学

MPL-2.0 许可证

145KB
4K SLoC

ux-indicators

积极开发中

pub struct FlowMeta<'a> {
    pub name: &'a str,
    pub tag: u8,
    pub visible: bool
}

pub struct DataFrame<M, D>
where
    M: fmt::Display,
{
    // metric contain something like a timestamp, or month names
    pub metric: M,
    // data key is tag for stream meta (a.k.a column tag)
    // D is
    pub data: HashMap<u8, D>,
}


lib.rs:

ta 是一个 Rust 技术分析库。它提供了一系列技术指标,可用于构建股票市场、期货、外汇、加密货币等的交易策略。

每个指标都实现为具有字段的数据结构,这些字段定义了参数和状态。

每个指标都实现了 NextReset 特性,这是库的核心概念。

由于 Next<T> 是一个泛型特性,大多数指标都可以与两种输入类型一起工作:f64 和更复杂的数据结构,如 DataItem

示例

use core::indicators::ExponentialMovingAverage;
use core::Next;

// it can return an error, when an invalid length is passed (e.g. 0)
let mut ema = ExponentialMovingAverage::new(3).unwrap();

assert_eq!(ema.next(2.0), 2.0);
assert_eq!(ema.next(5.0), 3.5);
assert_eq!(ema.next(1.0), 2.25);
assert_eq!(ema.next(6.25), 4.25);

指标列表

依赖项

~5.5–7.5MB
~151K SLoC