Solutions focused on development, testing and deployment of algorithmic trading strategies.
Solutions
- Market access
- Simulation tools
- Data collection
- Consultancy
Features
- Programming language is C++17
- Standardized market access API
- Design is similar to that of microservices
- User code (your trading strategies) must implement event handling
- Framework will manage complexities, e.g. threading, asynchronous messaging, connectivity, download phases, order templates, trading segregation, trading policies, request timeouts, positions, etc.
- Ultra low latency with internal microservice tick-to-trade response time in less than 1 microsecond on top-end hardware
- Samples on GitHub
- Binaries compiled for Conda
- Docker images published to Docker Hub
- Ansible playbook on GitHub
You can find more information on our website or by browsing our online documentation.
The API required by the various Roq developed solutions. By itself, the API offers very little functionality: mainly data structures and utilities.
This document is meant to describe high level design choices. Please refer to roq-samples for how to use.
PROFESSIONAL INVESTORS, ONLY
Automated algorithmic trading is very complex and requires serious investment into hardware, software, research, testing, monitoring and support. In all probability it will be a loss-making activity if you don't invest enough time and money to prepare yourself for live trading.
Typical requirements
- 100% automation
- Intra-day trading
- Latency sensitive strategies
- High Frequency Trading (HFT)
- Market Taking
- Market Making
- Auto Hedging
- Spread Trading (relative value or multi-leg strategies)
- Execution strategies (iceberg, VWAP, etc).
- Simulation of market micro-structure (with probabilistic FIFO execution based on order priority)
- Full control of the technology stack
- Why have you developed this product?
- We see an opportunity to offer a complete trading solution for smaller investement firms. Our solutions offer all the relevant tooling from initial research and testing all the way to the deployment of fully automated trading strategies. Our solutions work well with popular open sourced solutions to allow our clients to reduce total cost of ownership.
- Do I have to sign a contract or NDA to start using your product? Trivial examples, demonstrating how to implement various aspects of trading strategies, are free and can be accessed from GitHub. You can also use the free to download simulator binaries for testing your trading strategies without having to contact us. However, **the gateways are *not* free** and will require a license file issued only after you have entered into a contractual license agreement with us.
- I am not a professional investor, should I use your product? You can always use the API's and our simulation tools to research and test ideas. However, you should partner with a professional investment firm to implement live trading.
- What market access do you support?
-
- Crypto Currencies
- Coinbase/Pro (in progress)
- Deribit/API2 (in progress)
- Chinese markets
- CFFEX/FEMAS (ready)
- Shengli/REM (in progress)
- Crypto Currencies
- How do I obtain the market data needed for historical simulation? Preferably using the gateways to collect data. You are then guaranteed native support and the correct ordering of events during replay. It is also possible to convert third-party data sources to the internal format. Please contact us for further details.
- How is tick-to-trade latency measured?
- From receiving a network packet (or an update event, if using third-party API) to an order action request can be forwarded to the network stack (or a request to the third-party API). We do not include external contributors to latency. In particular: network configuration, hardware configuration, kernel configuration, performance of required third-party API's or performance of specific trading strategies.
- What are the hardware requirements?
- The generic answer: A high-end server with enough cores to support your use case. However, it very much depends on the specific use case. Please contact us to discuss further.
- Why do you not open source the API and gateways?
- An earlier version included an open sourced client API implementation. This, unfortunately, introduced recurring support issues which lead us to the conclusion that all parties are better served with a well defined client API only available in binary form. License and support agreements allows us to invest the ongoing maintenance and support of gateways.
- What is your business model?
- License and support agreements for the gateways.
- Consultancy. For example, implementation of bespoke trading strategies.
Please refer to roq-samples if you need a guide on how to get started with your own strategy implementation.
The benchmark suite was developed to demonstrate resource requirements as well as the performance and monitoring capabilities.
These are the relevant binaries
roq-benchmarkis used to profile key functions- Message encoding/decoding
- String formatting (stream and format operations)
- Other benchmarking useful for selecting e.g. containers
roq-pingis a service used to simulate the key execution paths of a "server"- Broadcast random market data (L2 with a depth of 5)
- Handle order creation requests
- Respond with order creation ack
- Access to internal metrics
roq-pongis a service used to simulate the key execution paths of a "client"- Receive and process market data
- Optionally request order creation
- Access to internal metrics
Internal profiling metrics use the Prometheus Exposition Format.
This section will demonstrate how to install Miniconda.
A Conda environment allows you to install up-to-date binary packages on your development box without requiring root access.
# download the miniconda installer
wget -N https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
# install miniconda (to your home directory)
bash Miniconda3-latest-Linux-x86_64.sh -b -u -p ~/miniconda3
# add roq-trading unstable as a conda channel
cat > ~/miniconda3/.condarc << EOF
channels:
- defaults
- https://roq-trading.com/conda/unstable
- conda-forge
EOFThis section will demonstrate how to activate your Conda environment.
This is how you activate your Conda environment
source ~/miniconda3/bin/activateNote! The following sections will assume you have already activated your Conda environment.
This section will demonstrate how to install the binaries using Conda.
First install the benchmark suite
conda install -y roq-benchmarkYou can test the speed of key functions:
Run the benchmark suite
roq-benchmarkYou should now see something like this
You can also simulate a real network of gateways and clients:
This is our generic test case
The design is meant to be a realistic simulation with regular random market data updates being broadcast from
roq-pingtoroq-pong. It is not a test of maximum throughput since that's not typical for a live trading environment. It is much more important to test for a regular mix of "sleep" and "wake" patterns. For example, cached memory may be evicted during sleep and waking a thread involves an expensive context switch.
This is how to launch the ping service
# launch the ping service
# - dispatch thread pinned to core #1
# - market data thread pinned to core #2
# - metrics exposed to port 1234 (on localhost)
ROQ_v=1 roq-ping \
--name "server-1" \
--dispatcher-affinity 1 \
--market-data-affinity 2 \
--metrics 1234 \
--listen ~/ping.sock
ROQ_v=1sets an environment variable used to specify the verbosity of application logging. You may drop this part from the command-line (or useROQ_v=0) to only generate minimal logging.Verbose logging can be very costly, though. The previous section describing
roq-benchmarkwill give you more information about the "cost" of typical messages being logged.
Now open another terminal (same host) and activate your Miniconda environment.
This is how to launch the pong service
# launch the pong service
# - dispatch thread pinned to core #3
# - metrics exposed to port 1234 (on localhost)
# - create an order request on each market data update
ROQ_v=1 roq-pong \
--name "client-1" \
--dispatcher-affinity 3 \
--create-orders 1 \
--metrics 2345 \
~/ping.sockYou can query for profiling metrics
# query the ping service
wget -q -O - http://localhost:1234/metrics | lessor
# query the pong service
wget -q -O - http://localhost:2345/metrics | lessYou should see something like this
Refer to Prometheus Exposition Format.
This section will demonstrate how to provision a server using the Ansible playbook.
This is the test case
Requirements
- Physical access (not a VM)
- At least 8 physical cores
- CentOS/7 or Ubuntu 18.04
- An
ansiblesudo user with ssh access rights
For better results
- Add
isolcpus=1-6to/proc/cmdlineand reboot the server. - Disable hyper-threading in the BIOS.
- Tune your system for low latency performance,
e.g.
tuned-adm profile network-latency.
The Ansible playbook has the following steps
- Configure the server for low latency performance
- Install benchmark application configurations, application launch scripts and systemd service scripts
- Install Prometheus, Grafana and Nginx (using Docker)
You don't need this step if recent versions of git and ansible are available on your system.
The assumption is that you have already activated your Conda environment (details above).
conda install -y git ansibleThe assumption here is that you're running the playbook from the host (
ansible_host="localhost") you want to provision and that the ansible user (ansible_user="ansible") user already exists and it has been givensudorights.
# clone the roq playbook
git clone https://github.com/roq-trading/roq-ansible
# change into the new directory
cd roq-ansible
# define your inventory
# note! you can replace "localhost" with your server's network address
cat > server << EOF
[SERVER]
server ansible_host="localhost" ansible_user="ansible" become_user="root"
[roq_benchmark]
server
EOFansible-playbook -i server site.yml --ask-become-passAt this point you should log on to the host you have installed to.
sudo systemctl start roq-ping-1
sudo systemctl start roq-ping-2
sudo systemctl start roq-pong-1
sudo systemctl start roq-pong-2You should now see core 1-6 consume 100% CPU (if everything was installed correctly)
You can tail the logs
sudo journalctl -f -u roq-p[io]ng-[12]*Navigate to this URL using your favourite browser
http://localhost/grafana/
Remember to replace
localhostwith your server's network address
Find the pre-installed roq-benchmark (ping-pong) dashboard and you
should now be able to monitor latency distributions like this
These metrics are collected from an Atom C3758 8-core processor.





