VeighNa is a Python-based open source quantitative trading system development framework, in the open source community's continuous contribution to grow step by step into a multi-functional quantitative trading platform, since its release has accumulated a large number of users from financial institutions or related fields, including private equity funds, securities firms, futures companies and so on.
If you have any questions in the process of using VeighNa for secondary development (strategies, modules, etc.), please check the VeighNa Project Documentation, and if you can't solve it, please go to the Official Community Forum for help, and you are welcome to share your experience in the [Experience Sharing] section!
For VeighNa's financial institution users, a special [VeighNa Institutional User Group] (QQ Group No.: 676499931) has been created to share issues related to institutional applications, such as: interbank market access, asset management O32 system, distributed deployment and other content. Please note that this group is only open to financial institution users, when adding the group, please specify: name - organization - department.
-
Multi-functional quantitative trading platform (trader), integrated with a variety of trading interfaces, and for the development of specific strategies algorithms and functions to provide a simple and easy to use API for the rapid construction of quantitative trading applications required by traders.
-
Covering the following trading brokers:
-
Domestic market
-
CTP (ctp): domestic futures, options
-
CTP Mini (mini): domestic futures, options
-
CTP Securities (sopt): ETF options
-
Pegasus (femas): domestic futures
-
Hang Seng UFT (uft): domestic futures, ETF options
-
eSun (esunny): domestic futures, gold TD
-
Vertex Feitron (sec): ETF options
-
Vertex HTS (hts): ETF options
-
Zhongtai XTP (xtp): domestic securities (A shares), ETF options
-
Huaxin Chips (tora): domestic securities (A shares), ETF options
-
Guotai Junan (hft): domestic securities (A shares, two financing)
-
Dongshi OST (ost): domestic securities (A shares)
-
Oriental Wealth EMT (emt): domestic securities (A shares)
-
Flying Mouse (sgit): gold TD, domestic futures
-
Jinshida Gold (ksgold): Gold TD
-
Ronghang (rohon): futures capital management
-
JEES (jees): futures capital management
-
Zhonghui Yida (comstar): interbank market
-
Nuggets (gm): domestic securities (simulation)
-
Hang Seng Cloud UF (uf): domestic securities (simulation)
-
TTS (tts): domestic futures (simulation)
-
Fire Elephant (hx): domestic futures (simulation)
-
-
Overseas Markets
-
Special Applications
-
-
Trading applications (apps) covering the following types of quantitative strategies:
-
cta_strategy: CTA strategy engine module, while maintaining ease-of-use, allows users to control at a fine-grained level (to reduce slippage, realize high-frequency strategies) the reported withdrawal behavior of delegates during the operation of CTA-type strategies.
-
cta_backtester: CTA strategy backtesting module, without the need to use Jupyter Notebook, directly using the graphical interface for strategy backtesting analysis, parameter optimization and other related work.
-
spread_trading: spread trading module, support for customized spreads, real-time calculation of spread quotes and positions, support for spread algorithmic trading and automated spread strategy two models
-
option_master: options trading module, designed for the domestic options market, supports a variety of options pricing models, implied volatility surface calculation, Greek value risk tracking and other functions.
-
portfolio_strategy: portfolio strategy module, for simultaneous trading of multi-contract quantitative strategies (Alpha, option arbitrage, etc.), to provide historical data backtesting and real-time auto-trading features
-
algo_trading: algorithmic trading module, provides a variety of commonly used smart trading algorithms: TWAP, Sniper, Iceberg, BestLimit, etc.
-
script_trader: script strategy module, quantitative strategies for the class of multi-subjective and computational task design, but also in the command line to achieve the REPL instruction form of trading, does not support the backtesting feature
-
paper_account: local simulation module, purely localized implementation of the simulation of simulation trading functions, based on the real-time quotes obtained from the trading interface for commission aggregation, to provide commission transaction push and position records
-
chart_wizard: bar chart module, based on RQData data services (futures) or trading interface to obtain historical data, and combined with the Tick push to display real-time market changes.
-
portfolio_manager: portfolio management module, based on independent strategy trading portfolio (sub-accounts), to provide commission transaction record management, automatic tracking of trading positions, and daily profit and loss real-time statistics Functions
-
rpc_service: RPC service module, allowing a process to be started as a server, as a unified quote and transaction routing channel, allowing multiple clients to connect simultaneously, to achieve multi-process distributed system
-
data_manager: historical data management module, through the tree directory to view the database of existing data overview, select any time period data to view the details of the field, support for CSV file data import and export
-
data_recorder: quote recording module, based on the graphical interface for configuration, according to the needs of real-time recording Tick or bar quotes to the database, for strategy backtesting or initialization of the real market
-
excel_rtd: Excel RTD (Real Time Data) real-time data service, based on the pyxll module to realize in Excel to get all kinds of data (quotes, contracts, positions, etc.) in real-time push updates.
-
risk_manager: risk management module, providing statistics and restrictions on rules including transaction flow control, number of orders, active commissions, total number of withdrawals, etc., effectively realizing the front-end risk control function.
-
web_trader: Web service module, designed for B-S architecture requirements, the realization of the Web server to provide active function call (REST) and passive data push (Websocket)
-
-
Python trading API interface encapsulation (api), to provide the above transaction interface for the underlying docking implementation.
-
REST Client (rest): High-performance REST API client based on concurrent asynchronous IO , using the event-message loop programming model , support for high-concurrency real-time transaction request sending
-
Websocket Client (websocket): high-performance Websocket API client based on concurrent asynchronous IO , support and REST Client to share the event loop to run concurrently
-
-
simple and easy to use event-driven engine (event), as the core of the event-driven transaction program.
-
Adapter interface to various types of databases (database):
-
SQL class
-
SQLite (sqlite): lightweight single-file database, without the need to install and configure the data service program, VeighNa's default option for entry-level novice users.
-
MySQL (mysql): mainstream open-source relational database, extremely well documented and replaceable with other NewSQL-compatible implementations (e.g. TiDB)
-
PostgreSQL (postgresql): more feature-rich open source relational database, support for new features through extension plug-ins, only recommended for skilled users
-
-
NoSQL class
-
DolphinDB (dolphindb): a high-performance distributed time-series database for low-latency or real-time tasks with high speed requirements
-
Arctic (arctic): a high-performance financial timing database, using chunked storage, LZ4 compression and other performance optimization schemes to achieve efficient reading and writing of timing data
-
TDengine (taos): distributed, high-performance, SQL-enabled timescale database with built-in caching, streaming computation, data subscription, and other system functions, which can significantly reduce the complexity of research and development and operation and maintenance
-
TimescaleDB (timescaledb): a PostgreSQL-based timescale database, installed as a plug-in extension, supporting automatic partitioning of data by space and time.
-
MongoDB (mongodb): a document-based database based on distributed file storage (bson format), with built-in hot data in-memory caching to provide faster read and write speeds
-
InfluxDB (influxdb): time series database specially designed for TimeSeries Data, columnar data storage to provide high read/write efficiency and peripheral analysis applications.
-
LevelDB (levelldb): a high-performance Key/Value database launched by Google, based on the LSM algorithm to realize the in-process storage engine, supporting billions of levels of massive data.
-
-
-
Adapter interface to the following types of data services (datafeed):
-
MiBasket RQData (rqdata): stocks, futures, options, funds, bonds, gold TDs
-
Hang Seng UData (udata): stocks, futures, options
-
TuShare (tushare): stocks, futures, options, funds
-
Vantage Wind (wind): stocks, futures, funds, bonds
-
Tinysoft Tinysoft (tinysoft): stocks, futures, funds, bonds
-
Flush iFinD (ifind): stocks, futures, funds, bonds
-
Tian Qin TQSDK (tqsdk): futures
-
-
standard component for cross-process communication (rpc) for implementing complex trading systems with distributed deployment.
-
Python high-performance bar chart (chart), support for large data volume chart display and real-time data update function.
-
Community Forum and Zhihu Column, including VeighNa project development tutorials and Python in the field of quantitative trading application research and other content.
-
The official communication group 262656087 (QQ), with strict management (regularly removing members who have been diving for a long time), and the joining fee will be donated to VeighNa community fund.
Note: The above description of the features is based on the description of the document released at the time of listing, there may be subsequent updates or adjustments. If there is any discrepancy between the description of the features and the actual situation, please feel free to contact us via Issue for adjustment.
- We recommend using the Python distribution VeighNa Studio-3.7.0, which is specially built by VeighNa team for quantitative trading, integrating the built-in VeighNa framework and VeighNa Station quantitative management platform. Station quantization management platform, no need to install manually
- Supported system versions: Windows 10+ / Windows Server 2016+ / Ubuntu 20.04 LTS+.
- Supported Python versions: Python 3.7/ 3.8 / 3.9 / 3.10 64-bit (Python 3.10 is recommended)
Download the Release distribution from here, unzip it and run the following command to install it:
Windows
install.bat
Ubuntu
bash install.sh
MacOS
bash install_osx.sh
**Note: setup.cfg lists the dependencies required for VeighNa framework installation, and requirements.txt gives the recommended installation versions of these dependencies. **
-
Register for a CTP simulation account at SimNow and get the broker code and the address of the trading quotes server at this page.
-
Register at VeighNa Community Forum to get VeighNa Station account password (forum account password that is)
-
Launch VeighNa Station (after installing VeighNa Studio, a shortcut will be automatically created on your desktop), enter the account password from the previous step to log in.
-
Click the VeighNa Trader button at the bottom to start your trading!
Caution:
- Do not close VeighNa Station while VeighNa Trader is running (it will exit automatically).
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()
Start VeighNa Trader by running the following command after opening CMD (hold Shift -> right mouse click -> open command window/PowerShell here) in that directory:
python run.py
VeighNa uses Github to host its source code, if you wish to contribute code please use the github PR (Pull Request) process.
-
Create Issue - For larger changes (e.g. new features, major refactoring, etc.) it is recommended to open an issue to discuss them first, and for smaller improvements (e.g. documentation improvements, bugfixes, etc.) just send a PR.
-
Fork VeighNa - Click the Fork button in the upper right corner.
-
Clone your own fork:
git clone https://github.com/$userid/vnpy.git
.- If your fork is outdated, you need to sync it manually: sync method
-
Create your own feature branch from dev:
git checkout -b $my_feature_branch dev
. -
Make changes to $my_feature_branch and push them to your fork.
-
Create a [Pull Request] - here from your fork's $my_feature_branch branch to the main project's dev branch by clicking compare across forks, select the required fork and branch to create PR. 7.
-
Wait for review, need to continue to improve, or be Merge!
When submitting code, please observe the following rules to improve code quality:
- Check your code with flake8 to make sure there are no errors and warnings. just run
flake8
in the project root directory.
MIT