VeighNa is a Python-based open-source quantitative trading system development framework, officially released in January 2015. It has grown into a full-featured quantitative trading platform with 6 years of continuous contributions from the open-source community. Currently, it has many users from domestic and international financial institutions, including hedge funds, investment banks, futures brokers, university research institutions, proprietary trading companies, etc.
This Repository is a fork of the original VeighNa project. The UI of VnTrader is translated to English, and the code is modified to support global exchanges and crypto markets. This fork contains custom strategies and trading bots used in global exchanges.
- Supported system versions: Windows 10 or above/Windows Server 2016 or above/Ubuntu 20.04 LTS
- Supported Python version: Python 3.7 64-bit or higher.
-
Install Anaconda: Download and install Anaconda from the official website: https://www.anaconda.com/products/individual
-
Create a virtual environment:
conda create --name myenv python=3.9
This will create a new virtual environment named
myenv
with Python 3.9 installed. -
Activate the virtual environment:
conda activate myenv
-
Clone this repository:
git clone https://github.com/anchorblock/vnpy_trader.git
-
Change directory: Change to the cloned repository directory using the following command:
cd vnpy_trader
-
Install vnpy
Windows
install.bat
Ubuntu
. install.sh
Macos
bash install_osx.sh
-
After that, run the following command to install the dependent libraries.
pip install -r requirements.txt
-
Install Howtrader: Install Howtrader using the following command:
pip install git+https://github.com/51bitquant/howtrader.git
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():
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()
All of the examples are located in the examples folder, including those from the original VeighNa project.
Here are a few examples:
Example | Description |
---|---|
Ingesting Custom CSVs | Ingesting custom CSVs into the system |
Creating Custom Strategy | Creating custom strategies |
Importing Custom Strategies to Trading Module | Importing custom strategies to the trading module |
Creating Custom Trading Bot | Creating custom trading bots |
Backtesting Strategies | Backtesting strategies |