Zero Intelligence Agent-Based Model of Modern Limit Order Book
Charles Collver, PhD
See the Project Website for more details and radicalmarketsimulation for a more general discussion of applying agent-based modeling to financial markets.
If you just want to install and run a quick simulation: conda install -c dennycrane pyziabm
In a Jupyter Notebook or iPython command line:
import pyziabm as pzi
pzi.Runner()
will call the simulation with the defaults. To change the defaults and run several in a loop see the runwrapper files detailed below. To keep all of the data from one simulation in memory, assign to a variable:
sim1 = pzi.Runner()
There are seven files:
- orderbook3.py
- trader2017_r3.py
- runner2017mpi_r3.py
- runner2017mpi_r4.py
- runwrapper2017mpi_r3.py
- runwrapper2017mpi_r3x.py
- runwrapper2017mpi_r4.py
- Contains the Orderbook class.
- Instances track, process and match orders.
- Imported by runner2017mpi_r3.py.
- Contains the base ZITrader class and six subclasses: PennyJumper, Taker, Provider, Provider5, MarketMaker, MarketMaker5.
- There is also an InformedTrader, but it is yet unimplemented. See pyziabmc for more details.
- Imported by runner2017mpi_r3.py and runner2017mpi_r4.py.
- Contains the Runner class.
- Instances set up and run 1 simulation.
- Note: the __init__() in runner2017mpi_r3.py uses all keywords - these are the defaults. User can change them here or override them when instantiating in __main__().
- Note: User should specify proper paths for saving output.
- Imported by runwrapper2017mpi_r3.py or runwrapper2017mpi_r4.py.
- Runs the simulations in a loop, does some summary output bookkeeping.
- Note: User should specify proper paths for saving output.
- An example of a Unix executable version of runwrapper2017mpi_r3.py.
- Note: User should specify proper paths for the python executable and saving output.
There are two test files:
- testOrderbook3.py
- testTrader2017_r3.py
There are several Jupyter Notebooks that should work with minimal changes to the directories.