A distributed fault-tolerant order book matching engine

Overview

Go - Between

Go Report Card License MIT Go Doc Release

A distributed fault-tolerant order book matching engine.

Features

  • Limit orders
  • Market orders
  • Order book depth
  • Calculate market price for a given quantity
  • Standard price/time priority
  • Distributed and fault-tolerant based on Raft Consensus Algorithm

Download binaries

You can download a pre-built binary here.

Build from source

First, install Go.

Next, fetch and build the binary.

go get -u github.com/danielgatis/go-between

How to init a cluster

First of all, start a new cluster:

go-between start --id=1 --market=USD/BTC --port=3001

And add a two more nodes:

go-between start --id=2 --market=USD/BTC --port=3002 --join=localhost:3001
go-between start --id=3 --market=USD/BTC --port=3003 --join=localhost:3001

API Endpoints

Each node publishes a REST API with the following endpoints.

Adding a new limit order

curl --request POST \
  --url http://127.0.0.1:3001/orders/limit \
  --header 'Content-Type: application/json' \
  --data '{
	"orderId": "1",
	"traderId": "1",
	"market": "USD/BTC",
	"side": "sell",
	"quantity": "1",
	"price": "400.00"
}'

Adding a new market order

curl --request POST \
  --url http://127.0.0.1:3001/orders/market \
  --header 'Content-Type: application/json' \
  --data '{
	"orderId": "2",
	"traderId": "1",
	"market": "USD/BTC",
	"side": "sell",
	"quantity": "1",
	"price": "400.00"
}'

Cancel an order

curl --request DELETE --url http://127.0.0.1:3001/orders/1

Calculate a market price

curl --request POST \
  --url http://127.0.0.1:3001/prices/market \
  --header 'Content-Type: application/json' \
  --data '{
	"traderId": "1",
	"market": "USD/BTC",
	"side": "sell",
	"quantity": "10"
}'

Get the order book price depth

curl --request GET --url http://127.0.0.1:3001/prices/depth

Get the full order book

curl --request GET --url http://127.0.0.1:3001/orderbook

Get the raft node stats

curl --request GET --url http://127.0.0.1:3001/raft/stats

License

Copyright (c) 2021-present Daniel Gatis

Licensed under MIT License

Buy me a coffee

Liked some of my work? Buy me a coffee (or more likely a beer)

Buy Me A Coffee

Releases(v0.1.0)
Owner
Daniel Gatis
Daniel Gatis
Easy to use Raft library to make your app distributed, highly available and fault-tolerant

An easy to use customizable library to make your Go application Distributed, Highly available, Fault Tolerant etc... using Hashicorp's Raft library wh

Richard Bertok 58 May 29, 2022
Lightweight, fault-tolerant message streams.

Liftbridge provides lightweight, fault-tolerant message streams by implementing a durable stream augmentation for the NATS messaging system. It extend

Liftbridge 2.3k Jul 2, 2022
Scalable, fault-tolerant application-layer sharding for Go applications

ringpop-go (This project is no longer under active development.) Ringpop is a library that brings cooperation and coordination to distributed applicat

Uber Open Source 737 Jun 21, 2022
An implementation of a distributed KV store backed by Raft tolerant of node failures and network partitions 🚣

barge A simple implementation of a consistent, distributed Key:Value store which uses the Raft Concensus Algorithm. This project launches a cluster of

Shehjad Khan 0 Nov 24, 2021
Distributed-Services - Distributed Systems with Golang to consequently build a fully-fletched distributed service

Distributed-Services This project is essentially a result of my attempt to under

Hamza Yusuff 6 Jun 1, 2022
Go Open Source, Distributed, Simple and efficient Search Engine

Go Open Source, Distributed, Simple and efficient full text search engine.

ego 6.1k Jun 25, 2022
Distributed lock manager. Warning: very hard to use it properly. Not because it's broken, but because distributed systems are hard. If in doubt, do not use this.

What Dlock is a distributed lock manager [1]. It is designed after flock utility but for multiple machines. When client disconnects, all his locks are

Sergey Shepelev 25 Dec 24, 2019
Distributed reliable key-value store for the most critical data of a distributed system

etcd Note: The main branch may be in an unstable or even broken state during development. For stable versions, see releases. etcd is a distributed rel

etcd-io 40.4k Jun 30, 2022
distributed data sync with operational transformation/transforms

DOT The DOT project is a blend of operational transformation, CmRDT, persistent/immutable datastructures and reactive stream processing. This is an im

DOT & Chain 69 May 11, 2022
High performance, distributed and low latency publish-subscribe platform.

Emitter: Distributed Publish-Subscribe Platform Emitter is a distributed, scalable and fault-tolerant publish-subscribe platform built with MQTT proto

emitter 3.3k Jun 26, 2022
Fast, efficient, and scalable distributed map/reduce system, DAG execution, in memory or on disk, written in pure Go, runs standalone or distributedly.

Gleam Gleam is a high performance and efficient distributed execution system, and also simple, generic, flexible and easy to customize. Gleam is built

Chris Lu 3.1k Jun 28, 2022
Go Micro is a framework for distributed systems development

Go Micro Go Micro is a framework for distributed systems development. Overview Go Micro provides the core requirements for distributed systems develop

Asim Aslam 18.6k Jun 25, 2022
Simplified distributed locking implementation using Redis

redislock Simplified distributed locking implementation using Redis. For more information, please see examples. Examples import ( "fmt" "time"

Black Square Media 729 Jun 30, 2022
A distributed lock service in Go using etcd

locker A distributed lock service client for etcd. What? Why? A distributed lock service is somewhat self-explanatory. Locking (mutexes) as a service

James Gregory 48 Dec 2, 2021
Skynet is a framework for distributed services in Go.

##Introduction Skynet is a communication protocol for building massively distributed apps in Go. It is not constrained to Go, so it will lend itself n

null 2k Jun 12, 2022
Dapr is a portable, event-driven, runtime for building distributed applications across cloud and edge.

Dapr is a portable, serverless, event-driven runtime that makes it easy for developers to build resilient, stateless and stateful microservices that run on the cloud and edge and embraces the diversity of languages and developer frameworks.

Dapr 18.4k Jun 28, 2022
A distributed, proof of stake blockchain designed for the financial services industry.

Provenance Blockchain Provenance is a distributed, proof of stake blockchain designed for the financial services industry.

Provenance Blockchain, Inc. 55 Jun 23, 2022
Lockgate is a cross-platform locking library for Go with distributed locks using Kubernetes or lockgate HTTP lock server as well as the OS file locks support.

Lockgate Lockgate is a locking library for Go. Classical interface: 2 types of locks: shared and exclusive; 2 modes of locking: blocking and non-block

werf 230 Jun 16, 2022