Quick answer
VeighNa (formerly vn.py) is the most widely used open-source quant trading platform in China. It combines a desktop trader GUI, an event engine, apps such as CtaStrategy and CtaBacktester, and gateways for China futures (CTP), securities, Interactive Brokers and crypto exchanges. Strategies subclass CtaTemplate and receive ticks and bars.
VeighNa (vn.py) at a glance
- Category
- Backtest + live trading engines
- Language
- Python
- License
- MIT
- Does
- Backtesting, Live trading, Optimization
- Markets
- Futures, Options, Stocks, Crypto
- Best for
- China futures and options via CTP, and traders who want a desktop GUI around their algorithms.
- In AlgoGP
- Built-in bridge: add it to any project
Pick it if
China futures and options via CTP, and traders who want a desktop GUI around their algorithms.
Watch out for
Documentation and community are primarily in Chinese.
VeighNa (vn.py) strengths and limitations
Strengths
- Gateways for CTP and many Chinese brokers, plus IB and crypto.
- GUI apps for strategy management, backtesting and risk.
- Large Chinese-language community and documentation.
Limitations
- Documentation and community are primarily in Chinese.
- Windows-first; some gateways are platform-specific.
VeighNa (vn.py) example
pip install vnpy vnpy_ctastrategyfrom vnpy_ctastrategy import CtaTemplate, BarData, BarGenerator, TickData
class Demo(CtaTemplate):
author = "me"
def __init__(self, cta_engine, strategy_name, vt_symbol, setting):
super().__init__(cta_engine, strategy_name, vt_symbol, setting)
self.bg = BarGenerator(self.on_bar)
def on_tick(self, tick: TickData):
self.bg.update_tick(tick)
def on_bar(self, bar: BarData):
if self.pos == 0:
self.buy(bar.close_price, 1)Use VeighNa (vn.py) with AlgoGP
AlgoGP has a built-in VeighNa (vn.py) bridge. Describe the strategy to the copilot and backtest it in AlgoGP, then open the project’s APIs & keys tab and add VeighNa (vn.py) under Frameworks. The project gains these files, saved as a new version and included in every export:
frameworks/algogp_bridge.pyframeworks/tests/test_bridge.pyframeworks/vnpy_cta_strategy.pyrequirements.txtgains:vnpy,vnpy_ctastrategy
Add AlgoGPCtaStrategy in VeighNa’s CtaStrategy or CtaBacktester appVeighNa (vn.py) connects to Interactive Brokers, Binance, OKX, Bybit. Each guide shows how to create the API key, which you can store in the project’s Keys & secrets.
VeighNa (vn.py): frequently asked questions
Is vn.py the same as VeighNa?
Yes. The project was renamed VeighNa; the package and community still use vnpy.
Does VeighNa support Interactive Brokers?
Yes, through the vnpy_ib gateway.
VeighNa (vn.py) alternatives
- QuantConnect LEANC#, PythonThe open-source engine behind QuantConnect: event-driven backtesting and live trading in C# or Python across equities, options, futures, FX and crypto.
- RQAlphaPythonRicequant’s extensible Python backtesting and simulation framework for China A-shares and futures, with a mod system for data and brokers.
- NautilusTraderPython, RustHigh-performance, Rust-core trading platform with a Python API: the same strategy runs in a nanosecond-resolution backtester and live across many venues.
- BacktraderPythonThe classic Python event-driven backtesting library: Cerebro, data feeds, analyzers, sizers and plotting, with live stores for IB and OANDA.
Independent guide. AlgoGP is not affiliated with VeighNa (vn.py). Features, licenses and maintenance change; check the official documentation. Nothing here is investment advice.