Skip to content

Guide · Agent skill

How to use the vnpy Strategy Exporter agent skill (vnpy-export)

Updated · written with AI from the project's own documentation and checked against our catalogue data

The vnpy-export skill is an agent skill that takes a trading strategy built and backtested in Vibe-Trading and rewrites it as a Python class following vnpy's CtaTemplate format. This guide is for people who may never have used agent skills before. By the end you will know how to install the skill, how to ask for an export, what files it produces, and what to check before running the result.

vnpy Strategy ExporterHKUDS/Vibe-Trading · MIT

Quick start

  1. 1Download the ZIP. Download the vnpy-export skill ZIP from this page.
  2. 2Unzip into a skills folder. Unzip it into ~/.claude/skills/ for all projects, or into .claude/skills/ inside one project. In the Claude apps, upload the ZIP under Settings → Capabilities → Skills instead.
  3. 3Install vnpy dependencies. Install Python, vnpy and vnpy_ctastrategy. Add vnpy_ctp or vnpy_tts only if you plan to connect to a broker or paper trading.
  4. 4Ask for an export. Point the agent at your Vibe-Trading run directory and ask it to export the strategy to vnpy, or describe the strategy in plain language.
  5. 5Review the output file. Open artifacts/vnpy_strategy/<StrategyName>Strategy.py and check the signal logic, position handling and parameters against your original strategy.
  6. 6Backtest, then paper-trade. Load the file into the vnpy CTA Strategy App, run a backtest, and paper-trade before using real money.

What the vnpy-export skill makes the agent do

An agent skill is a set of instructions and files that an AI agent can load when a request matches the skill's purpose. This one covers a narrow job: converting a Vibe-Trading strategy into a vnpy CtaTemplate subclass, which is a Python file that the vnpy CTA Strategy App can load for backtesting or live trading.

The skill supports two workflows. In export mode, the agent reads a Vibe-Trading run directory (config.json and code/signal_engine.py), translates the signal logic, and saves the result. In generate mode, the agent writes a CtaTemplate class from a plain-language description of your strategy. In both cases the output is saved to artifacts/vnpy_strategy/ with a name ending in Strategy.py.

  • Reads config.json for instrument, dates, parameters and interval
  • Maps indicators such as moving averages, RSI, MACD and Bollinger Bands to vnpy ArrayManager functions
  • Covers A-share stocks, futures and crypto, each with its own conventions

Install the vnpy-export skill

Download the skill ZIP from this page. You can install it in one of three places, depending on whether you want it for all your projects or just one.

To make it available in every project, unzip the file into ~/.claude/skills/. To make it available only inside one project, unzip it into that project's .claude/skills/ folder. In the Claude apps, you can instead upload the ZIP under Settings → Capabilities → Skills.

  • Personal install: ~/.claude/skills/
  • Project install: .claude/skills/ inside your project folder
  • Claude apps: Settings → Capabilities → Skills, then upload the ZIP

Ask for an export with a natural request

You do not need a special syntax. The skill is meant to be triggered when you ask to export to vnpy, when you use a /vnpy command, or when you want a Vibe-Trading strategy to run inside vnpy's CTA backtester or live trading engine. Point the agent at your run directory so it can read the strategy files.

If you have no run directory, describe the strategy in words, including the instrument, the entry and exit rules, and the parameters. The agent will then use the generate workflow instead.

  • Export from a run: export this Vibe-Trading run to vnpy
  • Generate from text: write a vnpy CTA strategy that buys when the 10-bar average crosses above the 30-bar average on IF2406
  • Slash command: /vnpy with your run details

What the output file contains

The generated class subclasses CtaTemplate and includes the methods vnpy expects: on_init, on_start, on_stop, on_tick, on_bar, on_order, on_trade and on_stop_order. Tick data is forwarded to a BarGenerator, and indicator calculations run through an ArrayManager. The generated on_bar starts by cancelling existing orders and ends by refreshing the UI.

The skill's guide notes that stocks use only buy and sell, while futures and crypto can also use short and cover. It also says ArrayManager should be preferred over pandas when an equivalent method exists. The file path is shown below so you know where to look after the agent finishes.

  • Stocks: buy and sell only, unless you have a margin account
  • Futures and crypto: buy, sell, short and cover
artifacts/vnpy_strategy/<StrategyName>Strategy.py

Check, test and only then go live

The skill generates code but does not verify that signals are correct or that orders behave as intended. The generated class can place real orders once it is loaded into vnpy with a connected account, so review the signal logic line by line before loading it.

Backtest the class in vnpy's CTA backtester first, then paper-trade if you can. Connecting to a broker or paper trading needs separate software and credentials, such as vnpy_ctp or vnpy_tts, which are not part of this skill.

  • Read the on_bar logic and compare it with signal_engine.py
  • Run a backtest in the vnpy CTA backtester
  • Paper-trade before any real capital is used
  • Keep broker credentials out of the strategy file

What people use it for

  • Moving a Vibe-Trading moving-average crossover strategy into vnpy for a backtest on A-share stocks
  • Creating a vnpy CTA template for a futures contract from a short written description
  • Translating RSI or MACD entry rules into ArrayManager calls for a crypto strategy
  • Starting from the included MA crossover example and adapting its parameters

Frequently asked questions

How do I install the vnpy-export skill?

Download the ZIP from this page and unzip it into ~/.claude/skills/ for all projects, or into a project's .claude/skills/ folder. In the Claude apps, you can upload the ZIP under Settings → Capabilities → Skills.

What do I need to run the code this skill generates?

You need Python, vnpy and vnpy_ctastrategy, which is installed with pip. vnpy_ctp or vnpy_tts is optional and only needed for connecting to a broker or paper trading. Export mode also needs a Vibe-Trading run directory with config.json and code/signal_engine.py.

Is the vnpy-export skill free and what is its licence?

The source for this skill is listed under the MIT licence. The page does not list any price for the skill itself, so check the page for current terms.

Does the skill run scripts or use the network?

According to this page, the skill does not run scripts and does not use the network. It does include scripts/cta_template.py as a reference file. Connecting vnpy to a broker is a separate step outside the skill.

Can I use vnpy-export with platforms other than vnpy?

No. The output is written for vnpy's CtaTemplate API, so it will not run on other trading platforms without rewriting.

Is the generated strategy safe to run with real money?

Not without testing. The skill does not check that signals are correct or that orders behave as intended, and the generated code can place real orders. Backtest and paper-trade the strategy, and review it carefully before any live use.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

Use vnpy-export if you already prototype strategies in Vibe-Trading and want a vnpy CTA starting point, or if you want a template from a plain description and can read Python. Pick something else if you have no trading or Python background, or if you use a platform other than vnpy, since the output is specific to CtaTemplate.

Download the skill