SPB Git forge
1commits 1branches 0releases
189.0 KBsize
maindefault branch
3 h agolast push
Python 54.7% TypeScript 42.5% SQL 1.9%

fix(preflight): validate-only probe uses GTC (GTD needs expiretm)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Simon-Pierre Boucher committed 3 h ago (Oct 22, 2026) parent fd55456

2 changed files +2 −2

modified apps/api/ktrade/api/routes/system.py +1 −1
@@ -107,7 +107,7 @@ async def balance(st: AppState = Depends(get_state), _=Depends(require_owner)):
107 107 @router.post("/account/preflight")
108 108 async def preflight(st: AppState = Depends(get_state), _=Depends(require_owner)):
109 109 """Probe what the configured keys can do. Trade permission is probed with AddOrder validate=true on an
110 − order that could never fill (limit buy at 10% of market, min size, expires in 5 s) — logged to the audit trail."""
110 + order that could never fill (limit buy at 10% of market, min size; validate=true never reaches the engine) — logged to the audit trail."""
111 111 from ktrade.execution.preflight import run_preflight
112 112
113 113 res = await run_preflight(st)
modified apps/api/ktrade/execution/preflight.py +1 −1
@@ -50,7 +50,7 @@ async def _trade_probe(rest: KrakenREST) -> dict[str, Any]:
50 50 tick = await rest.ticker(["XXBTZUSD"])
51 51 last = Decimal(next(iter(tick.values()))["c"][0])
52 52 price = (last * Decimal("0.10")).quantize(Decimal("0.1"))
53 − r = await rest.add_order(pair="XXBTZUSD", side="buy", ordertype="limit", volume="0.0001", price=str(price), timeinforce="GTD", validate=True)
53 + r = await rest.add_order(pair="XXBTZUSD", side="buy", ordertype="limit", volume="0.0001", price=str(price), timeinforce="GTC", validate=True)
54 54 return {"has_trade_permission": True, "validated": r.get("descr")}
55 55 except KrakenAPIError as e:
56 56 if e.is_permission:
57 57