Guide · Open source
How to use vnpy: install, run and build quant trading apps
Updated · written with AI from the project's own documentation and checked against our catalogue data
vnpy, also known as VeighNa, is an MIT-licensed, Python-based framework for building quantitative trading software. This guide explains what it contains, what you need before you start, how to clone the project, and which parts to look at first. It is written for readers who can write some Python and have a basic idea of how trading systems work.
Quick start
- 1Check your Python version. Confirm you have Python 3.10 or newer, since the README requires it.
- 2Clone the repository. Run git clone https://github.com/vnpy/vnpy.git in the folder where you want the project.
- 3Read the README and documentation. Follow the README and the project documentation for the remaining installation steps on your platform.
- 4Pick the apps and gateways you need. Review the module list and choose the trading apps, gateways and database adapters that match your project.
- 5Set up a database. Start with SQLite, the default option, unless you have a reason to use another database listed in the README.
- 6Explore the alpha research examples. Open the notebooks in examples/alpha_research to see the Lasso, LightGBM and MLP research workflows.
What vnpy is and who it suits
vnpy (VeighNa) is a Python framework for developers and traders who want to build their own quantitative trading systems. It bundles connections to many trading interfaces, a set of ready-made trading apps such as strategy backtesting, risk management and data management, and a newer vnpy.alpha module for machine-learning-based strategy research.
The README lists Chinese futures and securities markets as its main focus, alongside overseas brokers such as Interactive Brokers. It is a framework to build on, not a finished product you switch on.
- Good fit: Python developers building custom quant systems
- Good fit: researchers who want data, model training, signals and backtests in one workflow
- Poor fit: complete beginners with no Python or trading background, since the README has no beginner walkthrough
- Poor fit: anyone expecting plug-and-play trading or guaranteed returns
What you need before you install vnpy
The README states that Python 3.10 or newer is required, and its badges list Python 3.10 to 3.13. It also lists Windows, Linux and macOS as supported platforms.
Many trading gateways need a broker or data-vendor account and vendor-specific setup. Plan for that before you expect live connections to work.
- Python 3.10 or newer (3.10 to 3.13 per the README badges)
- Windows, Linux or macOS
- A broker or data account if you want to connect a specific gateway
Get the vnpy source code
The README's install instruction is to clone the repository with git. Run the command below in the folder where you want the project to live. Then follow the README and project documentation for the remaining setup steps.
git clone https://github.com/vnpy/vnpy.gitExplore the trading apps and modules
vnpy is organised as a set of modules. The README describes a trader core, gateways for specific markets, trading apps, an API layer, an event engine and database adapters. You can pick the pieces your project needs.
Some useful apps described in the README include cta_strategy for CTA strategy engines, cta_backtester for backtesting with a graphical interface, risk_manager for pre-trade limits, and data_manager for viewing and importing or exporting historical data. Each app is maintained in its own linked repository.
- cta_strategy: CTA strategy engine with fine-grained control over order placement and cancellation
- cta_backtester: strategy backtesting and parameter optimisation in a graphical interface
- risk_manager: rules such as order flow control, order size and cancel counts
- data_manager: browse stored data and import or export CSV files
- web_trader: REST and Websocket web service for browser-based setups
Choose a database for your data
The README says SQLite is the default database option. It is a single-file database that needs no separate server, which suits beginners. MySQL and PostgreSQL are relational options, and QuestDB, TDengine and MongoDB are listed among the other choices.
The README notes that PostgreSQL is recommended only for experienced users.
- SQLite: default, single file, no server to configure
- MySQL: widely used open-source relational database
- PostgreSQL: feature-rich, recommended only for experienced users
- QuestDB, DolphinDB, TDengine, MongoDB: time-series and document options listed in the README
Try the vnpy.alpha research workflow
The vnpy.alpha module is aimed at multi-factor machine-learning strategy research. It has four parts: dataset for feature engineering, model for training predictions, strategy for building signal-based strategies, and lab for managing the research workflow from data to backtest.
The README points to example notebooks in examples/alpha_research. These cover Lasso, LightGBM and MLP workflows. The notebooks are the most concrete starting point the README offers for this module.
- dataset: factor features and data processing helpers
- model: Lasso, LightGBM and MLP model templates
- strategy: cross-sectional and time-series strategy types
- lab: data management, training, signal generation and backtesting
What people use it for
- Building a custom CTA futures strategy with the cta_strategy engine and testing it in cta_backtester
- Running a multi-contract portfolio strategy with the portfolio_strategy module
- Researching machine-learning factor strategies with the vnpy.alpha dataset, model and lab components
- Storing and reviewing historical market data with data_manager and SQLite
- Enforcing pre-trade limits with risk_manager in an automated setup
Frequently asked questions
Is vnpy free and open source?
The README lists vnpy under the MIT licence, which is an open-source licence. Some gateways and data services are separate projects with their own terms, so check each one before use.
What Python version does vnpy need?
The README says Python 3.10 or newer is required. Its badges list Python 3.10 to 3.13.
How do I install vnpy?
The README's install step is to clone the repository with git clone https://github.com/vnpy/vnpy.git. The source does not give a full install walkthrough, so follow the project documentation for the rest.
Does vnpy work on Windows, Linux and macOS?
The README badges list windows, linux and macos as the supported platforms.
Is vnpy good for beginners?
The README does not include a beginner walkthrough, and many gateways need broker accounts and setup. It suits people who can code in Python and understand trading systems.
How does vnpy compare with Backtrader, Zipline, QuantConnect Lean or Qlib?
The source does not compare these projects directly. vnpy's README focuses on a modular framework with trading apps, gateways and database adapters, and its alpha module credits Microsoft's Qlib as an inspiration.
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
vnpy suits Python developers and quant researchers who want a modular framework for building custom trading systems, especially in Chinese futures and securities markets. Beginners without Python or trading experience, and anyone wanting a turnkey product or guaranteed returns, should look elsewhere.
Install options & downloads