Skills

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

  1. load_skill("vnpy-export"), read this guide
  2. read_file("config.json"), extract instrument, dates, parameters, interval
  3. read_file("code/signal_engine.py"), understand the Python signal logic
  4. Determine asset class from config.json → choose correct CtaTemplate convention (see below)
  5. Translate signal logic to CtaTemplate using the reference tables
  6. write_file("artifacts/vnpy_strategy/<StrategyName>Strategy.py"), save the output
  7. Return the class in a code block with setup instructions

Workflow: Generate from Description

  1. load_skill("vnpy-export"), read this guide
  2. Write a CtaTemplate class from the user's strategy description
  3. write_file("artifacts/vnpy_strategy/<StrategyName>Strategy.py"), save the output
  4. 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 ClassInstrument Examplevt_symbol FormatPosition Unit
A-share stockPing An Bank000001.SZSEshares (整手, min 100)
FuturesIF2406IF2406.CFFEXlots
CryptoBTC/USDTBTC/USDT.BINANCEcoin units
Read the whole SKILL.md on GitHub

More in Engineering