starting sdk docs

This commit is contained in:
Kevin Darby committed 2018-11-26 18:22:35 -05:00
1 parent 7151619645
commit eb7a79488f
3 files changed
+106 -3

No files matched your search

+73
View File
@@ -0,0 +1,73 @@
# BTS Spark SDK
You will need at least Git 2.19 to download the large files in this repo (https://github.com/git-for-windows/git/releases/)
If you don't want to update your git, you'll need to install git-lfs (large file storage). (https://git-lfs.github.com/)
Once your git is set up, clone this repo into a ```spark_sdk/``` dir
```
$ git clone https://github.com/BlueTradingSystems/spark_sdk.git
$ cd spark_sdk
```
## Docker
1) Setup docker on your preferred OS and pull down the BTS docker
```
$ docker pull bluetradingsystems/linux_docker
```
(Our docker can also be found here: https://hub.docker.com/r/bluetradingsystems/linux_docker/)
2) Either run or otherwise use the ```sdk_shell.sh```, to start a docker container, then ssh to the container on port 2323
```
$ ./sdk_shell.sh
$ ssh root@host -p 2323
```
## Development
Once ssh'd into the container, go to the ```spark_sdk/examples``` directory
Look at ```md_publisher_example.cpp``` to look at how to provide a custom market data producer
Look at ```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
```
Once in gdb: (https://darkdust.net/files/GDB%20Cheat%20Sheet.pdf)
```
(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
```
+12 -3
View File
@@ -19,14 +19,23 @@ mkdir -p $1/sdk/externals/
(cd $1/src && find lib -type f -name "*.h" -exec cp --parents \{\} $1/sdk/include/spark/ \;)
(cd $1/src && find lib -type f -name "*.cc" -exec cp --parents \{\} $1/sdk/include/spark/ \;)
ln -sf $2/../../externals/linux/include $1/sdk/externals/include
ln -sf $2/../../externals/linux/lib/Release $1/sdk/externals/lib
#ln -sf $2/../../externals/linux/include $1/sdk/externals/include
mkdir -p $1/sdk/externals/include
cp -r $2/../../externals/linux/include/* $1/sdk/externals/include
rm -rf $1/sdk/externals/include/OnixS/
#ln -sf $2/../../externals/linux/lib/Release $1/sdk/externals/lib
mkdir -p $1/sdk/externals/lib
cp -r $2/../../externals/linux/lib/Release/* $1/sdk/externals/lib
rm -f $1/sdk/externals/lib/libonixs*
ln -sf $1/server $1/sdk/lib
mkdir $1/sdk/examples
cp $2/examples/* $1/sdk/examples
cp $2/sdk_shell.sh $1/sdk/sdk_shell.sh
cp $2/README.md $1/sdk/README.md
ln -sf $1/sdk/lib/defaults $1/sdk/examples/defaults
chmod +x $1/sdk/examples/build_examples.sh
chmod +x $1/sdk/sdk_shell.sh
(cd $1/sdk/examples && ./build_examples.sh && ./md_publisher_example >/dev/null)
+21
View File
@@ -0,0 +1,21 @@
#/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
docker run \
--restart=unless-stopped \
-p 8000:8000 \
-p 8001:8001 \
-p 8080:8080 \
--net host \
--shm-size=1024m \
--cap-add=SYS_PTRACE --security-opt seccomp=unconfined \
-h $(hostname)_spark \
-w $PWD \
-u root \
-v /home:/home \
-e DISPLAY=$DISPLAY \
--name bts_sdk \
-d \
-t bluetradingsystems/linux_docker \
/bin/bash -c "(sudo /usr/sbin/sshd -p 2323) & /bin/bash --login"