Skip to content

Commit

Permalink
fix: only get twap if we have a historical price data
Browse files Browse the repository at this point in the history
  • Loading branch information
gosuto-inzasheru committed Nov 22, 2024
1 parent f7b833a commit 89472e0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/test_subgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ def test_get_twap_prices(subgraph, date_range, mainnet_core_pools):
loaded_pool_prices = json.load(f)

for pool_id, symbol in mainnet_core_pools:
prices = subgraph.get_twap_price_pool(
pool_id=pool_id,
chain=GqlChain.MAINNET,
date_range=date_range,
)
loaded_price = loaded_pool_prices.get(symbol)
if loaded_price:
prices = subgraph.get_twap_price_pool(
pool_id=pool_id,
chain=GqlChain.MAINNET,
date_range=date_range,
)
assert pytest.approx(
prices.bpt_price.twap_price, rel=Decimal(0.01)
) == Decimal(loaded_price.get("bpt_price"))
Expand Down

0 comments on commit 89472e0

Please sign in to comment.