londrwus GitHub avatar

hyperliquid-python-ml-to-rust-layer

londrwus

一个 Python 到 Rust 的交易框架,让你保留 Python 中的机器学习栈,而 Rust 核心以可预测的时序、风险检查和逐比特一致的特征验证执行订单。

Stars

4

7 天增长

暂无数据

Fork 数

0

开放 Issue

0

开源协议

MIT

最近更新

2026-07-28

AI 仓库情报摘要
FR-AI / ANALYSIS

为什么值得关注

它挑战了必须将模型重写为 Rust 才能获得速度的假设,证明 Rust 的价值在于确定性执行和无停顿,拥有 70 纳秒的无锁传递和超过 1800 个测试。

适合谁使用

  • 希望在 Python 中保持 ML 开发的同时获得低延迟执行的 Python 机器学习研究人员和量化交易者
  • 寻求可靠、经过测试的算法交易框架的加密货币交易者
  • 对高保证 Python-Rust 交互在延迟敏感系统中的应用感兴趣的开发者
  • 研究交易系统架构的教育工作者和学生

典型使用场景

  • 在 Hyperliquid 测试网上运行基于 ML 的策略(XGBoost、PyTorch)
  • 使用与实盘相同的引擎进行回测,确保逐比特一致的特征计算
  • 部署带有自动熔断和仓位限制的风险控制交易
  • 学习交易系统中确定性无停顿执行的概念

项目优势

  • Python 和 Rust 之间 70 纳秒的无锁共享内存传递
  • 逐比特一致的特征验证确保策略在研究和生产中行为相同
  • 可预测的执行,无垃圾回收暂停;最坏情况接近平均值
  • 全面的测试套件,共 1885 个测试(1196 Rust + 689 Python),并设计为交易所无关

使用前须知

  • 仅在测试网上使用小型 ML 模型测试,尚未用于真实资金交易
  • 目前仅支持 Hyperliquid 交易所(尽管树中已有 Binance 适配器)
  • 需要仔细设置并理解架构,并非对所有用户即插即用

README 快速开始

Hyperliquid: Python ML → Rust Layer

Write your trading strategy in Python. Let Rust execute it.

You keep pandas, scikit-learn, XGBoost and PyTorch. You never rewrite a model in Rust. A Rust core takes your strategy's decisions and turns them into live orders — quickly, predictably, and identically every time.

Codename Axon: the wire that carries a signal from the Python brain to the Rust muscle.


The idea in one picture

flowchart LR
    subgraph PY ["🐍 PYTHON — the brain"]
        direction TB
        A["Market dataarrives"] --> B["Computefeatures"]
        B --> C["Run themodel"]
        C --> D["Decide:hold 0.5 BTC"]
    end

    subgraph RS ["🦀 RUST — the muscle"]
        direction TB
        E["Read thedecision"] --> F["Check therisk limits"]
        F --> G["Build theorder"]
        G --> H["Send it tothe exchange"]
    end

    V(("🏦Hyperliquid"))

    D -.->|"shared memory70 nanoseconds"| E
    H -->|"0.2 – 0.9 seconds"| V

    style PY fill:#e8f0fe,stroke:#4285f4,stroke-width:2px,color:#111
    style RS fill:#fdecea,stroke:#e8710a,stroke-width:2px,color:#111
    style V fill:#e6f4ea,stroke:#34a853,stroke-width:2px,color:#111

Python says what it wants. Rust works out how to get it, and deals with the exchange saying no. Nothing is shared between them that either side can corrupt — decisions cross as fixed-size records in a lock-free queue, one writer, one reader.


Where the time actually goes

This is the part almost everyone gets wrong. Measured on real hardware, not quoted from a blog:

 Python → Rust handoff        70 ns   ▏
 Rust core wake-up cycle     366 µs   ▎
 Exchange round-trip     0.2 – 0.9 s  ████████████████████████████████████████
                                      └─ the exchange is >99.8% of the wait

Put it on a human scale. Suppose the Python→Rust handoff took 1 second:

Then this step……would take
🐍→🦀 Handing the decision to Rust1 second
⏱️ Rust noticing there is work to do1.5 hours
🏦 The exchange confirming your order1 to 5 months

The language boundary is not the bottleneck. It was never going to be. Making it ten times faster would change nothing you could measure.

So why use Rust at all?


Because the point isn't speed. It's never stalling.

An exchange order book is **first-come, firs

项目描述

Write your trading strategy in Python. Let Rust execute it. A venue-agnostic ML execution layer — Hyperliquid is the first adapter.

相关仓库与替代方案

根据分类、Topic 和编程语言匹配的相似项目。

MoonshotAI
精选
MoonshotAI GitHub avatar

Kimi-K3

Kimi K3 is an open-weight, 2.8T-parameter native multimodal agentic model with a 1M-token context window, designed for frontier coding, knowledge work, and reasoning tasks.

AI 与机器学习AI 智能体
3,348
lopopolo
精选
lopopolo GitHub avatar

harness-engineering

Harness Engineering is a methodology for improving coding agent outputs by carefully crafting the environment around them—providing curated context, tools, and executable constraints that encode an organization’s nonfunctional requirements and cumulative lessons.

AI 与机器学习AI 智能体
2,390
slvDev
精选
slvDev GitHub avatar

esp32-ai

A 28.9 million parameter language model runs on an $8 ESP32-S3 microcontroller entirely on-device, generating simple stories at about 9.5 tokens per second.

AI 与机器学习大语言模型
1,960