fix: market expiry guard, FAK orders, 2% slippage, sanitize CLOB logs
Market expiry guard (executor.js): - getMarketOptions() now returns endDateIso, active, acceptingOrders from Gamma API response - executeBuy() skips immediately if market is closed / not accepting orders - executeBuy() skips if market closes within MIN_MARKET_TIME_LEFT seconds (default 300 s = 5 min), logging exact time remaining - Add MIN_MARKET_TIME_LEFT to config and .env.example FAK + 2% slippage (executor.js): - Replace OrderType.FOK with OrderType.FAK for both BUY and SELL market orders — eliminates "FOK fully filled or killed" failures - Reduce slippage from 5% to 2% (price * 1.02 / price * 0.98) - Fix zero-fill detection: FAK success with 0 shares logs "no liquidity" and retries instead of recording a phantom fill CLOB log sanitization (logger.js + index.js): - Add sanitizeClobMessage(): strips axios config object (auth headers) from [CLOB Client] dumps, keeps only HTTP status + error string - Add interceptConsole(): overrides console.error/warn globally - Call interceptConsole() at startup in index.js Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
526076fe6e
commit
69d8d1401d
@@ -11,6 +11,7 @@ import logger from './utils/logger.js';
|
||||
// ── Dashboard init (before any log output) ────────────────────────────────────
|
||||
initDashboard();
|
||||
logger.setOutput(appendLog);
|
||||
logger.interceptConsole(); // strip auth headers from CLOB client axios error dumps
|
||||
|
||||
// ── Handle a trade event from WebSocket ───────────────────────────────────────
|
||||
async function handleTrade(trade) {
|
||||
|
||||
Reference in New Issue
Block a user