Reconcile precise collateral funding, fee debits and available cash

This commit is contained in:
2026-12-03 06:30:11 +08:00
parent 2fcdac61d5
commit 14ccc97e09
14 changed files with 207 additions and 41 deletions
+3 -1
View File
@@ -106,9 +106,11 @@ impl Filter {
.map(|(m, o)| assets::id(m, o));
let fee: i64 = r.get(14)?;
let cash: i64 = r.get(9)?;
let precise_deposit: Option<i64> = r.get(15)?;
let gross = precise_deposit.map_or(i128::from(cash) * 10000, i128::from);
items.push(json!({"type":r.get::<_,String>(5)?,"account":self.account,"at_ms":r.get::<_,Option<i64>>(4)?,
"market":market,"group":r.get::<_,Option<String>>(7)?,"asset_id":asset,"outcome":outcome,
"shares":r.get::<_,Option<i64>>(8)?,"cash_delta_cents":cash,"fee_micros":fee,"net_cash_delta_micros":i128::from(cash)*10000-i128::from(fee),
"shares":r.get::<_,Option<i64>>(8)?,"cash_delta_cents":cash,"fee_micros":fee,"net_cash_delta_micros":gross-i128::from(fee),
"side":r.get::<_,Option<String>>(12)?,"price_micros":r.get::<_,Option<i64>>(13)?.map(|p|p*10000),
"request_id":r.get::<_,Option<String>>(10)?,"execution":(source==1).then_some(seq),"order":(source==1).then_some(leg)}));
last = Some(Cursor {