Skip to content

Fix: batch CoinGecko token price requests - #91

Open
munikes wants to merge 1 commit into
Railgun-Community:mainfrom
munikes:fix/coingecko-batch-requests
Open

Fix: batch CoinGecko token price requests#91
munikes wants to merge 1 commit into
Railgun-Community:mainfrom
munikes:fix/coingecko-batch-requests

Conversation

@munikes

@munikes munikes commented Aug 6, 2026

Copy link
Copy Markdown

Problem

coingeckoPriceLookup fetches each token's price with a separate HTTP request, looping through addresses one by one with a 250ms delay between each — even though CoinGecko's simple/token_price/{id} endpoint natively supports comma-separated contract_addresses in a single call (confirmed: up to 30 addresses per request on the free Demo tier).

For a broadcaster running 3 active networks (~6-8 tokens each), this means ~20 requests per refresh cycle. With the default 60-second refresh interval, that's roughly 970 requests/hour — enough to exhaust the Demo tier's 10,000 requests/month quota in about 10 hours of uptime.

Fix

  • Join all token addresses for a network into a single comma-separated contract_addresses param, cutting requests-per-cycle from ~N tokens to 1 per network.
  • Lowered batchSize from 50 to 30 to match CoinGecko's documented Demo tier limit (50 addresses/request would only be safe on paid tiers).

Impact

For a typical 3-network broadcaster, this drops CoinGecko usage from ~20 requests/cycle to ~3 requests/cycle (~85% reduction), making the free Demo tier actually viable for continuous operation.

coingeckoPriceLookup was making one HTTP request per token address in
a loop with a 250ms delay, despite CoinGecko's simple/token_price
endpoint natively supporting comma-separated contract_addresses in a
single call. For a broadcaster running 3 networks with ~6-8 tokens
each, this meant ~20 requests per refresh cycle (every ~60s) instead
of 3 — burning through the free Demo tier's 10,000 requests/month
quota in about 10 hours of uptime.

Also lowered batchSize from 50 to 30 to match CoinGecko's documented
Demo tier limit of 30 addresses per request (50 would only be safe on
paid tiers).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant