
Vnpy Export
Export a Vibe-Trading backtest strategy to a runnable vnpy CtaTemplate Python class, ...
Install
npx skills add HKUDS/Vibe-Trading --skill vnpy-export -g -a claude-code -y- Repository
- HKUDS/Vibe-Trading37.4k
- Category
- Engineering
- Updated
- 3d ago
- License
- MIT
- Context cost
- Mediumabout 2,816 tokens
- Runs scripts
- Yes, review before use
What it does
Export a Vibe-Trading backtest strategy to a runnable vnpy CtaTemplate Python class, supports A-share equities, futures, and crypto via BarGenerator + ArrayManager.
Overview
This skill translates a Vibe-Trading strategy into a vnpy CtaTemplate subclass .py file
that can be loaded directly into the vnpy CTA Strategy App for live trading or vnpy backtesting.
Output file: artifacts/vnpy_strategy/<StrategyName>Strategy.py (inside the run directory).
vnpy is the most widely-used open-source quant framework in mainland China (39k+ GitHub stars).
Use this skill when the user asks to export to vnpy, requests a /vnpy command, or wants to
run a Vibe-Trading strategy inside vnpy's CTA backtester or live trading engine.
Workflow: Export from Backtest Run
load_skill("vnpy-export"), read this guideread_file("config.json"), extract instrument, dates, parameters, intervalread_file("code/signal_engine.py"), understand the Python signal logic- Determine asset class from
config.json→ choose correct CtaTemplate convention (see below) - Translate signal logic to CtaTemplate using the reference tables
write_file("artifacts/vnpy_strategy/<StrategyName>Strategy.py"), save the output- Return the class in a code block with setup instructions
Workflow: Generate from Description
load_skill("vnpy-export"), read this guide- Write a CtaTemplate class from the user's strategy description
write_file("artifacts/vnpy_strategy/<StrategyName>Strategy.py"), save the output- Return the class with setup and usage instructions
Asset Class Conventions
vnpy uses the same CtaTemplate base class for all asset types, but parameter conventions differ:
| Asset Class | Instrument Example | vt_symbol Format | Position Unit |
|---|---|---|---|
| A-share stock | Ping An Bank | 000001.SZSE | shares (整手, min 100) |
| Futures | IF2406 | IF2406.CFFEX | lots |
| Crypto | BTC/USDT | BTC/USDT.BINANCE | coin units |
