R quantitative trading and investment platform
- Platform Introduction
- Project Summary
- Participation
- Installation
- Development Environment
- Architecture Diagram
- Todo List
EliteQuant is an open source forever free unified quant trading platform built by quant traders, for quant traders. It is dual listed on both github and gitee.
The word unified carries two features.
- First it’s unified across backtesting and live trading. Just switch the data source to play with real money.
- Second it’s consistent across platforms written in their native langugages. It becomes easy to communicate with peer traders on strategies, ideas, and replicate performances, sparing language details.
Related projects include
- A list of online resources on quantitative modeling, trading, and investment
- C++
- Python
- Matlab
- R
- C#
- Excel
- Java
- Scala
- Kotlin
- Go
- Julia
EliteQuant_R is R based multi-threading, concurrent high-frequency trading platform that provides consistent backtest and live trading solutions. It follows modern design patterns such as event-driven, server/client architect, and loosely-coupled robust distributed system. It follows the same structure and performance metrix as other EliteQuant product line, which makes it easier to share with traders using other languages.
Please feel free to report issues, fork the branch, and create pull requests. Any kind of contributions are welcomed and appreciated. Through shared code architecture, it also helps traders using other languges.
To contribute,
- clone source files
- from RStudio menu, File/Open Project source\EliteQuantR\EliteQuantR.Rproj
- Make changes
- from RStudio menu, Build/Build and Reload the project library
- Make pull request to merge the changes on github
- clone or download the project.
- open RStudio, install some third-party libraries
install.packages("R6") install.packages("Quandl") install.packages("tcltk2") install.packages("yaml") install.packages("rzmq") install.packages("PerformanceAnalytics")
- from RStudio menu Tools/Install Packages/Install from dropdown menu, choose Package Archive File, and browse to source/EliteQuantR_0.1.0.tar.gz
Configure config_backtest.yaml in the strategy directory
- ticker: ticker names that are of interest to you
- datasource: historical data source
- hist_dir: local history data directory
- output_dir: output test results directory
Currently it supports data source from
- Quandl
- Local CSV
More data sources will be added later on. To run sample backtest, enter the following in RStudio
library(EliteQuantR)
setwd('D:/Workspace/EliteQuant_R/strategy') # where you downloaded the project
source('moving.average.cross.strategy.R')
mystrat <- MovingAverageCrossStrategy$new('AMZN')
engine <- BacktestEngine$new(mystrat)
engine$Run()
Go to server folder, configure config.yaml
- If you want to use interactive broker, open IB trader workstation (TWS), go to its menu File/Global Configuration/API/Settings, check "Enable ActiveX and Socket Client", uncheck "Read-Only API"
- In the config file, change the account id to yours; IB account id usually can be found on the top right of the TWS window.
- If you use CTP, change your brokerage account information and ctp addresses accordingly.
- create folder for log_dir and data_dir respectively. The former records runtime logs, while the later saves tick data.
- run eqserver.exe
After that, in RStudio enter the following
setwd('D:/Workspace/EliteQuant_R/server') # where you downloaded the project
LiveEngine()
Interactive Brokers is the most popular broker among retail traders. A lot of retail trading platform such as quantopian, quantconnect are built to support IB. If you don't have IB account but want to try it out, they provide demo account edemo with password demouser. Just download TWS trader workstation and log in with this demo account. Note that accound id changes everytime you log on to TWS with demo account so you have to change EliteQuant config file accordingly.
CTP is the de-facto brokerage for Chinese futures market, including commodity futures and financial futures. They also offer free demo account SimNow. After registration, you will get account, password, brokerid, along with market data and trading broker address. Replace them in EliteQuant config file accordingly.
Below is the environment we are using
- Windows 10
- R v3.4.1
- RStudio v1.0.153
Backtest
Live Trading
Code Structure