Record committed best-bid and ask changes for resumable quote history

This commit is contained in:
2026-12-03 04:59:47 +08:00
parent e397f21321
commit a77efc6bb8
9 changed files with 258 additions and 10 deletions
+3 -1
View File
@@ -12,7 +12,8 @@ pub(crate) fn transaction(
let tx = Transaction::new_unchecked(db, behavior)?;
let due: bool = tx.query_row(
"SELECT EXISTS(SELECT 1 FROM order_deadlines WHERE pending=1 AND expiration<=unixepoch()+60)
OR EXISTS(SELECT 1 FROM twap_markets WHERE pending_close=1 AND end_at<=unixepoch())",
OR EXISTS(SELECT 1 FROM twap_markets WHERE pending_close=1 AND end_at<=unixepoch())
OR EXISTS(SELECT 1 FROM quote_pending)",
[], |row| row.get(0),
)?;
if !due {
@@ -44,6 +45,7 @@ pub(crate) fn transaction(
for market in markets {
crate::market::close_market(&write, &market)?;
}
crate::quotes::flush(&write)?;
write.commit()?;
}
}