From 5ccbd3288b95c379dc6c8af97f24e9be65ba5597 Mon Sep 17 00:00:00 2001 From: 6figpsolseeker <6figpsolseeker@gmail.com> Date: Thu, 9 Apr 2026 16:22:20 -0400 Subject: [PATCH] fix(markets): add missing columns to stats endpoints per OpenAPI schema MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both /markets/stats and /markets/:slab/stats selected only 10 columns from market_stats / markets_with_stats, but the OpenAPI MarketStats schema documents 14 fields. The missing columns — lp_sum_abs, lp_max_abs, insurance_balance, insurance_fee_revenue, volume_24h — are present in the DB tables (queried successfully by insurance.ts, open-interest.ts, stats.ts, trades.ts) but were omitted from the stats endpoint select clauses. API consumers relying on the documented schema would receive null/missing values for LP statistics, insurance fund data, and 24h volume — breaking risk analytics and dashboard integrations. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/routes/markets.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/markets.ts b/src/routes/markets.ts index fa4703a..253064e 100644 --- a/src/routes/markets.ts +++ b/src/routes/markets.ts @@ -83,7 +83,7 @@ export function marketRoutes(): Hono { try { const { data, error } = await getSupabase() .from("markets_with_stats") - .select("slab_address, total_open_interest, total_accounts, last_crank_slot, last_price, mark_price, index_price, funding_rate, net_lp_pos, updated_at") + .select("slab_address, total_open_interest, total_accounts, last_crank_slot, last_price, mark_price, index_price, funding_rate, net_lp_pos, lp_sum_abs, lp_max_abs, insurance_balance, insurance_fee_revenue, volume_24h, updated_at") .eq("network", getNetwork()) .not("slab_address", "is", null); if (error) throw error; @@ -102,7 +102,7 @@ export function marketRoutes(): Hono { try { const { data, error } = await getSupabase() .from("market_stats") - .select("slab_address, total_open_interest, total_accounts, last_crank_slot, last_price, mark_price, index_price, funding_rate, net_lp_pos, updated_at") + .select("slab_address, total_open_interest, total_accounts, last_crank_slot, last_price, mark_price, index_price, funding_rate, net_lp_pos, lp_sum_abs, lp_max_abs, insurance_balance, insurance_fee_revenue, volume_24h, updated_at") .eq("slab_address", slab) .single(); if (error && error.code !== "PGRST116") throw error;