exchange

Finance and crypto

order book

SHOW HN2020

exchange

A first project in Rust – in-memory order book

github.com

#order book#rust#in-memory#matching engine

91points
33comments
#709of 3,028 in 2020
Top 24%of 2020 by points

How HN took it

CuriousMostly questions and neutral comments

1 positive, 10 neutral or asking, 2 mixed, 2 critical, out of 15 comments about the project. Thread score -0.02.

Idea: 1 for, 0 againstDesign: 0 for, 1 againstPerformance: 0 for, 1 against

The thread, comment by comment

Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.

positive neutral or mixed critical about another commenter or something else the maker

What HN said

What people liked

  • Readable code.

    From 1 comment
    • I don’t do Rust but that was nicely readable. One comment: using Enums for stock symbols presumably forces a recompile on each new symbol. What would be the idiomatic…
      asplake on HN
  • Interesting project for learning Rust.

    From 2 comments
    • Great stuff! Since we're working on things like that on the daily, you have inspired me to do something like that in elixir :)
      aloukissas on HN
    • They aren't that unusual on an absolute basis but relative to the number of orders in a stock they are quite rare (iirc - it's been a while since I was directly involved in…
      seanhunter on HN

Objections

  • Storing full order struct in book is wasteful.

    From 1 comment
    • If this is intended as anything more than a toy, you don't want to store the full OpenLimitOrder in the book data structure. The symbol should be allocated once on the book. The…
      Misdicorl on HN
  • Vec is a poor choice versus a B-tree for price levels.

    From 2 comments
    • Why use a Vec instead of a B-Tree?
      evdubs on HN
    • Why a B-tree if it's supposed to be in-memory? A heap would be easier to implement and more efficient.
      globular-toast on HN

Requests

  • Explain how Vec vs B-tree choice was made.

    From 1 comment
  • Feed real market data to test performance.

    From 1 comment
    • Are you planning to hook your order book up to a data feed like, for example, binance[1] to see how your book performs? [1]…
      evdubs on HN

Questions

  • Why use UUIDs instead of user and order ids?

    From 1 comment
    • Also, why use Uuids instead of a pair of user_id: u64, order_id: u64?
      evdubs on HN
  • How would enums for stock symbols work in Rust?

    From 1 comment
    • I don’t do Rust but that was nicely readable. One comment: using Enums for stock symbols presumably forces a recompile on each new symbol. What would be the idiomatic…
      asplake on HN

Alternatives named

  • BTreeMap from Rust std library.

    From 1 comment
    • Rust provides a built in B-tree[1] and it offers this over a binary search tree to avoid pointer chasing. With respect to heaps, are you thinking that a BinaryHeap[2] could be…
      evdubs on HN
  • once_cell Lazy instead of lazy_static.

    From 1 comment
    • Instead of lazy static, use once_cell’s Lazy type[0]! It is a replacement that does away with the macro-based approach, possible thanks to improvements in const fn. This leads to…
      roblabla on HN

Category, keywords, summaries and labels on this page were made by AI (Thread Reader v2) and not checked by hand. Each point links to the comments it came from.

Add a badge to your READMEShown on HackerShow
[![Shown on HackerShow](https://hackershow.org/badge.svg)](https://hackershow.org/show/22389239)