• This repository has been archived on 13/Feb/2020
  • Stars
    star
    522
  • Rank 84,811 (Top 2 %)
  • Language
    Rust
  • License
    MIT License
  • Created about 8 years ago
  • Updated almost 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Low-latency algorithmic trading platform written in Rust

TickGrinder Algorithmic Trading Platform

Join the chat at https://gitter.im/TickGrinder/Lobby

TickGrinder is a high performance algorithmic trading platform written primarily in Rust. It is designed with the goal of efficiently processing event-based market data as quickly as possible in order to automatically place and manage trades.

Currently this platform is only compiles and runs on Linux-based systems. Windows functionality is planned for the future but no set schedule has been defined for its implementation.

Overview

The basis of the platform is written in Rust. It consists of several distinct modules that operate independently but communicate with each other via a custom messaging protocol implemented on top of Redis Pub/Sub. It is designed to be extensible and robust, capable of being used to trade any market consisting of event-based streaming Tick data.

Disclaimer: This platform is currently in active, early pre-alpha development and is in no way ready for any kind of trading. I do not take any responsibility for your trading actions using this platform nor any financial losses caused by errors in this application.

Tick Processors

The primary module is the Tick Processor. Multiple tick processors can be spawned, one for each symbol/data stream that is being processed by the platform. Their purpose is to convert live data into trading signals as quickly as possible.

Each time a tick arrives, a series of conditions are evaluated. These conditions can be anything: a SMA crossing a threshold, the current timestamp being greater than a certain number, any evaluable expression that you can program can serve as a condition. These conditions are designed to be dynamically set by the Optimizer module during trading operations.

Optimizer/Strategies

The Optimizer is a module that controls the conditions evaluated by the Tick Processors to open trades and interact with the broker API. Only one Optimizer is meant to run at once and it interacts with all Tick Processors that may be alive in the platform.

Optimizers, using whatever strategies you define, set the parameters and enable/disable trading conditions on the Tick Processors dynamically. They accomplish this by sending and receiving Commands to and from the Tick Processors, interacting with the database, or using any external data sources you may find useful. This application currently uses PostgreSQL as the main storage backend.

The strategies that are evaluated by the optimizer are meant to be written by you, the user! I'm keeping my strategies secret, but I will provide a sample strategy in the future for reference.

MM (Management/Monitoring) Interface

The MM is the interface between the platform and the user. It contains controls for manually managing platform components, monitoring bot activity, starting backtests, and pretty much everything else. It exists in the format of a simple NodeJS Express webserver and talks with the main communication system of the platform using a Websocket<->Redis bridge system.

It includes a custom charting module using Highcharts that can be extended with custom indicators to produce truly specialized charts for bot data. The configurations for these charts can be compiled down into JSON-encoded Macro strings which can then be loaded to instantly re-create charts with unique data sources and settings.

Broker APIs + Data Downloaders

Several scripts/utilities are included to interact with the FXCM Foreign Exchange API to create a live data feed and access historical market data. Using scripts located in the tick_writer and data_downloaders directories, this application can be controlled through Redis and used as a primary data source for the trading platform.

The data downloader script saves tick data for a currency pair into CSV files, downloading chunks of data automatically. The tick writer script does the same thing but processes live ticks sent over Redis instead. As I mentioned before, more detailed documentation can be found in the respective directories.

Installation

Requirements:

  • Rust/Cargo Nightly
  • NodeJS v5.0.0 or greater
  • Redis
  • PostgreSQL
  • libboost headers (sudo apt-get install libboost-all-dev)

After cloning the repository, you'll need to copy all instances of files named conf.default.rs, conf.sample.js, or anything similar to conf.js/rs in the same directory and fill out their values as appropriate.

After ensuring that you have a Redis and PostgreSQL server running and accessible to the program, you can make sure that everything is set up correctly by running make test in the root directory of the project. This will automatically pull down all needed dependencies, attempt to build all modules, and run all included tests. Any encountered errors will be printed to the console and you can use them to debug any issues you're having with the setup.

To use the live trading and data downloading functionalities, you'll need to set up the FXCM Java Application (located in the TickRecorder directory). Detailed setup and installation instructions for that are located in that folder. Documentation for the data downloader and tick_writer scripts can also be found in their respective directories.

Contributing

This is an open source project project, so you're more than welcome to fork it and customize it for your own needs.

As for contributing to master, I'm very happy to merge pull requests containing syntax improvements, bugfixes, or small stuff like that. However, for more significant things such as rewriting large segments of code or adding new features, please file an Issue or contact me privately before putting a lot of work in.

In addition, I will not accept any pull requests solely consisting of stylistic changes such as running files through rustfmt or linting the platform with Clippy. I'm aware that some of the choices in syntax and style I've used aren't 100% "rusty," but I made the choices I made for a reason. Things like fixing typos, adding in more clear or detailed comments/documentation, or re-implementing functions in a more concise or efficient method are very welcome, however.

Closing Remarks

If you've got any feedback or comments on the project, I'd love to hear it! I'm always working on developing my skills as a programmer, so any sage advice from seasoned veterans (or questions from eager beginners) are very welcome.

If you find this project useful, exciting, or have plans to use this in production, please let me know! I'd maybe be willing to work with you to make sure that your needs are met and improve the platform in the process.

More Repositories

1

robintrack

Scrapes the Robinhood API to retrieve + store popularity and price data.
JavaScript
683
star
2

web-synth

A web-based sound synthesis, music production, and audio experimentation platform
TypeScript
350
star
3

three-good-godrays

Screen-space raymarched godrays for three.js using the pmndrs postprocessing library
TypeScript
152
star
4

neural-network-from-scratch

A neural network library written from scratch in Rust along with a web-based application for building + training neural networks + visualizing their outputs
Rust
110
star
5

cryptoviz

A web-based Depth-Of-Market visualization for data of the Poloniex cryptocurrency exchange.
JavaScript
73
star
6

spotifytrack

A personal homepage showing users' top songs and artists, providing a shareable link that they can use to show it off to friends.
TypeScript
65
star
7

rust-cloud-run-demo

A demo project showing off a Google Cloud Run-compatible web server using Rust, Rocket, Diesel, and MySQL
Rust
34
star
8

svelte-todo

Full-stack to-do app to try out SvelteKit. Minimal with SQLite database + HTTP basic auth
TypeScript
25
star
9

osutrack-api

API for osu!track https://ameobea.me/osutrack/
TypeScript
21
star
10

sketches

Various coding experiments and artsy things
Rust
17
star
11

phost

Small project hoster. Can deploy static websites + Dockerfiles and provide a management TUI client.
Python
17
star
12

polotrack

A web-based dashboard for analyzing Poloniex portfolio holdings + trade history to provide useful insights
JavaScript
15
star
13

io-game

A .io game written using Elixir/Phoenix and WebAssembly
Rust
12
star
14

rocket_async_compression

Implements response compression with gzip and brotli via the `async-compression` crate
Rust
11
star
15

noise-asmjs

Uses `noise-rs` library rendered to render noise to a canvas, allowing users to select and configure the utilized noise functions.
JavaScript
11
star
16

rnn-viz

Interactive visualizations and demos that are used in a blog post I wrote about logic in the context of neural networks
Jupyter Notebook
11
star
17

minutiae

Simulation engine involving a 2D universe populated by cells and entities
Rust
10
star
18

osutrack_irc_v2

Utility to provide osu! players with access to osu!track via in the in-game chat system.
JavaScript
7
star
19

FXCMDataDownloader

A Node/Java utility that downloads and stores historical price data from the FXCM API
Java
6
star
20

homepage

My personal website
JavaScript
6
star
21

algobot3

Third iteration of the algorithmic trading bot I've been working on.
JavaScript
5
star
22

ameotrack

Personal data storage and utility platform.
JavaScript
5
star
23

sprout

AI-powered anime recommendation website for MyAnimeList + AniList with other tools, visualizations, and profile analytics
Jupyter Notebook
5
star
24

sketches-3d

Experiments and demos of 3D game-like things. Mostly using Blender + Three.JS with custom shaders and interactive bits.
TypeScript
5
star
25

jantix

A fully-featured TypeScript library defining a modular, self-contained, 100% type-safe Redux architecture
TypeScript
4
star
26

GAWTrack

Events history tracker for GAW cloud miners.
PHP
4
star
27

algobot_elixir

Second iteration of the forex trader bot implemented in elixir
Elixir
4
star
28

advent-of-code-2018

https://adventofcode.com/
Rust
3
star
29

bot4

REPOSITORY MOVED -> https://github.com/ameobea/tickgrinder
2
star
30

paper_parser

Processes scientific papers and determines regions of interest in them.
Python
2
star
31

rust-stackdriver-logging-utils

Utilities and functions that make logging to Google Stackdriver from Rust using fern easier.
Rust
2
star
32

network_research

Misc. files and scripts used for network research
Python
2
star
33

snapmeo

A screenshotter and image uploader for my personal file hosting platform.
Rust
1
star
34

kouffee-bot

Bot for the discord server
TypeScript
1
star
35

hazbin

Website that randomly picks images from my personal collection of screenshots from the pilot episode of Hazbin Hotel. I have hundreds.
JavaScript
1
star
36

amc-web-ui

Main repository for the AutoMultipleChoice-based application being built for CS358
Python
1
star
37

bittrex-orderbook-importer

imports orderbook updates from bittrex
JavaScript
1
star
38

mysql-log-visualization

Tool for creating a live, web-based visualization of a MySQL server's activity.
Rust
1
star
39

Calculator-Programs

A collection of TI graphing calculator programs made by me during my early years of programming.
1
star
40

quavertrack

Quavertrack is a tool for tracking your stats progression in the rhythm game Quaver, allowing you to see how you and other players improve over time.
TypeScript
1
star
41

algobot

Algorithmic trading platform
JavaScript
1
star