Skip to content

Support LocalDB as a data source for Order Detail “Volume” tab #2374

@findolor

Description

@findolor

Issue: Support LocalDB as a data source for Order Detail “Volume” tab

Summary

The Order Detail Volume tab currently relies on the subgraph to fetch trades and compute vault volumes. When LocalDB is configured and has indexed the relevant trades, the Volume tab still does not use it, which adds latency and makes the feature unavailable when the subgraph is slow/unreachable.

Problem

  • RaindexOrder.getVaultsVolume(...) currently computes volumes via the subgraph client path only.
  • This means users cannot benefit from LocalDB’s locally indexed trade deltas for faster, offline/low-latency volume results.
  • We need volume results to be available from LocalDB when LocalDB is enabled and contains the required data, without changing the public JS/WASM API.

Requirements

  • Preserve existing volume semantics:
    • trade deltas are hex Float
    • positive = in, negative = out
    • totalVol = totalIn + totalOut
    • netVol = totalIn - totalOut (signed)
  • Keep APY out of scope.
  • Keep the external API unchanged:
    • RaindexOrder.getVaultsVolume(startTimestamp?: u64, endTimestamp?: u64) -> RaindexVaultVolume[]
  • Ensure optional time filters continue to work for both data sources.

Done when

  • With LocalDB enabled and populated, the Volume tab can load vault volumes without depending on the subgraph.
  • With LocalDB disabled/unavailable, the existing subgraph-backed behavior remains unchanged.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions