Model sports events and market rules and persist trade price history

This commit is contained in:
2026-12-03 03:30:07 +08:00
parent ca45f83038
commit 9708d701c2
9 changed files with 386 additions and 1 deletions
+8
View File
@@ -1,3 +1,4 @@
mod catalog;
mod validation;
use validation::identifier;
mod book;
@@ -29,6 +30,13 @@ impl Exchange {
}
pub fn execute(&mut self, payload: Value) -> Result<Value> {
if matches!(payload["op"].as_str(), Some("catalog" | "history")) {
let query: catalog::Query = serde_json::from_value(payload)?;
let tx = self.db.transaction()?;
let value = query.read(&tx)?;
tx.commit()?;
return Ok(value);
}
if payload == json!({"op":"state"}) {
let tx = self.db.transaction()?;
let mut state = Map::new();