diff --git a/src/app/api/fee-compare/route.ts b/src/app/api/fee-compare/route.ts index b1c1c7e1..f13b0730 100644 --- a/src/app/api/fee-compare/route.ts +++ b/src/app/api/fee-compare/route.ts @@ -3,7 +3,7 @@ import { clientKey, rateLimit, tooManyRequests } from "@/lib/rate-limit"; import { keccak256 } from "js-sha3"; export const runtime = "nodejs"; -export const maxDuration = 30; +export const maxDuration = 50; const HL_API = "https://api.hyperliquid.xyz/info"; const GAINS_VARS_URL = "https://backend-arbitrum.gains.trade/trading-variables"; @@ -499,23 +499,7 @@ async function fetchDydxFills(dydxAddress: string, cutoffMs: number): Promise; - }; - for (const p of pfBody.positions ?? []) { - fundingUsd += parseFloat(p.netFunding ?? "0"); - } - } - } catch { /* funding is optional */ } - + // Only count taker fills — maker fees are rebates and distort the comparison const takers = allFills.filter((f) => (f.liquidity ?? "").toUpperCase() !== "MAKER"); let feesUsdc = 0; let notionalUsd = 0; @@ -523,13 +507,12 @@ async function fetchDydxFills(dydxAddress: string, cutoffMs: number): Promise 0 ? (feesUsdc / notionalUsd) * 10000 : 0, }; @@ -540,7 +523,7 @@ async function fetchGainsTrades(wallet: string, cutoffMs: number): Promise - dYdX v4: public indexer with full pagination and date filter. Funding from{" "} - perpetualPositions.netFunding. Address must be{" "} + dYdX v4: public indexer with full pagination and date filter. Taker fills only. Funding excluded (not date-scopable from public API). Address must be{" "} dydx1... Cosmos format.{" "} )}