Skip to content

Latest commit

 

History

History
60 lines (47 loc) · 2.68 KB

README.md

File metadata and controls

60 lines (47 loc) · 2.68 KB

thebook-haskell - Electronic order book in Haskell.

Build Status Coverage Status

The overriding goal of this project is to (eventually) create a (near) clone of the LSE SETS system. The project is progressing slowly but hopefully some day it will actually be useable.

Done

  • Parser of ITCH.xml schemas that generates the records, binary and arbitrary instances for the messages (almost as part of the build).
  • Stupid conduit demo where server pushes random ITCH messages and client prints those.

Goals and TODOs

General features

  • Networking (FIX in/OUCH or ITCH out)
  • Separate business logic (pure model of order book) from the side-effecting bits.
    • The business logic should be written as a rule engine, proposed syntax is in src/Data/TheBook/Rule.hs and a concrete monad is in src/Data/TheBook/Monad.hs.
  • Separate market data distribution engine.
  • Admin commands (create market, clear order book)

Order types

  • Limit orders
  • Market orders
  • TimeInForce
  • Stop limit orders
  • Stop orders
  • Iceberg orders
  • Passive Only
  • Hidden Limit Orders
  • Mid Price Pegged Orders
  • Named Orders
  • Executable Quotes
  • Firm Quotes

Config

  • Use dire for config.

Examples

  • Use doctest for examples in haddocks.

Phases

  • Validation (NewOrderSingle enters -> Particular order comes out)
  • The following are performed until trade happens
  • Depending on the order a particular rule is invoked for matching it and that results in TradeInstruction
  • This then goes to the order book to be executed and results in Trade
  • Then we invoke rules on the trade (if e.g. iceberg is executed, it needs to reenter book)
  • Once no more trades can happen, we go through rules on what to do with order next (Market is cancelled, limit order enters book etc.)

Useful

ITCH