# API 参考 TechKit 为不同使用场景提供多种 API: ## API 层次 ```{mermaid} graph TB A[Python API] --> E[C++ Core] B[Node.js Native] --> E C[WebAssembly] --> E D[C API] --> E subgraph "High-Level APIs" A B C end subgraph "Low-Level APIs" D E end ``` ## 选择您的 API | API | 适用场景 | 性能 | 易用性 | |-----|----------|------|--------| | [Python](python-api) | 数据分析、回测 | ⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | | [Node.js](nodejs-api) | 服务端、实时处理 | ⭐⭐⭐⭐ | ⭐⭐⭐⭐ | | [浏览器/WASM](nodejs-api) | Web 应用、图表 | ⭐⭐⭐ | ⭐⭐⭐⭐ | | [C++](cpp-api) | 原生应用、极致性能 | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ | | [C ABI](c-api) | 语言绑定、嵌入 | ⭐⭐⭐⭐⭐ | ⭐⭐ | ## 通用模式 所有 API 共享以下概念: ### 结果类型 ```python # Single value class Result: value: float # Calculated value valid: bool # True if warmup complete # Multi-output (MACD, BBands, etc.) class MACDResult: macd: float signal: float histogram: float valid: bool ``` ### 生命周期 1. **创建** - 使用参数实例化 2. **更新** - 增量输入数据,或 3. **计算** - 批量处理数据 4. **重置** - 清除状态以便重用 5. **销毁** - 自动(Python/C++)或显式(C) ```{toctree} :maxdepth: 2 python-api nodejs-api c-api cpp-api ```