Stream committed trades and tick transitions to market subscribers
This commit is contained in:
@@ -24,6 +24,7 @@ mod ledger;
|
||||
mod lots;
|
||||
mod market;
|
||||
mod market_amounts;
|
||||
mod market_stream;
|
||||
mod minimum_size;
|
||||
mod neg_risk;
|
||||
mod open_interest;
|
||||
@@ -95,6 +96,10 @@ impl Exchange {
|
||||
if !depth_ready {
|
||||
db.execute_batch(include_str!("depth_schema.sql"))?;
|
||||
}
|
||||
let stream_ready:bool=db.query_row("SELECT EXISTS(SELECT 1 FROM sqlite_schema WHERE type='table' AND name='market_stream_events')",[],|r|r.get(0))?;
|
||||
if !stream_ready {
|
||||
db.execute_batch(include_str!("market_stream_schema.sql"))?;
|
||||
}
|
||||
let tx = expiry::transaction(&db, TransactionBehavior::Deferred)?;
|
||||
let books = Books::recover(&tx)?;
|
||||
tx.commit()?;
|
||||
@@ -112,7 +117,7 @@ impl Exchange {
|
||||
|
||||
pub fn market_stream_page(&mut self, market: &str, after: Option<i64>) -> Result<MarketPage> {
|
||||
let tx = expiry::transaction(&self.db, TransactionBehavior::Deferred)?;
|
||||
let page = depth_feed::Request::wire(market, after).page(&tx, &mut self.books, true)?;
|
||||
let page = market_stream::page(&tx, &mut self.books, market, after)?;
|
||||
tx.commit()?;
|
||||
Ok(page)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user