Want to read this in english ? Go here
VeighNa is an open source quantitative trading system development framework based on Python. With continuous contributions from the open source community, it has gradually grown into a multi-functional quantitative trading platform. Since its release, it has accumulated many users from financial institutions or related fields, including private equity. Funds, securities companies, futures companies, etc.
[VeighNa Elite Quantitative Terminal] for professional traders has been officially released, providing perfect support for the needs of professional traders in terms of massive strategy concurrency, intelligent position shifting, algorithm split execution, and multi-account trading support. For more detailed information, please scan the QR code below to follow and click [Community Communication -> Elite Membership Service] in the menu bar :
If you have any questions during the process of using VeighNa for secondary development (strategies, modules, etc.), please check the VeighNa project documentation . If you cannot solve the problem, please go to the [Ask and Help] section of the official community forum for help. You are also welcome to [Experience Sharing] Share your experience using this section!
Want to get more information about VeighNa? Please scan the QR code below to add an assistant to join the [VeighNa community communication WeChat group]:
A multi-functional quantitative trading platform (Trader), which integrates a variety of trading interfaces and provides simple and easy-to-use APIs for specific strategy algorithms and function development, to quickly build quantitative trading applications required by traders.
The trading interface (gateway) covering the following trading products owned at home and abroad:
domestic market
CTP (ctp): Domestic futures and options
CTP Mini (mini): Domestic futures and options
CTP Securities (sopt): ETF options
Femas: domestic futures
Hang Seng UFT (uft): Domestic futures, ETF options
esunny: domestic futures, gold TD
Apex Feichuang (sec): ETF options
Vertex HTS (hts): ETF Options
Zhongtai XTP (xtp): domestic securities (A shares), ETF options
Huaxin Singularity (tora): domestic securities (A shares), ETF options
Guotai Junan (hft): Domestic securities (A shares, financial services)
Topix OST (ost): Domestic securities (A shares)
Oriental Fortune EMT (emt): Domestic Securities (A Shares)
Flying Squirrel (sgit): gold TD, domestic futures
ksgold: Gold TD
Lei Xing Asset Management (lstar): Futures Asset Management
Rohon: Futures Asset Management
jees: futures asset management
Zhonghui Yida (comstar): interbank market
Nuggets (gm): Domestic Securities (Simulation)
Hang Seng Cloud UF (uf): Domestic Securities (Simulation)
TTS (tts): Domestic futures (simulation)
overseas market
Interactive Brokers (ib): overseas securities, futures, options, precious metals, etc.
Yisheng 9.0 external disk (tap): overseas futures
Direct Futures (da): Overseas Futures
Special application
RQData Quotes (rqdata): Real-time quotes across markets (stocks, indices, ETFs, futures)
Xun Touyan Quotes (xt): Real-time quotes across markets (stocks, indices, convertible bonds, ETFs, futures, options)
RPC service (rpc): cross-process communication interface for distributed architectures
Trading applications (apps) covering the following types of quantitative strategies:
cta_strategy: CTA strategy engine module, while maintaining ease of use, allows users to conduct fine-grained control over the commissioned reporting and withdrawal behavior during the operation of CTA strategies (reduce transaction slippage and implement high-frequency strategies)
cta_backtester: CTA strategy backtest module, without using Jupyter Notebook, directly use the graphical interface to perform strategy backtest analysis, parameter optimization and other related work
spread_trading: Spread trading module, supports custom spreads, real-time calculation of spread quotes and positions, supports spread algorithm trading and automatic spread strategy modes
option_master: Options trading module, designed for the domestic options market, supports multiple option pricing models, implied volatility surface calculations, Greek value risk tracking and other functions
portfolio_strategy: Portfolio strategy module, for quantitative strategies (Alpha, option arbitrage, etc.) that trade multiple contracts at the same time, providing historical data backtesting and real-time automatic trading functions
algo_trading: Algorithmic trading module, providing a variety of commonly used intelligent trading algorithms: TWAP, Sniper, Iceberg, BestLimit, etc.
script_trader: script strategy module, designed for multi-standard quantitative strategies and calculation tasks. It can also implement transactions in the form of REPL instructions on the command line. It does not support backtesting.
paper_account: local simulation module, a purely localized simulation trading function, entrusted matching based on real-time market conditions obtained from the trading interface, and provided with entrusted transaction push and position records
chart_wizard: K-line chart module, which obtains historical data based on RQData data service (futures) or trading interface, and displays real-time market changes combined with Tick push
portfolio_manager: The trading portfolio management module, based on independent strategic trading portfolios (sub-accounts), provides commissioned transaction record management, automatic tracking of trading positions, and real-time statistics of daily profits and losses.
rpc_service: RPC service module, which allows a certain process to be started as a server. As a unified market and transaction routing channel, it allows multiple clients to connect at the same time to implement a multi-process distributed system.
data_manager: historical data management module, view the existing data overview in the database through the tree directory, select data in any time period to view field details, support data import and export of CSV files
data_recorder: Market recording module, configured based on the graphical interface, records Tick or K-line market conditions in real time to the database according to needs, for strategy backtesting or real market initialization
excel_rtd: Excel RTD (Real Time Data) real-time data service, based on the pyxll module to obtain real-time push updates of various data (markets, contracts, positions, etc.) in Excel
risk_manager: Risk management module, which provides statistics and restrictions on transaction flow control, order quantity, activity entrustment, total number of order cancellations and other rules, effectively realizing front-end risk control functions.
web_trader: Web service module, designed for BS architecture requirements, implements a Web server that provides active function calls (REST) and passive data push (Websocket)
Python transaction API interface encapsulation (api) provides the underlying docking implementation of the above transaction interface.
REST Client (rest): A high-performance REST API client based on coroutine asynchronous IO, using the event message loop programming model to support high-concurrency real-time transaction request sending
Websocket Client (websocket): A high-performance Websocket API client based on coroutine asynchronous IO, which supports concurrent running of the shared event loop with REST Client.
The simple and easy-to-use event-driven engine (event) serves as the core of the event-driven trading program.
Adapter interface for docking various databases (database):
SQL class
SQLite (sqlite): lightweight single-file database, no need to install and configure data service programs, VeighNa's default option, suitable for novice users
MySQL (mysql): a mainstream open source relational database with extremely rich documentation and can replace other NewSQL compatible implementations (such as TiDB)
PostgreSQL (postgresql): an open source relational database with richer features. It supports new functions through extension plug-ins. It is only recommended for experienced users.
NoSQL class
DolphinDB (dolphindb): a high-performance distributed time series database, suitable for low-latency or real-time tasks with extremely high speed requirements
Arctic (arctic): A high-performance financial time series database that adopts performance optimization solutions such as block storage and LZ4 compression to achieve efficient reading and writing of time series data.
TDengine (taos): a distributed, high-performance, SQL-supported time series database with built-in caching, streaming computing, data subscription and other system functions, which can greatly reduce the complexity of R&D and operation and maintenance.
TimescaleDB (timescaledb): a time series database developed based on PostgreSQL. It is installed as a plug-in extension and supports automatic partitioning of data by space and time.
MongoDB (mongodb): A document database based on distributed file storage (bson format). The built-in hot data memory cache provides faster reading and writing speeds.
InfluxDB (influxdb): A time series database specially designed for TimeSeries Data. Column data storage provides extremely high read and write efficiency and peripheral analysis applications.
LevelDB (leveldb): a high-performance Key/Value database launched by Google. It implements an in-process storage engine based on the LSM algorithm and supports billions of massive data.
Adapter interface (datafeed) for docking the following types of data services:
Xun Investment Research (xt): stocks, futures, options, funds, bonds
MiKang RQData (rqdata): stocks, futures, options, funds, bonds, gold TD
Wing Chun Master (voltrader): futures, options
Hang Seng UData (udata): stocks, futures, options
TuShare (tushare): stocks, futures, options, funds
Wind (wind): stocks, futures, funds, bonds
Tinysoft (tinysoft): stocks, futures, funds, bonds
Flush iFinD (ifind): stocks, futures, funds, bonds
Tianqin TQSDK (tqsdk): Futures
Cross-process communication standard component (rpc), used to implement complex trading systems with distributed deployment.
Python's high-performance K-line chart (chart) supports large data volume chart display and real-time data update functions.
Community forums and Zhihu columns include development tutorials on the VeighNa project and research on the application of Python in the field of quantitative trading.
The official communication group 262656087 (QQ) is strictly managed (members who have been divers for a long time are removed regularly), and the group entry fee will be donated to the VeighNa community fund.
Note: The above description of functional features is based on the situation at the time of release of the documentation, and may be updated or adjusted in the future. If the function description is different from the actual existence, please contact us through Issue for adjustment.
Download the Release version here, unzip it and run the following command to install it:
Windows
install.bat
Ubuntu
bash install.sh
Macos
bash install_osx.sh
Note: The dependent libraries required for VeighNa framework installation are listed in setup.cfg, and the recommended installation versions of these dependent libraries are given in requirements.txt.
Register a CTP simulation account at SimNow and obtain the broker code and trading quotation server address on this page.
Register in the VeighNa Community Forum to obtain the VeighNa Station account and password (the forum account and password are the same)
Start VeighNa Station (a shortcut will be automatically created on the desktop after installing VeighNa Studio), enter the account and password from the previous step to log in
Click the VeighNa Trader button at the bottom to start your trading! ! !
Notice:
In addition to the graphical startup method based on VeighNa Station, you can also create run.py in any directory and write the following sample code:
from vnpy . event import EventEngine
from vnpy . trader . engine import MainEngine
from vnpy . trader . ui import MainWindow , create_qapp
from vnpy_ctp import CtpGateway
from vnpy_ctastrategy import CtaStrategyApp
from vnpy_ctabacktester import CtaBacktesterApp
def main ():
"""Start VeighNa Trader"""
qapp = create_qapp ()
event_engine = EventEngine ()
main_engine = MainEngine ( event_engine )
main_engine . add_gateway ( CtpGateway )
main_engine . add_app ( CtaStrategyApp )
main_engine . add_app ( CtaBacktesterApp )
main_window = MainWindow ( main_engine , event_engine )
main_window . showMaximized ()
qapp . exec ()
if __name__ == "__main__" :
main ()
Open CMD in this directory (hold down Shift->right-click the mouse->open command window/PowerShell here) and run the following command to start VeighNa Trader:
python run.py
VeighNa uses Github to host its source code. If you want to contribute code, please use github's PR (Pull Request) process:
Create an Issue - For larger changes (such as new features, large-scale refactoring, etc.), it is recommended to open an issue to discuss it first. For smaller improvements (such as document improvements, bugfixes, etc.), just send a PR directly.
Fork VeighNa - Click the Fork button in the upper right corner
Clone your own fork: git clone https://github.com/$userid/vnpy.git
Create your own feature branch from dev : git checkout -b $my_feature_branch dev
Modify $my_feature_branch and push the changes to your fork
Create a [Pull Request] from the $my_feature_branch branch of your fork to the dev branch of the main project - click compare across forks here, select the required fork and branch to create a PR
Waiting for review, need to continue to improve, or be merged!
When submitting code, please abide by the following rules to improve code quality:
flake8
in the project root directory. MIT