robaho/go-trader
소개
Go로 작성된 금융 거래소로, 알고리즘 트레이딩 테스트를 위해 설계되었습니다.
비즈니스 및 금융What you can do
- FIX (using quickfixgo)
- UDP multicast for market data distribution.
- TCP replay of dropped market data packets.
- Uses the high-performance fixed point library fixed which I also developed.
측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
Originalgo-trader
A financial exchange written in Go including complete order book, fix protocol, and market data distribution.
It was originally developed to further my knowledge of Go and test its suitability for high-performance financial applications, and it has continued to evolve into an ideal teaching/reference project for Go (interfaces, low-level networking, web development, json, Go routines, etc.).
Check out cpp-trader for a C++ version, albeit with less features.
Features
- client to server communication using:
- FIX (using quickfixgo)
- gRPC
- UDP multicast for market data distribution.
- TCP replay of dropped market data packets.
- Uses the high-performance fixed point library fixed which I also developed.
- Includes multiple clients:
- command line
- server-side web using Go templates
- SPA web using Lit
- A sample "market maker" to mass quote the market.
- A sample "playback" to simulate markets from recorded market data.
- Supported order types:
- limit
- market
- REST api
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...
There are two different web interfaces available:
- the default interface at
/uses Go templates and server side rendering - the alternative UI at
/litis written in Typescript using Lit and the Rest api
Use npm run build in the web_lit directory to build the Lit assets.
install
go get github.com/robaho/go-trader
build
cd go-trader
mkdir bin
go build -o bin ./cmd/...
run
cd go-trader Run each in a different terminal session. Ensure the correct interface is set in configs/got_settings for the client. bin/exchange bin/marketmaker -symbol IBM bin/client
performance
Configuration:
- client machine is a Mac Mini M1, running OSX Sonoma
- server machine is a 4.0 ghz i7 iMac (4 core, 8 thread), running OSX Monterey
- using 1 gbit ethernet connection
- a quote is a double-sided (bid & ask)
- timings are measured from the quote message generation on the client, to the reception of the multicast market data on the client
- 90k+ quote per second over the network using FIX with latency < 1ms
- 400k+ quote per second over the network using gRPC with latency < 600 usec
performance details
using marketmaker -bench 75 -proto fix
updates per second 72707, max ups 72707, avg rtt 832us, 10% rtt 595us 99% rtt 5365us
updates per second 90279, max ups 90279, avg rtt 830us, 10% rtt 0us 99% rtt 4515us
updates per second 89215, max ups 90279, avg rtt 840us, 10% rtt 0us 99% rtt 4851us
using marketmaker -bench 250 -proto grpc
updates per second 410094, max ups 414584, avg rtt 609us, 10% rtt 0us 99% rtt 2390us
updates per second 411559, max ups 414584, avg rtt 607us, 10% rtt 0us 99% rtt 2455us
updates per second 412884, max ups 414584, avg rtt 605us, 10% rtt 0us 99% rtt 2270us
The CPUs are saturated on both the client and server.
less than 3 microseconds per roundtrip quote over the network !
REST api
access full book (use guest/password to login)
localhost:8080/api/book/SYMBOL
localhost:8080/api/stats/SYMBOL
screen shots

관련 프로젝트 살펴보기
불러오는 중…