一键导入
cython-execution-node
Detailed instructions for building, deploying, and managing the Cython Execution Node (Edge Architecture).
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Detailed instructions for building, deploying, and managing the Cython Execution Node (Edge Architecture).
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | cython_execution_node |
| description | Detailed instructions for building, deploying, and managing the Cython Execution Node (Edge Architecture). |
The Cython Execution Node is the high-performance "Edge" runtime for QuanuX. It runs strategies compiled as shared objects (.so) directly against native adapters (DirectAdapter) or via a mesh (NATSAdapter).
core.so): The CPython event loop manager. It loads the strategy, initializes the adapter, and handles the asyncio lifecycle.adapter.so): The Abstract Base Class (ABC) that all strategies program against. Ensures your strategy is portable between "Direct" (Venue) and "Relay" (NATS) modes without code changes.importlib to dynamically load a compiled .so module and instantiate the Strategy class.Strategies are standard Cython classes. They must effectively "duck-type" the Strategy interface (implement on_start, on_tick, etc.).
my_strategy.pyx)# distutils: language = c++
# cython: language_level = 3
from adapter cimport Adapter
import asyncio
class Strategy:
cdef public Adapter adapter
cdef public object config
async def on_start(self, Adapter adapter):
"""Called when the Core has connected to the Adapter."""
self.adapter = adapter
print(f"Strategy Live on: {adapter.name}")
# Subscribe to Symbols through the Adapter abstract interface
await self.adapter.subscribe(["NQ", "ES", "CL"])
async def on_tick(self, dict tick):
"""High-Frequency Data Handler."""
# 'tick' is a dictionary. In future v2, this will be a C-struct pointer for zero-copy.
# Example: Simple Moving Average Logic (Pseudo)
# if tick['symbol'] == "NQ" and tick['price'] > 20000:
# await self.entry_signal(tick)
pass
async def entry_signal(self, tick):
order = {
"symbol": tick['symbol'],
"side": "BUY",
"qty": 1,
"type": "MARKET"
}
res = await self.adapter.place_order(order)
print(f"Order Placed: {res}")
The Node and Strategies must be built in-place for the target architecture (e.g., Linux/ARM64 for Edge, macOS/x64 for Dev).
cd execution-node/cython
python3 setup.py build_ext --inplace
# Generates: core.so, adapter.so, direct_adapter.so, nats_adapter.so
Create a setup_strategy.py for your strategy file:
from setuptools import setup, Extension
from Cython.Build import cythonize
setup(
ext_modules=cythonize(
[Extension("my_strat", ["my_strat.pyx"])],
language_level=3
)
)
Run: python3 setup_strategy.py build_ext --inplace -> Generates my_strat.so.
Running requires a lightweight Python script to bootstrap the Core.
Script (run_node.py):
import asyncio
import sys
from core import Core
from direct_adapter import DirectAdapter
from topstep_ext import TopstepClient # If using Direct Adapter
async def main():
core = Core()
# Configure Adapter (e.g., Direct Topstep)
# In a real scenario, this is config-driven (YAML/JSON)
ts_client = TopstepClient()
adapter = DirectAdapter(venue="topstep", client=ts_client)
core.set_adapter(adapter)
# Load Strategy
core.load_strategy("dist/my_strat.so")
# Execute
await core.run()
if __name__ == "__main__":
asyncio.run(main())
topstep_ext or rithmic_ext in the PYTHONPATH. Connects directly to the venue APIs.orders.new and listens to market.data.>.Use the included CLI test to verify the runtime environment without a strategy:
python3 tests/test_node_cli.py
Expected Output:
MockAdapter Connected
Strategy Started...
MockAdapter Placed Order...
Reference for OS and Kernel parameter optimization on the QuanuX Edge.
Reference for using the QuanuX Control CLI (quanuxctl).
Official Figma Developer MCP integration for QuanuX. Allows agents to inspect designs, extract variables, and generate code from Figma files.
The authoritative "School of Architecture" for building QuanuX Extensions (Sidecars). Enforces the QXP protocol, Go runtime preference, and privacy-first security model.
Instructions for operating and configuring the SignalR Bridge for TopstepX.
Guidelines for adding functions to the AST translation map for QuanuX-Annex duckdb transpiler