jmcph4
PyOBSim
Python

A Python module for market simulation

Last updated Jun 29, 2026
24
Stars
11
Forks
2
Issues
0
Stars/day
Attention Score
71
Language breakdown
Python 100.0%
Files click to expand
README

Build Status

PyOBSim - the Python Order Book Simulator #


PyOBSim is a Python module facilitating market simulation by implementing an order book and other utilities. PyOBSim aims to make testing of trading algorithms clean and simple.

Running simulations is straightforward: simply provide an order flow and fire away:

from pyobsim import * # build our participants alice = participant.Participant("Alice", 100, 0) # $100, no units bob = participant.Participant("Bob", 0, 120) # $0, 120 units sim = simulation.Simulation("My Simulation", [], [alice, bob]) sim.load("order_flow.csv") # load our order flow from CSV file sim.run() print(sim)

This gives us our summary:

Simulation My Simulation --- Statement of Accounts Alice: $100.0 with 0 units Bob: $0.0 with 120 units --- Market as at present 'GOOG'

If we want to inspect the book for GOOG:

print(sim.books["GOOG"])

We get:

Book for GOOG Spread is $0.5 === Ask Price Quantity -------------------------------------------------------------------------------- $1.0 100 | |$0.5 10 -------------------------------------------------------------------------------- Price Quantity Bid

🔗 More in this category

© 2026 GitRepoTrend · jmcph4/PyOBSim · Updated daily from GitHub