Skip to content

OrderBook Simulator with Limit and Iceberg functionality

License

Notifications You must be signed in to change notification settings

pgaref/orderbook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OrderBook

OrderBook Simulator with Limit and Iceberg functionality

Design

Proof of concept of a Limit Order Book (LOB) where the bid and ask order books are implemented as separate trees. Inspired by the [Limit Book] blog post by Selph where limit levels are stored as nodes inside the trees and each node is a doubly-linked list of orders, sorted chronologically.

Structure

  • Source code stored under orderbook/src/
  • Tests stored under test/

Install

  • python setup.py install

Run

  • runner.py < data/ordersSimple.dat

Test

  • Single: python -m unittest test.testPriceTree
  • All: python -m unittest discover

Notes

  • An order book is an electronic list of buy and sell orders for a security or other instrument organized by price level
  • Order books are used by almost every exchange for various assets like stocks, bonds, currencies, and even cryptocurrencies
  • These lists help improve market transparency as they provide information on price, availability, depth of trade, and who initiates transactions
  • There are three parts to an order book: buy orders, sell orders, and order history
  • => A limit order to sell is called an "ask".
  • Iceberg order is a conditional request made to the broker/system to buy or sell a large required quantity of stock, but in smaller predetermined quantity

Best practices

  • Separate the intentions of a trading model–such as “place limit orders at $10.15 and $10.10″ from the resulting actual positions
  • The data structure chosen to represent the limit order book will be the primary source of market information

References

About

OrderBook Simulator with Limit and Iceberg functionality

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages