Skip to content

/volumes/:asset aggregates across both networks #157

Description

@Miracle656

GET /volumes/:asset sums base_volume/counter_volume from price_points with no network filter:

WHERE (asset_a = $1 OR asset_b = $1)
  AND timestamp >= $2
GROUP BY source

That was harmless while one process indexed one chain. Since #117 the ingesters run one loop per enabled network into the same table, so a dual-network deployment now returns testnet and mainnet volume added together, silently and with no indication in the response.

Surfaced while reworking #95, where the same gap was fixed for /spreads.

What to do

Mirror what /spreads/:asset now does:

  • accept ?network=testnet|mainnet, defaulting to activeNetwork;
  • reject an unrecognised value with a 400 rather than falling back;
  • add AND network = $n to the query;
  • echo the resolved network in the response body, so a caller can tell what they got.

Worth checking at the same time

Any other route reading price_points directly without a network predicate — /screener, /benchmark and /basket are the likely candidates.

Acceptance criteria

  • /volumes/:asset returns only the requested network's volume
  • Unknown network → 400, no query issued
  • Response names the network it answered for
  • A test asserting two networks' rows do not pool

Complexity: Easy

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions