Serve subscribed order book updates over a market WebSocket
This commit is contained in:
@@ -94,8 +94,13 @@ pub(crate) fn read(tx: &Transaction, books: &mut Books, token: &str) -> Result<V
|
||||
Ok(serde_json::to_value(build(tx, books, token)?)?)
|
||||
}
|
||||
|
||||
pub(crate) fn event(tx: &Transaction, books: &Books, token: &str) -> Result<Value> {
|
||||
pub(crate) fn event(tx: &Transaction, books: &Books, token: &str, raw: bool) -> Result<Value> {
|
||||
let s = build(tx, books, token)?;
|
||||
if raw {
|
||||
let mut frame = serde_json::to_value(s)?;
|
||||
frame["event_type"] = json!("book");
|
||||
return Ok(frame);
|
||||
}
|
||||
let stamp: String = tx.query_row(
|
||||
"SELECT strftime('%Y-%m-%dT%H:%M:%f000Z',?1/1000.0,'unixepoch')",
|
||||
[&s.timestamp],
|
||||
|
||||
Reference in New Issue
Block a user