Git Product home page Git Product logo

gotrade's Introduction

GoTrade

GoTrade is a FIX protocol electronic trading and order management system written in Golang, structured for typical multi-asset instituional use

GoDoc Build Status

Status

This project is currently more of a proof of concept. It is no where near in completeness of a commerical product. This public repo serves as mostly for the purpose of experimenting and share of ideas.

Getting Started

$ go get -u github.com/cyanly/gotrade

Features

  • Trade in real-time via FIX through the broker-neutral API.
  • Normalized FIX order flow behavior across multiple FIX versions and asset classes.
  • Pure Go.
    • Platform neutral: write once, build for any operating systems and arch (Linux/Windows/OSX etc).
    • Native code performance.
    • Ease of deployment.
    • Lack of OOP verbosity, works for small and big teams.
  • Protobuf.
    • Binary encoding format, efficient yet extensible.
    • Easy Language Interoperability (C++, Python, Java, C#, Javascript, etc).
    • Protocol backward compatibility.

Design

└─ gotrade/
   ├─ core/                 -> The low-level API that gives consumers all the knobs they need
   │  ├─ order/
   │  │  └─ execution/
   │  ├─ service/
   └─ proto/...             -> Protobuf messaging protocol of various entities
   └─ services/             -> Core services managing multi-asset order flow
   │  ├─ orderrouter/       -> Centralized management facility for multi-asset global order flow
   │  ├─ marketconnectors/  -> Managing FIX connection to each trading venue, also performs pre-trade risk checks
   │
   └─cmd/...                -> Command-line executables, binary build targets
   

Examples

The best way to see goTrade in action is to take a look at tests (see Benchmark section below):

Pre-Requisites:

  • Go 1.4 or higher
  • get dependencies:
$ cd $GOPATH/src/github.com/cyanly/gotrade
$ go get -u -t ./...

OrderRouter and MarketConnector test cases will mock a testdb and messaging bus for end-to-end, message to message test.

$ cd $GOPATH/src/github.com/cyanly/gotrade/services/orderrouter
$ go test -v 

$ cd $GOPATH/src/github.com/cyanly/gotrade/services/marketconnectors/simulator
$ go test -v 

Benchmark

Machine: Intel Core i5 CPU @ 2.80GHz + Ubuntu 14.04 Desktop x86_64

  • test/benchmark/client2fix_test.go
  • CL ⇒ OR:
    Client send order protobuf to OrderRouter(OR)
  • OR ⇒ MC:
    OrderRouter process order and dispatch persisted order entity to target MarketConnector
  • MC ⇒ FIX:
    MarketConnector translate into NewOrderSingle FIX message based on the session with its counterparty
  • FIX ⇒ MC:
    MarketConnector received FIX message on its order, here Simulator sending a fully FILL execution
  • EXE ⇒ CL:
    MarketConnector publish processed and persisted Execution onto messaging bus, here our Client will listen to

Included:

  • from order to FIX to a fully fill execution message to execution protobuf published back
  • serialsing/deserialsing mock order into protobuf messages
  • Request/Publish and Response/Subscribe via NATS.io message bus
  • Time spent in the Linux TCP/IP stack
  • Decode FIX messages and reply by a simulated broker

Excluded:

  • Database transaction time (hard-wired to an inline mock DB driver)

Result:

  • 0.176ms per op, 5670 order+fill pairs per sec

Limitations

Contributing

GoTrade © 2016+, Chao Yan. Released under the GNU General Public License.
Authored and maintained by Chao Yan with help from contributors (list).
Contributions are welcome.

cyan.ly  ·  GitHub @cyanly  · 

gotrade's People

Contributors

cyanly avatar iloginov avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.