BTS Spark
Our offering consists of a client UI (Spark Client), a high performance professional futures front end, connected via our proprietary protocol over TCP to our Spark Server, which in turn connects to execution venues via their native protocols (typically FIX/TCP for execution and some proprietary protocol over UDP multicast for market data).
BTS Spark Server SDK
This API extension point is intended for users that require adding functionality to our Spark Server. Using the Spark Server SDK users can create new order types, new market data sources and soon new execution gateways. In this case users implement the new functionality in C++, producing a shared library that is loaded at run time by our Spark Server.
If you are interested in sending orders or otherwise controlling a spark server remotely please see the BTS Spark Client SDK repo.
In Depth
Getting Started
Docker
We use docker to provide a full dev environment with all the tools users need to develop their own algos.
- Setup docker on your preferred OS and pull down the BTS docker
- If you are new to docker you can find out more about it here: https://docs.docker.com/get-started/
$ docker pull bluetradingsystems/linux_docker
- Our docker can also be found here: https://hub.docker.com/r/bluetradingsystems/linux_docker/
- Start the docker container
$ docker run \
--net host \
--shm-size=1024m \
--cap-add=SYS_PTRACE --security-opt seccomp=unconfined \
-w $PWD \
-v /home:/home \
--name bts_sdk \
-i \
-t bluetradingsystems/linux_docker \
/bin/bash
- Note that the lifetime of docker instance above is tied to the life of the shell instance, so if you exit bash, the container stops running. To start and re-attach to the container, use:
$ docker start --attach -i bts_sdk
- If you prefer to run docker as a daemon, check out
~/spark_sdk/sdk_shell.sh
Git
-
We assume the git you are using is git-lfs compatible; if you're using the git that comes with our docker, you're all set.
-
else go here: https://github.com/git-lfs/git-lfs/wiki/Installation
Now that you're ssh'd into the docker container, clone the repo into ~/spark_sdk/ and cd to that directory
$ cd
$ git clone https://github.com/BlueTradingSystems/spark_sdk.git
$ cd spark_sdk
Development
Algo Orders typically implement the IAlgoOrder interface to respond to events and use the IAlgoServices interface to create and control child orders as well as manage their own life cycles. See examples/order_plugin_example.cpp for a fully fledged example
Look at examples/md_publisher_example.cpp to look at how to build a custom market data producer
run build_examples.sh to make sure you can build the examples, this will produce an order_plugin_example.so
$ cd ~/spark_sdk/examples
$ ./build_examples.sh
Server Layout
- Spark servers reside on a port, usually 8000, but your production instance could be on a different $PORT
SDK Package Layout
- The sdk puts logs in
~/sparkdata/data/logging/log - The sdk package has binaries in
spark_skd/lib - Put plugins in
spark_sdk/lib/plugins/for debugging
Production layout
- Production Logs are in
~/$PORT/sparkdata/data/logging/logon the host - Production binaries are in
/sparkbininside the docker container - Production algo plugins should go into the
/sparkbin/pluginsdirectory
Recorded market data
-
We first check for http://mdreplay/spark/futures.coconut
-
Then fall back to
./data_files/ relative to the sparkd binary
Debugging
Copy the order_plugin_example.so to spark_sdk/lib/plugins/ and start the sparkd server process inside gdb
$ cp -f order_plugin_example.so ~/spark_sdk/lib/plugins/
$ cd ~/spark_sdk/lib
$ gdb --args ./sparkd run
In gdb:
(gdb) break order_plugin_example.cpp:366
Running without debugger
$ cp -f order_plugin_example.so ~/spark_sdk/lib/plugins/
$ cd ~/spark_sdk/lib
$ ./sparkd run
Connect to Admin (Risk) UI to set limits or add users
- Browse to http://location:$PORT
- Login as bts, no password
- Add or manage user trading and market data permissions by clicking the Users icon on the left side
- Add or manage accounts and risk limits by clicking on the Accounts icon on the left side
Other interesting web accessible things
- When you have a running server you can:
- Browse to http://location/$PORT/config to check configuration overrides
- Browse to http://location:$PORT/perf_trace to see socket to socket latencies
- Send us an email for help: api_support@bluetradesys.com
Connect Spark windows client
- To start a spark client, use the -ConfigServer parameter to point at this new server
> spark.exe -ConfigServer http://location:$PORT/config
Or create a file called spark.conf at %APPDATA%\bts\conf\ that contains:
include: "http://location:$PORT/config/"
Download the Spark windows client
- Download the bts installer here:
