Serve SDK-compatible order book snapshots from resident depth
This commit is contained in:
@@ -14,6 +14,7 @@ mod validation;
|
||||
mod volume;
|
||||
use validation::identifier;
|
||||
mod book;
|
||||
mod book_snapshot;
|
||||
mod cancellation;
|
||||
mod command;
|
||||
mod inventory;
|
||||
@@ -80,6 +81,11 @@ impl Exchange {
|
||||
db.execute_batch(include_str!("valuation_schema.sql"))?;
|
||||
}
|
||||
lots::migrate(&mut db)?;
|
||||
let snapshot_ready: bool = db.query_row(
|
||||
"SELECT EXISTS(SELECT 1 FROM sqlite_schema WHERE type='table' AND name='book_snapshot_times')", [], |r| r.get(0))?;
|
||||
if !snapshot_ready {
|
||||
db.execute_batch(include_str!("book_snapshot_schema.sql"))?;
|
||||
}
|
||||
let tx = expiry::transaction(&db, TransactionBehavior::Deferred)?;
|
||||
let books = Books::recover(&tx)?;
|
||||
tx.commit()?;
|
||||
@@ -124,6 +130,7 @@ impl Exchange {
|
||||
| "prices"
|
||||
| "quote_history"
|
||||
| "volume"
|
||||
| "clob_book"
|
||||
| "book"
|
||||
| "open_orders"
|
||||
| "positions"
|
||||
|
||||
Reference in New Issue
Block a user