Publish resumable price-level updates from committed book changes

This commit is contained in:
2026-12-03 07:28:58 +08:00
parent b1fe4c2fd5
commit 6b50266300
11 changed files with 290 additions and 4 deletions
+8
View File
@@ -4,6 +4,7 @@ mod activity;
mod assets;
mod augmented;
mod catalog;
mod depth_feed;
mod estimate;
mod expiry;
mod fees;
@@ -86,6 +87,11 @@ impl Exchange {
if !snapshot_ready {
db.execute_batch(include_str!("book_snapshot_schema.sql"))?;
}
let depth_ready: bool = db.query_row(
"SELECT EXISTS(SELECT 1 FROM sqlite_schema WHERE type='table' AND name='depth_batches')", [], |r| r.get(0))?;
if !depth_ready {
db.execute_batch(include_str!("depth_schema.sql"))?;
}
let tx = expiry::transaction(&db, TransactionBehavior::Deferred)?;
let books = Books::recover(&tx)?;
tx.commit()?;
@@ -130,6 +136,7 @@ impl Exchange {
| "prices"
| "quote_history"
| "volume"
| "book_feed"
| "clob_book"
| "book"
| "open_orders"
@@ -235,6 +242,7 @@ impl Exchange {
"INSERT INTO requests VALUES(?,?,?)",
params![id, payload.to_string(), result.to_string()],
)?;
depth_feed::flush(&tx)?;
let changes = self.books.changes(&tx)?;
tx.commit()?;
self.books.apply(changes);