Simulation API¶
The lumina_lob.simulation module orchestrates the engine, agents, and market model.
lumina_lob.simulation
¶
Simulation orchestrator: runs agents and matching engine through time.
Classes¶
Simulation
¶
Orchestrate a multi-agent limit order book simulation.
A Simulation owns one OrderBook, one MatchingEngine, one
ReferencePriceProcess, and a list of Agent instances. At each
discrete time step the reference price is advanced, every agent is asked
for orders, and those orders are submitted to the matching engine. Fill
notifications are routed back to agents that implement on_fill (e.g.
market makers updating inventory).
Parameters¶
book:
OrderBook to use. A fresh book is created if omitted.
engine:
MatchingEngine to use. Created from book if omitted.
reference_price:
ReferencePriceProcess to use. Created with default parameters if
omitted. If seed is also provided it is passed to the default
process.
agents:
List of Agent instances participating in the simulation.
seed:
Optional RNG seed for the default ReferencePriceProcess.
Source code in lumina_lob/simulation.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | |
Methods:¶
run(n_steps)
¶
Run n_steps and return the full history list.
Source code in lumina_lob/simulation.py
step()
¶
Advance the simulation by one time step.
Returns¶
A dictionary of metrics for the step:
step, reference_price, best_bid, best_ask,
mid_price, spread, trade_count, trade_volume,
book_size.