You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
/price/:assetA/:assetB/history pools testnet and mainnet rows into one OHLCV series #208
src/api/rest.ts:160-170 queries price_aggregates on pair_key alone:
SELECT bucket, window, vwap, sdex_vwap, amm_vwap, volume, trade_count,
open_price, close_price, high_price, low_price
FROM price_aggregates
WHERE pair_key = $1AND window = $2ORDER BY bucket DESCLIMIT $3
price_aggregates is written per network, so on an instance where ENABLED_NETWORKS covers both chains the returned buckets interleave testnet and mainnet rows for the same pair_key. A caller gets one OHLCV series that is not a series of anything — and because the route takes no network parameter, there is no way to ask for the one they meant.
Same class as the /basket problem #181 is addressing on that route. A price with the wrong network is worse than no price.
Fix: filter on network, read it from req.network ?? activeNetwork the way /price/:assetA/:assetB and /prices/history already do, echo the answered network back in the response, and add NetworkQuery to the route's openapi.yaml entry plus the network field to its response schema. A test with rows for both networks at the same pair_key and bucket, asserting only one network's rows come back, is what proves it.
The README already describes this under "Still reading across both networks"; this issue is to close it rather than document it.
Found while reviewing #179, which correctly left network off this route's spec entry because the route genuinely ignores it today.
Activity