{"id":13808408,"url":"https://github.com/robaho/go-trader","last_synced_at":"2025-04-05T17:09:36.540Z","repository":{"id":45303409,"uuid":"146024974","full_name":"robaho/go-trader","owner":"robaho","description":"financial exchange written in Go, designed for algorithmic trading tests","archived":false,"fork":false,"pushed_at":"2024-04-24T13:35:06.000Z","size":801,"stargazers_count":341,"open_issues_count":0,"forks_count":74,"subscribers_count":19,"default_branch":"master","last_synced_at":"2024-04-24T16:49:33.158Z","etag":null,"topics":["cui","exchange","financial-exchange","fix","golang","grpc","grpc-go","html","marketdata","multicast","orderbook","quickfix","quickfixgo","trade","trading-algorithms","trading-strategies"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robaho.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-24T18:13:34.000Z","updated_at":"2024-06-04T16:38:30.178Z","dependencies_parsed_at":"2024-04-24T14:45:28.499Z","dependency_job_id":"1c045552-fa72-4881-9332-0e9525b56618","html_url":"https://github.com/robaho/go-trader","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robaho%2Fgo-trader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robaho%2Fgo-trader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robaho%2Fgo-trader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robaho%2Fgo-trader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robaho","download_url":"https://codeload.github.com/robaho/go-trader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247369953,"owners_count":20927928,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cui","exchange","financial-exchange","fix","golang","grpc","grpc-go","html","marketdata","multicast","orderbook","quickfix","quickfixgo","trade","trading-algorithms","trading-strategies"],"created_at":"2024-08-04T01:01:42.029Z","updated_at":"2025-04-05T17:09:36.518Z","avatar_url":"https://github.com/robaho.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# go-trader\n\nA financial exchange written in Go including complete order book, fix protocol, and market data distribution.\n\nCheck out [cpp-trader](https://github.com/robaho/cpp-trader) for a C++ version, albeit with less features.\n\n## Features\n\n- client to server communication using:\n    - FIX (using quickfixgo)\n    - gRPC\n- UDP multicast for market data distribution.\n- TCP replay of dropped market data packets.\n- Uses the high-performance fixed point library [fixed](https://github.com/robaho/fixed) which I also developed.\n- Includes multiple clients:\n    - command line \n    - server-side web using Go templates\n    - SPA web using Lit\n- A sample \"market maker\" to mass quote the market.\n- A sample \"playback\" to simulate markets from recorded market data.\n- Supported order types:\n    - limit\n    - market\n- [REST api](https://github.com/robaho/go-trader/blob/2b92b5652eb5c6a93b83262f45ba1f237fb180b0/internal/exchange/webserver.go#L41-L54)\n\nThe exchange is designed to allow for easy back-testing of trading strategies. It supports limit and market orders.\n\nThere is a very simple sample \"algo\". The program structure is applicable to many strategies that use an entry and exit price.\nThis 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\nmarket maker bid/ask spread must be accounted for - which makes it far less than a 50/50 chance of being profitable...\n\nThere are two different web interfaces available:\n- the default interface at `/` uses Go templates and server side rendering\n- the alternative UI at `/lit` is written in Typescript using [Lit](https://lit.dev) and the Rest api\n\nUse `npm run build` in the `web_lit` directory to build the Lit assets.\n\nIt was primarily developed to further my knowledge of Go and test its suitability for high-performance financial applications.\n\n# install\n\n`go get github.com/robaho/go-trader`\n\n# build\n\n```\ncd go-trader\nmkdir bin\ngo build -o bin ./cmd/...\n```\n\n# run\n\n\u003cpre\u003e\ncd go-trader\n\n\u003cstrong\u003eRun each in a different terminal session.\u003c/strong\u003e\n\u003cstrong\u003eEnsure the correct interface is set in configs/got_settings for the client.\u003c/strong\u003e\n\nbin/exchange\n\nbin/marketmaker -symbol IBM\n\nbin/client\n\u003c/pre\u003e\n\n# performance\n\nConfiguration:\n\n- client machine is a Mac Mini M1, running OSX Sonoma\n- server machine is a 4.0 ghz i7 iMac (4 core, 8 thread), running OSX Monterey\n- using 1 gbit ethernet connection\n- a quote is a double-sided (bid \u0026 ask) \n- timings are measured from the quote message generation on the client, to the reception of the multicast market data on the client\n- 90k+ quote per second over the network using FIX with latency \u003c 1ms\n- 400k+ quote per second over the network using gRPC with latency \u003c 600 usec\n\n\u003cdetails\u003e\n    \u003csummary\u003eperformance details\u003c/summary\u003e\n\u003cbr\u003e\n\n**using `marketmaker -bench 75 -proto fix`**\n\n```\nupdates per second 72707, max ups 72707,  avg rtt 832us, 10% rtt 595us 99% rtt 5365us\nupdates per second 90279, max ups 90279,  avg rtt 830us, 10% rtt 0us 99% rtt 4515us\nupdates per second 89215, max ups 90279,  avg rtt 840us, 10% rtt 0us 99% rtt 4851us\n```\n\n**using `marketmaker -bench 250 -proto grpc`**\n\n```\nupdates per second 410094, max ups 414584,  avg rtt 609us, 10% rtt 0us 99% rtt 2390us\nupdates per second 411559, max ups 414584,  avg rtt 607us, 10% rtt 0us 99% rtt 2455us\nupdates per second 412884, max ups 414584,  avg rtt 605us, 10% rtt 0us 99% rtt 2270us\n```\n\n_The CPUs are saturated on both the client and server._\n\n## less than 3 microseconds per roundtrip quote over the network ! ##\n\u003cbr\u003e\n\u003c/details\u003e\n\u003cbr\u003e\n\n# REST api\n\naccess full book (use guest/password to login)\n\nlocalhost:8080/api/book/SYMBOL\n\nlocalhost:8080/api/stats/SYMBOL\n\n# screen shots\n\n![client screen shot](doc/clientss.png)\n![web screen shot](doc/webss.png)\n![lit screen shot](doc/litss.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobaho%2Fgo-trader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobaho%2Fgo-trader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobaho%2Fgo-trader/lists"}