Closed cdummett closed 6 months ago
I'm confused @cdummett, Are you sure your check is done right? take a look at this run for example: https://jenkins.vega.rocks/blue/organizations/jenkins/common%2Fvega-market-sim-reinforcement/detail/vega-market-sim-reinforcement/270/pipeline/
it fails claiming:
ERROR - Market b4a51a in TRADING_MODE_CONTINUOUS but greatest bid > smallest ask (1489.00 > 1487.42)
I'm assuming you stop as soon as you see a crossed market data, but if you look at the market data on the last block in the run for that market:
it's not crossed, and even if it were, it's in a monitoring auction. So what's going on?
this is the replay file tail:
Looking at all the events from this market the bid and ask are never crossed when the market is not in an auction so not sure where this failure is coming from. Can you please double check the simulator code?
ok, more insights: the "crossing" happens when an order is submitted, matched but then can't cover the fees. This can happen because the order is a market order which is matched against a ridiculously large bid price - so the fee is high, higher than what the party has in their general + margin account so the aggressor order which has already gone in the book is matched with the passive order which has hence already been taken out of the book. The result is that the trade isn't done, but the passive order is gone from the book and data node is none the wiser. In addition a bonus is that this can (and does) leave the order book with headless pegged orders, with nothing to peg to until something gets them repriced.
Problem encountered
Market-sim PR introduces a check which queries the market depth API whilst a market is in continuous trading and asserts the greatest bid price is smaller than the smallest ask price.
The check is currently on scenarios including the fuzzing runs.
Local run failed with a crossed order book:
vega-sim-ag8ruz_l.zip
Note: CI run in progress, will hopefully fail with same error. https://jenkins.vega.rocks/job/common/job/vega-market-sim-reinforcement/268/
Observed behaviour
Expected behaviour
Steps to reproduce
Software version
feature/enable-isolated-margin
Failing test
vega-market-sim fuzz test
Jenkins run
No response
Configuration used
Relevant log output