← back to Ken
Ken: TEMP debug probe — log any settle crediting >$50 (returned/cost/pnl/price/qty) to isolate the residual ~100x over-credit that survives the idempotency fix
2e710216e152a22a0b49154dc581fc3f2e0a22a7 · 2026-08-03 09:48:56 -0700 · steve@designerwallcoverings.com
Files touched
Diff
commit 2e710216e152a22a0b49154dc581fc3f2e0a22a7
Author: steve@designerwallcoverings.com <steve@designerwallcoverings.com>
Date: Mon Aug 3 09:48:56 2026 -0700
Ken: TEMP debug probe — log any settle crediting >$50 (returned/cost/pnl/price/qty) to isolate the residual ~100x over-credit that survives the idempotency fix
---
kalshi-dash/server.js | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kalshi-dash/server.js b/kalshi-dash/server.js
index 61c439f..bb142ca 100644
--- a/kalshi-dash/server.js
+++ b/kalshi-dash/server.js
@@ -9020,6 +9020,9 @@ async function resolvePortfolioTrades() {
const wonInc = status === 'won' ? 1 : 0;
const lostInc = status === 'lost' ? 1 : 0;
const expInc = status === 'expired' ? 1 : 0;
+ // TEMP DEBUG 2026-08-03: hunt the residual ~100x over-credit. A single settle should
+ // return <= cost+pnl (<= ~$26). Anything bigger means returned/cost/pnl are wrong at runtime.
+ if (returned > 5000) console.error(`[Ken/DEBUG] BIG-CREDIT trade=${trade.id} returned=${returned} cost=${trade.cost_cents} pnl=${pnl} price=${currentPrice} qty=${trade.contracts} entry=${trade.entry_price_cents} status=${status}`);
await kenQ(`
UPDATE ken_portfolios SET
balance_cents = balance_cents + $1,
← 811d382 chore: gitignore runtime data, v1.0.1 (session close)
·
back to Ken
·
Ken: ROOT-CAUSE the paper over-credit — node-postgres return eb2e485 →