This demonstrates how packet subscriptions can be used to filter ITCH market data. It uses p4app
to setup a Fat Tree topology with K=4
. It runs an ITCH feed publisher and three subscribers.
The subscribers have different filters, which are compiled with the Camus
compiler to generate P4Runtime forwarding for all the
switches in the topology.
- Docker
- Ocaml 4.04.0
This was tested on a freshly installed Ubuntu 18.04 VM.
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt update
sudo apt install docker-ce
sudo usermod -aG docker ${USER}
su - ${USER}
- Install OCaml 4.04.0 and the required packages with Opam:
sudo apt install opam m4 libgmp-dev
opam init
eval `opam config env`
opam switch 4.04.0
opam install async core core_extended oasis menhir ocamlgraph jbuilder ocaml-migrate-parsetree bignum mparser ppx_deriving ipaddr stdint
eval `opam config env`
- Build the Camus compiler:
git clone --recursive https://github.com/usi-systems/packet-subscriptions-demo
cd packet-subscriptions-demo/itch.p4app/camus-compiler
make
- Run the demo:
cd ../../
./p4app/p4app run itch.p4app
If the demo ran correctly, each of the three subscribers should have printed
the ITCH add_order
message it received:
{'price': 2, 'shares': 1, 'stock': 'GOOGL '}
{'price': 2, 'shares': 1, 'stock': 'GOOGL '}
{'price': 2, 'shares': 1, 'stock': 'GOOGL '}