From 0650cb9ef778e225489abe5e3a172b2d2239121c Mon Sep 17 00:00:00 2001 From: direkturcrypto Date: Wed, 25 Feb 2026 03:49:38 +0700 Subject: [PATCH] fix: correct Gamma API field names in getMarketOptions (all camelCase) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Gamma API returns camelCase field names but the code used snake_case, causing all lookups to return undefined: - end_date_iso → endDate (full ISO datetime, not date-only endDateIso) - game_start_time → removed (field doesn't exist) - minimum_tick_size → orderPriceMinTickSize - neg_risk → negRisk - condition_id → conditionId - accepting_orders → acceptingOrders Because endDate was always null, the MIN_MARKET_TIME_LEFT expiry guard was silently skipped on every buy — allowing buys into expired markets. Co-Authored-By: Claude Sonnet 4.6 --- src/services/executor.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/services/executor.js b/src/services/executor.js index a9f37f1..328a705 100644 --- a/src/services/executor.js +++ b/src/services/executor.js @@ -56,13 +56,13 @@ async function getMarketOptions(tokenId) { const marketInfo = await fetchMarketByTokenId(tokenId); if (marketInfo) { return { - tickSize: String(marketInfo.minimum_tick_size || '0.01'), - negRisk: marketInfo.neg_risk || false, - conditionId: marketInfo.condition_id || '', - question: marketInfo.question || '', - endDateIso: marketInfo.end_date_iso || marketInfo.game_start_time || null, - active: marketInfo.active !== false, - acceptingOrders: marketInfo.accepting_orders !== false, + tickSize: String(marketInfo.orderPriceMinTickSize || '0.01'), + negRisk: marketInfo.negRisk || false, + conditionId: marketInfo.conditionId || '', + question: marketInfo.question || '', + endDateIso: marketInfo.endDate || null, + active: marketInfo.active !== false, + acceptingOrders: marketInfo.acceptingOrders !== false, }; } } catch (err) {