Skip to content

Commit

Permalink
paramterized date
Browse files Browse the repository at this point in the history
  • Loading branch information
alexshchur committed Dec 10, 2024
1 parent f1d7cef commit 23aa541
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions dbt_subprojects/dex/models/_projects/paraswap/stats.sql
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
-- NB: this is a generated query, do not edit it directly, instead edit the template and re-generate the query
-- hydrate the generated ouput here: https://dune.com/queries/4403433
{%
set date_to = "DATE_TRUNC('day', CURRENT_TIMESTAMP)"
set date_to = "timestamp '{{date_to}}'"
%}
{%
set date_from = "DATE_TRUNC('day', CURRENT_TIMESTAMP) - INTERVAL '1' day"
set date_from = "timestamp '{{date_from}}'"
%}

{%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,87 +8,87 @@ with entities as (

select 'delta-v1-single' as entity, 'ethereum' as blockchain, contract_address as contract_address, call_block_time as block_time, call_tx_hash as tx_hash from paraswapdelta_ethereum.ParaswapDeltav1_call_settleSwap
where
(call_block_time BETWEEN DATE_TRUNC('day', CURRENT_TIMESTAMP) - INTERVAL '1' day AND DATE_TRUNC('day', CURRENT_TIMESTAMP))
(call_block_time BETWEEN timestamp '{{date_from}}' AND timestamp '{{date_to}}')

union all

select 'delta-v1-batch' as entity, 'ethereum' as blockchain, contract_address as contract_address, call_block_time as block_time, call_tx_hash as tx_hash from paraswapdelta_ethereum.ParaswapDeltav1_call_safeSettleBatchSwap
where
(call_block_time BETWEEN DATE_TRUNC('day', CURRENT_TIMESTAMP) - INTERVAL '1' day AND DATE_TRUNC('day', CURRENT_TIMESTAMP))
(call_block_time BETWEEN timestamp '{{date_from}}' AND timestamp '{{date_to}}')

union all

select 'delta-v2' as entity, 'ethereum' as blockchain, contract_address as contract_address, evt_block_time as block_time, evt_tx_hash as tx_hash from paraswapdelta_ethereum.ParaswapDeltav2_evt_OrderSettled
where
(evt_block_time BETWEEN DATE_TRUNC('day', CURRENT_TIMESTAMP) - INTERVAL '1' day AND DATE_TRUNC('day', CURRENT_TIMESTAMP))
(evt_block_time BETWEEN timestamp '{{date_from}}' AND timestamp '{{date_to}}')

union all

select 'delta-v2' as entity, 'base' as blockchain, contract_address as contract_address, evt_block_time as block_time, evt_tx_hash as tx_hash from paraswapdelta_base.ParaswapDeltav2_evt_OrderSettled
where
(evt_block_time BETWEEN DATE_TRUNC('day', CURRENT_TIMESTAMP) - INTERVAL '1' day AND DATE_TRUNC('day', CURRENT_TIMESTAMP))
(evt_block_time BETWEEN timestamp '{{date_from}}' AND timestamp '{{date_to}}')

union all

select 'augustus' as entity, 'ethereum' as blockchain, project_contract_address as contract_address, block_time as block_time, tx_hash as tx_hash from dex_aggregator.trades
where
(block_time BETWEEN DATE_TRUNC('day', CURRENT_TIMESTAMP) - INTERVAL '1' day AND DATE_TRUNC('day', CURRENT_TIMESTAMP))
(block_time BETWEEN timestamp '{{date_from}}' AND timestamp '{{date_to}}')

AND project='paraswap' and blockchain='ethereum'

union all

select 'augustus' as entity, 'polygon' as blockchain, project_contract_address as contract_address, block_time as block_time, tx_hash as tx_hash from dex_aggregator.trades
where
(block_time BETWEEN DATE_TRUNC('day', CURRENT_TIMESTAMP) - INTERVAL '1' day AND DATE_TRUNC('day', CURRENT_TIMESTAMP))
(block_time BETWEEN timestamp '{{date_from}}' AND timestamp '{{date_to}}')

AND project='paraswap' and blockchain='polygon'

union all

select 'augustus' as entity, 'bnb' as blockchain, project_contract_address as contract_address, block_time as block_time, tx_hash as tx_hash from dex_aggregator.trades
where
(block_time BETWEEN DATE_TRUNC('day', CURRENT_TIMESTAMP) - INTERVAL '1' day AND DATE_TRUNC('day', CURRENT_TIMESTAMP))
(block_time BETWEEN timestamp '{{date_from}}' AND timestamp '{{date_to}}')

AND project='paraswap' and blockchain='bnb'

union all

select 'augustus' as entity, 'arbitrum' as blockchain, project_contract_address as contract_address, block_time as block_time, tx_hash as tx_hash from dex_aggregator.trades
where
(block_time BETWEEN DATE_TRUNC('day', CURRENT_TIMESTAMP) - INTERVAL '1' day AND DATE_TRUNC('day', CURRENT_TIMESTAMP))
(block_time BETWEEN timestamp '{{date_from}}' AND timestamp '{{date_to}}')

AND project='paraswap' and blockchain='arbitrum'

union all

select 'augustus' as entity, 'avalanche_c' as blockchain, project_contract_address as contract_address, block_time as block_time, tx_hash as tx_hash from dex_aggregator.trades
where
(block_time BETWEEN DATE_TRUNC('day', CURRENT_TIMESTAMP) - INTERVAL '1' day AND DATE_TRUNC('day', CURRENT_TIMESTAMP))
(block_time BETWEEN timestamp '{{date_from}}' AND timestamp '{{date_to}}')

AND project='paraswap' and blockchain='avalanche_c'

union all

select 'augustus' as entity, 'fantom' as blockchain, project_contract_address as contract_address, block_time as block_time, tx_hash as tx_hash from dex_aggregator.trades
where
(block_time BETWEEN DATE_TRUNC('day', CURRENT_TIMESTAMP) - INTERVAL '1' day AND DATE_TRUNC('day', CURRENT_TIMESTAMP))
(block_time BETWEEN timestamp '{{date_from}}' AND timestamp '{{date_to}}')

AND project='paraswap' and blockchain='fantom'

union all

select 'augustus' as entity, 'optimism' as blockchain, project_contract_address as contract_address, block_time as block_time, tx_hash as tx_hash from dex_aggregator.trades
where
(block_time BETWEEN DATE_TRUNC('day', CURRENT_TIMESTAMP) - INTERVAL '1' day AND DATE_TRUNC('day', CURRENT_TIMESTAMP))
(block_time BETWEEN timestamp '{{date_from}}' AND timestamp '{{date_to}}')

AND project='paraswap' and blockchain='optimism'

union all

select 'augustus' as entity, 'base' as blockchain, project_contract_address as contract_address, block_time as block_time, tx_hash as tx_hash from dex_aggregator.trades
where
(block_time BETWEEN DATE_TRUNC('day', CURRENT_TIMESTAMP) - INTERVAL '1' day AND DATE_TRUNC('day', CURRENT_TIMESTAMP))
(block_time BETWEEN timestamp '{{date_from}}' AND timestamp '{{date_to}}')

AND project='paraswap' and blockchain='base'

Expand Down

0 comments on commit 23aa541

Please sign in to comment.