Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Matching Engine for Limit Order Book

License

NotificationsYou must be signed in to change notification settings

dyn4mik3/OrderBook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Matching engine based on a limit order book written in Python.

Features:

  • Standard price-time priority
  • Supports both market and limit orders
  • Add, cancel, update orders

Requirements:

  • sortedcontainers

Usage

Install package:

pip install orderbook

Import package:

fromorderbookimportOrderBook

Take a look at example.py:https://github.com/dyn4mik3/OrderBook/blob/master/orderbook/test/example.py

Key Functions

Create an Order Book:

order_book=OrderBook()

process_order

cancel_order

modify_order

get_volume_at_price

get_best_bid

get_best_ask

Data Structure

Orders are sent to the order book using the process_order function. The Order is created using a quote.

# For a limit orderquote= {'type' :'limit','side' :'bid','quantity' :6,'price' :108.2,'trade_id' :001}# and for a market order:quote= {'type' :'market','side' :'ask','quantity' :6,'trade_id' :002}

About

Matching Engine for Limit Order Book

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp