https://github.com/danielgatis/go-orderbook

The pkg go-orderbook implements a limit order book for high-frequency trading (HFT), as described by WK Selph.

https://github.com/danielgatis/go-orderbook

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (7.9%) to scientific vocabulary

Keywords

exchange matching-engine orderbook
Last synced: 9 months ago · JSON representation

Repository

The pkg go-orderbook implements a limit order book for high-frequency trading (HFT), as described by WK Selph.

Basic Info
  • Host: GitHub
  • Owner: danielgatis
  • License: mit
  • Language: Go
  • Default Branch: master
  • Homepage:
  • Size: 28.3 KB
Statistics
  • Stars: 22
  • Watchers: 2
  • Forks: 8
  • Open Issues: 0
  • Releases: 0
Topics
exchange matching-engine orderbook
Created over 4 years ago · Last pushed almost 3 years ago
Metadata Files
Readme License

README.md

Go - Orderbook

Go Report Card License MIT Go Doc

The pkg go-orderbook implements a limit order book for high-frequency trading (HFT), as described by WK Selph.

Based on WK Selph's Blogpost: https://goo.gl/KF1SRm

Install

bash go get -u github.com/danielgatis/go-orderbook

And then import the package in your code:

go import "github.com/danielgatis/go-orderbook"

Example

An example described below is one of the use cases.

```go package main

import ( "bytes" "encoding/json" "fmt" "math/rand" "time"

"github.com/danielgatis/go-orderbook"
"github.com/google/uuid"
"github.com/shopspring/decimal"

)

func main() { book := orderbook.NewOrderBook("BTC/BRL")

for i := 0; i < 10; i++ {
    rand.Seed(time.Now().UnixNano())
    side := []orderbook.Side{orderbook.Buy, orderbook.Sell}[rand.Intn(2)]

    book.ProcessPostOnlyOrder(uuid.New().String(), uuid.New().String(), side, decimal.NewFromInt(rand.Int63n(1000)), decimal.NewFromInt(rand.Int63n(1000)))
}

depth, _ := json.Marshal(book.Depth())
var buf bytes.Buffer
json.Indent(&buf, depth, "", "  ")
fmt.Println(buf.String())

} ```

❯ go run main.go { "bids": [ { "amount": "392", "price": "930" }, { "amount": "872", "price": "907" }, { "amount": "859", "price": "790" }, { "amount": "643", "price": "424" }, { "amount": "269", "price": "244" }, { "amount": "160", "price": "83" }, { "amount": "74", "price": "65" } ], "asks": [ { "amount": "178", "price": "705" }, { "amount": "253", "price": "343" }, { "amount": "805", "price": "310" } ] }

License

Copyright (c) 2020-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

Owner

  • Name: Daniel Gatis
  • Login: danielgatis
  • Kind: user
  • Location: Recife - PE

GitHub Events

Total
  • Watch event: 1
  • Fork event: 1
Last Year
  • Watch event: 1
  • Fork event: 1

Committers

Last synced: 10 months ago

All Time
  • Total Commits: 10
  • Total Committers: 1
  • Avg Commits per committer: 10.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Daniel Gatis d****s@g****m 10

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 1
  • Total pull requests: 0
  • Average time to close issues: 7 months
  • Average time to close pull requests: N/A
  • Total issue authors: 1
  • Total pull request authors: 0
  • Average comments per issue: 3.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • vahidalvandi (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads: unknown
  • Total dependent packages: 1
  • Total dependent repositories: 1
  • Total versions: 2
proxy.golang.org: github.com/danielgatis/go-orderbook

Package orderbook is a Limit Order Book for high-frequency trading.

  • Versions: 2
  • Dependent Packages: 1
  • Dependent Repositories: 1
Rankings
Dependent repos count: 4.7%
Dependent packages count: 5.8%
Average: 7.7%
Forks count: 9.0%
Stargazers count: 11.3%
Last synced: 10 months ago

Dependencies

example/go.mod go
  • github.com/danielgatis/go-orderbook v0.0.0-20211221232158-a76adcecdd12
  • github.com/emirpasic/gods v1.12.0
  • github.com/google/uuid v1.3.0
  • github.com/shopspring/decimal v1.3.1
example/go.sum go
  • github.com/bradleyjkemp/cupaloy/v2 v2.7.0
  • github.com/danielgatis/go-orderbook v0.0.0-20211221232158-a76adcecdd12
  • github.com/davecgh/go-spew v1.1.0
  • github.com/davecgh/go-spew v1.1.1
  • github.com/emirpasic/gods v1.12.0
  • github.com/google/uuid v1.3.0
  • github.com/pmezard/go-difflib v1.0.0
  • github.com/shopspring/decimal v1.3.1
  • github.com/stretchr/objx v0.1.0
  • github.com/stretchr/objx v0.1.1
  • github.com/stretchr/testify v1.6.1
  • github.com/stretchr/testify v1.7.0
  • gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405
  • gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
go.mod go
  • github.com/bradleyjkemp/cupaloy/v2 v2.8.0
  • github.com/davecgh/go-spew v1.1.1
  • github.com/emirpasic/gods v1.18.1
  • github.com/google/uuid v1.3.0
  • github.com/pmezard/go-difflib v1.0.0
  • github.com/shopspring/decimal v1.3.1
  • github.com/stretchr/testify v1.8.4
  • gopkg.in/yaml.v3 v3.0.1
go.sum go
  • github.com/bradleyjkemp/cupaloy/v2 v2.8.0
  • github.com/davecgh/go-spew v1.1.0
  • github.com/davecgh/go-spew v1.1.1
  • github.com/emirpasic/gods v1.18.1
  • github.com/google/uuid v1.3.0
  • github.com/pmezard/go-difflib v1.0.0
  • github.com/shopspring/decimal v1.3.1
  • github.com/stretchr/objx v0.1.0
  • github.com/stretchr/objx v0.1.1
  • github.com/stretchr/testify v1.6.1
  • github.com/stretchr/testify v1.8.4
  • gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405
  • gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
  • gopkg.in/yaml.v3 v3.0.1