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