Skip to content

Commit

Permalink
again
Browse files Browse the repository at this point in the history
  • Loading branch information
viniabussafi committed Jan 24, 2025
1 parent eef1695 commit 20d2bad
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dbt_macros/shared/balancer/balancer_bpt_prices_macro.sql
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ WITH pool_labels AS (
decimals,
APPROX_PERCENTILE(median_price, 0.5) AS price,
DATE_TRUNC ('day', next_change) AS next_change,
ROW_NUMBER() OVER(PARTITION BY wrapped_token ORDER BY next_change) AS rn
ROW_NUMBER() OVER(PARTITION BY wrapped_token ORDER BY DATE_TRUNC ('day', next_change)) AS rn
FROM {{ source('balancer_v3' , 'erc4626_token_prices') }}
WHERE blockchain = '{{blockchain}}'
AND DATE_TRUNC ('day', next_change) != date_trunc('day', minute)
Expand Down
9 changes: 6 additions & 3 deletions dbt_macros/shared/balancer/balancer_liquidity_macro.sql
Original file line number Diff line number Diff line change
Expand Up @@ -383,17 +383,20 @@ WITH pool_labels AS (
GROUP BY 1
),

erc4626_prices AS(
erc4626_prices AS (
SELECT * FROM (
SELECT
date_trunc('day', minute) AS day,
wrapped_token AS token,
decimals,
APPROX_PERCENTILE(median_price, 0.5) AS price,
DATE_TRUNC ('day', next_change) AS next_change
DATE_TRUNC ('day', next_change) AS next_change,
ROW_NUMBER() OVER(PARTITION BY wrapped_token ORDER BY DATE_TRUNC ('day', next_change)) AS rn
FROM {{ source('balancer_v3' , 'erc4626_token_prices') }}
WHERE blockchain = '{{blockchain}}'
AND DATE_TRUNC ('day', next_change) != date_trunc('day', minute)
GROUP BY 1, 2, 3, 5
GROUP BY 1, 2, 3, 5)
WHERE rn = 1
),

swaps_changes AS (
Expand Down
2 changes: 1 addition & 1 deletion dbt_macros/shared/balancer/balancer_protocol_fee_macro.sql
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ WITH pool_labels AS (
decimals,
APPROX_PERCENTILE(median_price, 0.5) AS price,
DATE_TRUNC ('day', next_change) AS next_change,
ROW_NUMBER() OVER(PARTITION BY wrapped_token ORDER BY next_change) AS rn
ROW_NUMBER() OVER(PARTITION BY wrapped_token ORDER BY DATE_TRUNC ('day', next_change)) AS rn
FROM {{ source('balancer_v3' , 'erc4626_token_prices') }}
WHERE blockchain = '{{blockchain}}'
AND DATE_TRUNC ('day', next_change) != date_trunc('day', minute)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ WITH
decimals,
APPROX_PERCENTILE(median_price, 0.5) AS price,
DATE_TRUNC ('day', next_change) AS next_change,
ROW_NUMBER() OVER(PARTITION BY wrapped_token ORDER BY next_change) AS rn
ROW_NUMBER() OVER(PARTITION BY wrapped_token ORDER BY DATE_TRUNC ('day', next_change)) AS rn
FROM {{ source('balancer_v3' , 'erc4626_token_prices') }}
WHERE blockchain = '{{blockchain}}'
AND DATE_TRUNC ('day', next_change) != date_trunc('day', minute)
Expand Down

0 comments on commit 20d2bad

Please sign in to comment.