General Introduction
VeighNa is a Python-based open source quantitative trading platform originally developed by domestic private traders and officially launched in 2015. It has evolved from a simple trading interface package to a full-featured trading development framework. Users include private equity funds, securities companies, futures companies, university research institutes and individual investors. VeighNa supports a variety of financial products such as stocks, futures, options, foreign exchange, etc., and provides a wealth of trading interfaces and data APIs. it uses an event-driven engine, is simple to operate, and has an active community, with the code hosted on GitHub, following the MIT open source protocol, and is free and open to all to use and modify. Modification.
Function List
- Support a variety of trading interfaces, such as domestic CTP, Pegasus, Jinshida, foreign OANDA, Interactive Brokers and so on.
- Provides an event-driven engine to facilitate the development of automated trading programs.
- Built-in CTA strategy module to support strategy development and backtesting analysis.
- Includes Algorithmic Trading Module that provides smart trading algorithms such as TWAP, Sniper, etc.
- Supports high-performance K-line charts that display market data in real time.
- Provides a cross-process communication component suitable for distributed trading systems.
- Integrated data recording function to save and manage market data.
Using Help
Installation process
VeighNa installation requires some basic environment preparation. The following are the detailed steps:
- Preparing the environment
- Ensure that your computer has Python 3.7 or higher installed, either the official distribution or VN Studio (the integrated environment provided by the VeighNa team) is recommended.
- Install Git for downloading code from GitHub.
- Download source code
Clone the VeighNa repository locally by running the following command in a terminal:
git clone https://github.com/vnpy/vnpy.git
When finished, go to the project catalog:
cd vnpy
- Installation of dependencies
Run it in the project root directory:
pip install -r requirements.txt
This will install the Python libraries required for VeighNa to run. If you need a specific interface (e.g. CTP), you will need to install additional modules, for example:
pip install vnpy_ctp
- running program
Edit configuration files (such as CTP connection information) and then run the main program:
python examples/veighna_trader/run.py
A graphical interface pops up showing the trading window.
Main Functions
1. Connectivity trading interface
- Open the VeighNa main interface, click on the "System" menu and select "Connect Gateway".
- Select the interface (e.g. CTP) as required and enter the account number, password and server address. This information is provided by the broker.
- Click "Connect" and the status bar will show whether it is successful or not.
2. Development and operational strategies
- Select "CTA Strategy" from the "Application" menu.
- Click "Add Policy", enter the name and parameters of the policy, VeighNa comes with sample policies, or you can customize it.
- By clicking "Start", the strategy will run automatically, monitor the market and execute trades.
3. Backtesting analysis
- Open the "CTA Backtest" module and import historical data (CSV or database format is supported).
- Set the backtesting parameters (e.g. timeframe, capital, commission), select a strategy and click "Start Backtesting".
- After backtesting is complete, view the return curve and trading log to analyze the strategy's effectiveness.
4. Data recording
- In the Data Recording module, connect to market data sources.
- Set the recording frequency (e.g. Tick or K-line), click "Start Recording" and the data will be saved to the local database.
Featured Function Operation
Algorithmic trading
- Open the Algorithmic Trading module and select an algorithm (e.g. TWAP).
- Enter the trade target (e.g. quantity, time), click "Start", the system will automatically split the order for execution.
- Parameters can be paused or adjusted at any time, suitable for large transactions.
K-Line Charts
- Click on "Charts" in the main screen to load the market data.
- Supports zooming and dragging, and real-time update of Tick or K-Line for technical analysis.
caveat
- When using it for the first time, it is recommended to test it in a demo account to avoid the risk of live trading.
- Check the network connection to ensure stable transmission of data and trade orders.
- Regularly update VeighNa code for the latest features and fixes:
git pull origin master
application scenario
- Individual investor trading
A retail trader wants to automate futures trading using Python. He can use VeighNa to connect to the CTP interface, write simple strategies, and automate the buying and selling of major contracts. - Institutional quantitative research
Private equity funds need to test new strategies. The team used VeighNa's backtesting module to import historical data and quickly validate the strategy's effectiveness. - Teaching finance in higher education
University professors use VeighNa to demonstrate quantitative trading principles, and students learn strategy development and data analysis through a graphical interface.
QA
- What operating systems does VeighNa support?
Supports Windows 7 and above, Ubuntu 18.04 and above, Mac systems require manual compilation of some interfaces. - How do I contribute code?
fork VeighNa repository on GitHub, make changes, submit Pull Request, and wait for review and merge. - Where does the data come from?
Real-time market data can be accessed through an interface (e.g., Tom Tom Data) or saved with a data recording function.