Files
spark/src/sdk

BTS Spark SDK

Getting Started

Docker

We use docker to provide a full dev environment with all the tools users need to develop their own algos.

  1. Setup docker on your preferred OS and pull down the BTS docker
$ docker pull bluetradingsystems/linux_docker
  1. 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

Git

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

Look at examples/md_publisher_example.cpp to look at how to build a custom market data producer

Look at examples/order_plugin_example.cpp to look at how to create custom algos.

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

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 Spark windows client

  • To start a spark client, use the -ConfigServer parameter to point at this new server
> spark.exe -ConfigServer http://location/8000/config

Or create a file called spark.conf at %APPDATA%\bts\conf\ that contains:

include: "http://location:8000/config/"

Notes