Commit edcd2aa
authored
smooth the synthetic event generator: tight band around a slow random walk, lower default rate (#23)
The original generator placed every new limit order at a uniformly
random integer price in [95, 105] and ran the engine at 50,000
events per second. On the desktop bench this is fine; on the Twilight
dashboard wired to the live Fly machine it looks like the top of
book is glitching across 100 different values per second, because
that is literally what is happening.
Replace the price distribution with a mean-reverting random walk
around a fixed anchor (kAnchor = 100). Each event nudges the
reference by at most one tick, and the away-from-anchor step is
suppressed when the reference has drifted off the anchor. New limit
orders cluster within four ticks of the reference, so the resting
book builds depth at a handful of adjacent levels rather than
scattering across the whole price range. The event mix favors limit
orders more heavily (80 percent limits, 8 percent market sweeps,
12 percent cancels) so the visible book accumulates depth between
fills.
Drop the default rate from 50000 to 400 events per second. The bench
binary is the right place to push throughput; the live demo runs at
a rate the React renderer can show legibly. Update fly.toml's
MERIDIAN_RATE accordingly.
Local smoke (60 frames over 10 s against the rebuilt server, seed 7):
mid visited values: 99.5, 100.0, 100.5
bid/ask pairs alternate between (100,101), (99,101), (99,100)
That is one to two ticks of organic movement, not flashing across
the whole 10-tick range. 182/182 release tests still pass.1 parent 7de1eb2 commit edcd2aa
2 files changed
Lines changed: 64 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
55 | 60 | | |
56 | 61 | | |
57 | 62 | | |
| |||
198 | 203 | | |
199 | 204 | | |
200 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
201 | 215 | | |
202 | 216 | | |
203 | | - | |
204 | | - | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
205 | 225 | | |
206 | 226 | | |
207 | 227 | | |
| |||
220 | 240 | | |
221 | 241 | | |
222 | 242 | | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
223 | 264 | | |
224 | | - | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
225 | 269 | | |
226 | 270 | | |
227 | 271 | | |
228 | | - | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
229 | 276 | | |
230 | 277 | | |
231 | | - | |
| 278 | + | |
| 279 | + | |
232 | 280 | | |
233 | 281 | | |
234 | 282 | | |
235 | 283 | | |
236 | 284 | | |
237 | 285 | | |
238 | 286 | | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
239 | 291 | | |
240 | 292 | | |
241 | 293 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
26 | 31 | | |
27 | 32 | | |
28 | 33 | | |
| |||
0 commit comments