go-trader

module
v0.0.0-...-7e8c8c6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 9, 2023 License: GPL-3.0

README

go-trader

A financial exchange written in Go including complete order book, fix protocol, and market data distribution.

Uses quickfixgo or gRPC for client/server communication.

Uses UDP multicast for market distribution.

It uses the high-performance fixed point library fixed.

There is a sample client with a command line GUI, a sample "market maker", and a sample "playback".

The exchange itself has a bare bones web interface, that uses web sockets to provide real-time book updates.

The exchange is designed to allow for easy back-testing of trading strategies. It supports limit and market orders.

There is a very simple sample "algo". The program structure is applicable to many strategies that use an entry and exit price. This can be run in conjunction with the 'marketmaker' sample to test the "algo". Hint: it has a 50/50 chance of being successful EXCEPT the market maker bid/ask spread must be accounted for - which makes it far less than a 50/50 chance of being profitable...

It was primarily developed to further my knowledge of Go and test its suitability for high-performance financial applications.

install

go get github.com/neoloc/go-trader

build

go install github.com/neoloc/go-trader/cmd/exchange@latest

go install github.com/neoloc/go-trader/cmd/client@latest

go install github.com/neoloc/go-trader/cmd/marketmaker@latest

go install github.com/neoloc/go-trader/cmd/playback@latest

run

cd $GOPATH/src/github.com/neoloc/go-trader/cmd

exchange &

marketmaker -symbol IBM

client

performance

Using the quickfixgo connector:

  • test machine is a 3.4 ghz i7 (4 core,8 thread), running osx
  • clients and exchange process are running on the same machine
  • a quote is a double-sided (bid & ask)
  • a timing is measured from the quote message generation to the reception of the multicast market data

1 market maker can perform 6k round-trip quotes/sec

4 market makers can perform 16k round-trip quotes/sec

Using the gRPC connector:

1 market maker can perform 12k round-trip quotes/sec

4 market makers can perform 30k round-trip quotes/sec

REST api

access full book (use guest/password to login)

localhost:8080/api/book/SYMBOL

localhost:8080/api/stats/SYMBOL

screen shots

client screen shot web screen shot

Directories

Path Synopsis
cmd
internal
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL