Market Model API¶
The lumina_lob.market_model package separates the fundamental reference price from market impact.
lumina_lob.market_model.reference_price
¶
Reference price process for simulated markets.
Models the latent fair price as a discrete-time jump-diffusion:
log(S_{t+1}) = log(S_t) + (mu - 0.5*sigma^2)*dt + sigma*sqrt(dt)*Z + J
where Z ~ N(0, 1) and J is a compound Poisson jump with log-normal jump size. The price is floored at a small positive epsilon to avoid zero/negative quotes.
Classes¶
ReferencePriceProcess
dataclass
¶
Discrete-time jump-diffusion reference price simulator.
Parameters¶
initial_price: Starting reference price. Must be positive. drift: Instantaneous drift (per unit time). Default 0.0. volatility: Instantaneous volatility (per unit time). Must be non-negative. Default 0.2. dt: Time step size. Must be positive. Default 1.0. jump_intensity: Expected number of jumps per unit time. Must be non-negative. Default 0.0. jump_mean: Mean of the log jump size. Default 0.0. jump_std: Standard deviation of the log jump size. Must be non-negative. Default 0.05. seed: Optional RNG seed for reproducibility. min_price: Floor for the price path. Default 0.0001.
Source code in lumina_lob/market_model/reference_price.py
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 | |
Attributes¶
path
property
¶
Full price history including the initial price.
price
property
¶
Current reference price.
Methods:¶
reset(price=None)
¶
Reset the process to the initial price or a new price.
Source code in lumina_lob/market_model/reference_price.py
simulate(n_steps)
¶
Simulate n_steps ahead and return the full path.
Source code in lumina_lob/market_model/reference_price.py
step()
¶
Advance one time step and return the new price.
Source code in lumina_lob/market_model/reference_price.py
lumina_lob.market_model.impact
¶
Market impact models: propagator and Almgren-Chriss style impact.
Classes¶
AlmgrenChrissImpact
dataclass
¶
Almgren-Chriss permanent and temporary market impact model.
Parameters¶
gamma: Permanent impact coefficient. Default 0.0. eta: Temporary impact coefficient. Default 0.0. sigma: Volatility of the asset. Default 0.0. dt: Time step. Default 1.0.
Source code in lumina_lob/market_model/impact.py
Methods:¶
apply(signed_volume, reference_price)
¶
Return reference price adjusted by permanent and temporary impact.
Source code in lumina_lob/market_model/impact.py
drift()
¶
PropagatorImpact
dataclass
¶
Propagator-style temporary and permanent market impact.
Trade at time t moves the reference price by a permanent component plus a temporary component that decays geometrically over subsequent steps.
Parameters¶
permanent_impact: Permanent impact coefficient per unit volume. Default 0.0. temporary_impact: Immediate temporary impact coefficient per unit volume. Default 0.0. decay: Decay factor for temporary impact in (0, 1]. Default 0.5.
Source code in lumina_lob/market_model/impact.py
Methods:¶
apply(signed_volume, reference_price)
¶
Return the total price impact for a trade at the current step.
The impact is expressed as a signed price displacement. Positive signed volume (buying) pushes the price up; negative volume (selling) pushes it down.