Orderbook Simulation
OrderbookSim is a C++ application simulating a financial market order book. It efficiently manages and matches buy and sell orders while calculating the Volume-Weighted Average Price (VWAP).
Functions | Variables
OrderbookView Namespace Reference

Functions

def load_json (filename)
 
def create_table (frame, headers, data)
 
def refresh_data ()
 
def update_table (frame, headers, data)
 

Variables

 root = tk.Tk()
 
 notebook = ttk.Notebook(root)
 
 expand
 
 True
 
 fill
 
 frame_sell_orders = tk.Frame(notebook)
 
 frame_buy_orders = tk.Frame(notebook)
 
 frame_purchases = tk.Frame(notebook)
 
 frame_live_sell_orders = tk.Frame(notebook)
 
 frame_live_buy_orders = tk.Frame(notebook)
 
 text
 
list sell_order_headers = ["order_id", "order_type", "price", "quantity", "side", "time"]
 
list buy_order_headers = ["order_id", "order_type", "price", "quantity", "side", "time"]
 
list purchase_headers = ["price", "quantity", "time"]
 
list live_sell_order_headers = ["order_id", "order_type", "price", "quantity", "side", "time"]
 
list live_buy_order_headers = ["order_id", "order_type", "price", "quantity", "side", "time"]
 

Function Documentation

◆ create_table()

def OrderbookView.create_table (   frame,
  headers,
  data 
)
Creates a table in a Tkinter frame using a Treeview widget to display data.

Args:
    frame (tk.Frame): The frame in which the table will be created.
    headers (list of str): Column headers for the table.
    data (list of dict): Data to populate the table, with each dictionary representing a row.

Returns:
    ttk.Treeview: The created Treeview table widget.

◆ load_json()

def OrderbookView.load_json (   filename)
Loads data from a JSON file.

Args:
    filename (str): The path to the JSON file.

Returns:
    list: A list of dictionaries, each representing a record from the JSON file.

◆ refresh_data()

def OrderbookView.refresh_data ( )
Refreshes data by loading updated JSON files and updating each table.
This function also schedules itself to be called every 10 seconds.

◆ update_table()

def OrderbookView.update_table (   frame,
  headers,
  data 
)
Clears and recreates a table within a specified frame to display updated data.

Args:
    frame (tk.Frame): The frame containing the table to update.
    headers (list of str): Column headers for the table.
    data (list of dict): New data to display in the table.

Variable Documentation

◆ buy_order_headers

list OrderbookView.buy_order_headers = ["order_id", "order_type", "price", "quantity", "side", "time"]

◆ expand

OrderbookView.expand

◆ fill

OrderbookView.fill

◆ frame_buy_orders

OrderbookView.frame_buy_orders = tk.Frame(notebook)

◆ frame_live_buy_orders

OrderbookView.frame_live_buy_orders = tk.Frame(notebook)

◆ frame_live_sell_orders

OrderbookView.frame_live_sell_orders = tk.Frame(notebook)

◆ frame_purchases

OrderbookView.frame_purchases = tk.Frame(notebook)

◆ frame_sell_orders

OrderbookView.frame_sell_orders = tk.Frame(notebook)

◆ live_buy_order_headers

list OrderbookView.live_buy_order_headers = ["order_id", "order_type", "price", "quantity", "side", "time"]

◆ live_sell_order_headers

list OrderbookView.live_sell_order_headers = ["order_id", "order_type", "price", "quantity", "side", "time"]

◆ notebook

OrderbookView.notebook = ttk.Notebook(root)

◆ purchase_headers

list OrderbookView.purchase_headers = ["price", "quantity", "time"]

◆ root

OrderbookView.root = tk.Tk()

◆ sell_order_headers

list OrderbookView.sell_order_headers = ["order_id", "order_type", "price", "quantity", "side", "time"]

◆ text

OrderbookView.text

◆ True

OrderbookView.True