From 3c284e630655b803034b90e922307d57f7866218 Mon Sep 17 00:00:00 2001 From: Benjamin Smith Date: Mon, 22 May 2023 16:51:20 +0200 Subject: [PATCH] Trigger Dashboard Query Refresh (#287) People keep having issues with the dashboard query being out of sync when they land on the dashboard page. This will trigger refresh (in the background) at script runtime. --- src/fetch/dune.py | 9 +++++++++ src/queries.py | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/src/fetch/dune.py b/src/fetch/dune.py index fa13447a..f41f1079 100644 --- a/src/fetch/dune.py +++ b/src/fetch/dune.py @@ -169,6 +169,15 @@ def get_period_slippage(self, job_id: Optional[str] = None) -> list[DuneRecord]: Returns a class representation of the results as two lists (positive & negative). """ token_list = get_trusted_tokens() + params = self._period_params() + [ + QueryParameter.text_type("TxHash", "0x"), + QueryParameter.text_type("TokenList", ",".join(token_list)), + ] + # trigger dashboard update + self.dune.execute( + self._parameterized_query(QUERIES["DASHBOARD_SLIPPAGE"], params=params) + ) + return self._get_query_results( self._parameterized_query( QUERIES["PERIOD_SLIPPAGE"], diff --git a/src/queries.py b/src/queries.py index 09e2d4ee..2e19f092 100644 --- a/src/queries.py +++ b/src/queries.py @@ -60,4 +60,9 @@ def with_params(self, params: list[QueryParameter]) -> Query: filepath="period_slippage.sql", q_id=2259597, ), + "DASHBOARD_SLIPPAGE": QueryData( + name="Dashboard Slippage for Period", + filepath="not currently stored in project", + q_id=2283297, + ), }