Expose paginated wallet activity from trades, position operations and redemptions
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
mod account_orders;
|
||||
mod account_trades;
|
||||
mod activity;
|
||||
mod assets;
|
||||
mod augmented;
|
||||
mod catalog;
|
||||
@@ -34,6 +35,13 @@ impl Exchange {
|
||||
db.busy_timeout(Duration::from_secs(10))?;
|
||||
db.execute_batch("PRAGMA foreign_keys=ON")?;
|
||||
db.execute_batch(include_str!("schema.sql"))?;
|
||||
let activity_ready: bool = db.query_row(
|
||||
"SELECT EXISTS(SELECT 1 FROM sqlite_schema WHERE type='table' AND name='wallet_migration')",
|
||||
[], |r| r.get(0),
|
||||
)?;
|
||||
if !activity_ready {
|
||||
db.execute_batch(include_str!("activity_schema.sql"))?;
|
||||
}
|
||||
let tx = expiry::transaction(&db, TransactionBehavior::Deferred)?;
|
||||
let books = Books::recover(&tx)?;
|
||||
tx.commit()?;
|
||||
@@ -54,6 +62,7 @@ impl Exchange {
|
||||
| "open_orders"
|
||||
| "positions"
|
||||
| "trades"
|
||||
| "activity"
|
||||
| "resolution"
|
||||
)
|
||||
) {
|
||||
@@ -126,7 +135,7 @@ impl Exchange {
|
||||
let command = serde_json::from_value(body)?;
|
||||
let external = self.books.changes(&tx)?;
|
||||
self.books.apply(external);
|
||||
let result = market::apply(&tx, &self.books, command)?;
|
||||
let result = market::apply(&tx, &self.books, command, id)?;
|
||||
tx.execute(
|
||||
"INSERT INTO requests VALUES(?,?,?)",
|
||||
params![id, payload.to_string(), result.to_string()],
|
||||
|
||||
Reference in New Issue
Block a user