[object Object]

← back to Ken

Ken: gate manual create_order endpoint on safe_mode too (close the non-autoTrader real-order path)

af4870ccb0c31d0d5750f1317d6ca6ec47568633 · 2026-07-14 08:51:27 -0700 · Steve Abrams

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Files touched

Diff

commit af4870ccb0c31d0d5750f1317d6ca6ec47568633
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Tue Jul 14 08:51:27 2026 -0700

    Ken: gate manual create_order endpoint on safe_mode too (close the non-autoTrader real-order path)
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
 kalshi-dash/server.js | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/kalshi-dash/server.js b/kalshi-dash/server.js
index 208a7ba..0e39edd 100644
--- a/kalshi-dash/server.js
+++ b/kalshi-dash/server.js
@@ -911,6 +911,14 @@ const routes = {
 
         // ── Create Order (auth required) ──
         case 'create_order': {
+          // safe/paper gate — a REAL prod order via this manual endpoint is blocked
+          // whenever safe_mode is ON (default true). autoTrader is separately gated;
+          // this closes the manual path so no real money moves without a deliberate
+          // safe_mode=false toggle. (Steve's safe/paper choice — 2026-07-14.)
+          const rsGate = await q('SELECT config FROM risk_state ORDER BY updated_at DESC LIMIT 1');
+          if ((rsGate.rows[0]?.config?.safe_mode ?? true)) {
+            return json(res, { error: 'safe_mode is ON — real-money orders are blocked (safe/paper). Toggle safe_mode off to place live orders.' }, 403);
+          }
           if (!body.ticker || !body.side || !body.action || !body.type || !body.count) {
             return json(res, { error: 'ticker, side, action, type, and count are required' }, 400);
           }

← 6fc1f52 Ken: enforce safe/paper — autoTrader honors safe_mode + mast  ·  back to Ken  ·  Ken: bounded live-run controls — $/day spend cap + auto-off 1bdf579 →