czsc 1.0.0

★ Recommended entry point ★ — czsc (缠中说禅) facade crate; re-exports the full Rust workspace (core/utils/ta/signals/trader) so a single `cargo add czsc` is enough.
czsc-1.0.0 has been yanked.

czsc

crates.io docs.rs

🚀 这是 czsc 量化分析框架的官方推荐入口(facade crate)。 Rust 用户只需 cargo add czsc 即可获得全部公共 API。

CZSC(缠中说禅)量化分析框架的 Rust 入口。

本 crate 是一个 facade:本身不实现任何功能,只把 czsc Rust workspace 中 的 5 个业务 crate(czsc-core / czsc-utils / czsc-ta / czsc-signals / czsc-trader)汇总到一个 crate 名下,让纯 Rust 用户 不用一行一行加 5 个依赖。

想用 Python 接口?请直接 pip install czsc,那是基于 maturin 编译的 CPython 扩展,与本 facade 同源但接口面不同。

用法

[dependencies]
czsc = "1.0"
use czsc::{CZSC, RawBar, Freq, BarGenerator, is_trading_time};
use czsc::analyze::CZSC as Analyzer;

let bars: Vec<RawBar> = /* ... */;
let analyzer = Analyzer::new(bars, 50);
println!("最新一笔方向: {:?}", analyzer.bi_list.last().map(|b| b.direction));

也可以按子模块组织 import:

use czsc::objects::bi::BI;
use czsc::ta::ema;
use czsc::signals::registry::TRADER_SIGNAL_REGISTRY;
use czsc::trader::{CzscSignals, SignalConfig};

命名空间速查

路径 等价于
czsc::analyze czsc_core::analyze
czsc::objects::* czsc_core::objects::*
czsc::error_chain czsc_core::error_chain
czsc::ta czsc_ta::pure
czsc::bar_generator czsc_utils::bar_generator
czsc::freq_data czsc_utils::freq_data
czsc::trading_time czsc_utils::trading_time
czsc::signals czsc_signals
czsc::trader czsc_trader 的对外公共面

顶层 czsc::* 还直接挂了最常用的核心类型:CZSC / RawBar / NewBar / Freq / FX / BI / ZS / Mark / Direction / Operate / Event / Position / Market / BarGenerator / CzscSignals / SignalConfig / is_trading_time

Features

  • (default) —— 纯 Rust API
  • python —— 透传给 czsc-core / czsc-utils / czsc-ta,给嵌入 PyO3 的下游使用。一般用户不需要

工作区其它 crate

crate 说明
czsc-core 缠论核心数据结构与算法
czsc-utils BarGenerator / freq_data / trading_time
czsc-ta 技术分析算子
czsc-signals 30+ 量化信号函数
czsc-trader 交易引擎与信号编译
czsc-derive 错误派生宏(内部用)
czsc-signal-macros 信号注册宏(内部用)

项目主页