Skip to content

Commit

Permalink
Merge pull request #10 from mtitus6/main
Browse files Browse the repository at this point in the history
Update Peg Ratio to > 1 year
  • Loading branch information
mtitus6 committed Sep 19, 2024
2 parents 70844f1 + 3da242d commit 82c9ee8
Show file tree
Hide file tree
Showing 15 changed files with 89 additions and 117 deletions.
9 changes: 5 additions & 4 deletions coinbase/cbeth_price.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ with weth as (
prices.usd
where
contract_address = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
and minute >= cast(current_timestamp - interval '1' year as timestamp)
and minute >= cast('2022-07-15 00:00' as timestamp)
group by
date_trunc('hour', minute)
)
Expand All @@ -21,7 +21,7 @@ token as (
prices.usd
where
contract_address = 0xbe9895146f7af43049ca1c1ae358b0541ea49704
and minute >= cast(current_timestamp - interval '1' year as timestamp)
and minute >= cast('2022-07-15 00:00' as timestamp)
group by
date_trunc('hour', minute),
contract_address
Expand All @@ -31,8 +31,9 @@ select
token.hr,
token.contract_address as token_contract_address,
'cbETH' as token_name,
token.price as price_usd,
token.price / weth.price as price_eth
token.price as token_price_usd,
token.price / weth.price as token_price_eth,
weth.price as weth_price_usd
from
token
inner join weth on
Expand Down
17 changes: 7 additions & 10 deletions coinbase/cbeth_price_peg_ratio.sql
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
/* Dune query number - 3664524 */
with hours as (
select
timestamp as hr,
date_trunc('day', timestamp) as d
date_add('hour', step, day) as hr,
day as d
from
unnest(
sequence(
date_trunc('hour', cast(current_timestamp as timestamp) - interval '1' year),
cast(current_timestamp as timestamp),
interval '60' minute
)
) as tbl (timestamp)
),
unnest(sequence(cast('2022-07-15 00:00' as timestamp), current_date, interval '1' day)) as t (day)
cross join
(select * from unnest(sequence(1, 24, 1)) as t (step))
)
,

peg as (
select
Expand Down
19 changes: 8 additions & 11 deletions coinbase/cbeth_trades_peg_ratio.sql
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
/* Dune query number - 3465286 */
with hours as (
select
timestamp as hr,
date_trunc('day', timestamp) as d
date_add('hour', step, day) as hr,
day as d
from
unnest(
sequence(
date_trunc('hour', cast(current_timestamp as timestamp) - interval '1' year),
cast(current_timestamp as timestamp),
interval '60' minute
)
) as tbl (timestamp)
),
unnest(sequence(cast('2022-07-15 00:00' as timestamp), current_date, interval '1' day)) as t (day)
cross join
(select * from unnest(sequence(1, 24, 1)) as t (step))
)
,

peg as (
select
Expand All @@ -35,7 +32,7 @@ trades as (
sum(trades.token_trade_amount) as token_trade_amount,
sum(trades.token_trade_amount_eth) / sum(trades.token_trade_amount) as token_price_eth
from query_3465242 as trades
where trades.t > cast(current_timestamp as timestamp) - interval '1' year
where trades.t > cast('2022-07-15 00:00' as timestamp)
group by 1
),

Expand Down
4 changes: 2 additions & 2 deletions frax/sfrxETH/sfrxeth_price.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ with weth as (
prices.usd
where
contract_address = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
and minute >= cast(current_timestamp - interval '1' year as timestamp)
and minute >= cast('2022-10-06 00:00' as timestamp)
group by
date_trunc('hour', minute)
)
Expand All @@ -21,7 +21,7 @@ token as (
prices.usd
where
contract_address = 0xac3e018457b222d93114458476f3e3416abbe38f
and minute >= cast(current_timestamp - interval '1' year as timestamp)
and minute >= cast('2022-10-06 00:00' as timestamp)
group by
date_trunc('hour', minute),
contract_address
Expand Down
17 changes: 7 additions & 10 deletions frax/sfrxETH/sfrxeth_price_peg_ratio.sql
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
/* Dune query number - 3833523 */
with hours as (
select
timestamp as hr,
date_trunc('day', timestamp) as d
date_add('hour', step, day) as hr,
day as d
from
unnest(
sequence(
date_trunc('hour', cast(current_timestamp as timestamp) - interval '1' year),
cast(current_timestamp as timestamp),
interval '60' minute
)
) as tbl (timestamp)
),
unnest(sequence(cast('2022-10-06 00:00' as timestamp), current_date, interval '1' day)) as t (day)
cross join
(select * from unnest(sequence(1, 24, 1)) as t (step))
)
,

peg as (
select
Expand Down
19 changes: 8 additions & 11 deletions frax/sfrxETH/sfrxeth_trades_peg_ratio.sql
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
/* Dune query number - 3833519 */
with hours as (
select
timestamp as hr,
date_trunc('day', timestamp) as d
date_add('hour', step, day) as hr,
day as d
from
unnest(
sequence(
date_trunc('hour', cast(current_timestamp as timestamp) - interval '1' year),
cast(current_timestamp as timestamp),
interval '60' minute
)
) as tbl (timestamp)
),
unnest(sequence(cast('2022-10-06 00:00' as timestamp), current_date, interval '1' day)) as t (day)
cross join
(select * from unnest(sequence(1, 24, 1)) as t (step))
)
,

peg as (
select
Expand All @@ -35,7 +32,7 @@ trades as (
sum(trades.token_trade_amount) as token_trade_amount,
sum(trades.token_trade_amount_eth) / sum(trades.token_trade_amount) as token_price_eth
from query_3810156 as trades
where trades.t > cast(current_timestamp as timestamp) - interval '1' year
where trades.t > cast('2022-10-06 00:00' as timestamp)
group by 1
),

Expand Down
4 changes: 2 additions & 2 deletions lido/steth/steth_price.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ with weth as (
prices.usd
where
contract_address = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
and minute >= cast(current_timestamp - interval '1' year as timestamp)
and minute >= cast('2022-07-15 00:00' as timestamp)
group by
date_trunc('hour', minute)
)
Expand All @@ -21,7 +21,7 @@ token as (
prices.usd
where
contract_address = 0xae7ab96520de3a18e5e111b5eaab095312d7fe84
and minute >= cast(current_timestamp - interval '1' year as timestamp)
and minute >= cast('2022-07-15 00:00' as timestamp)
group by
date_trunc('hour', minute),
contract_address
Expand Down
17 changes: 7 additions & 10 deletions lido/steth/steth_price_peg_ratio.sql
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
/* Dune query number - 3668358 */
with hours as (
select
timestamp as hr,
date_trunc('day', timestamp) as d
date_add('hour', step, day) as hr,
day as d
from
unnest(
sequence(
date_trunc('hour', cast(current_timestamp as timestamp) - interval '1' year),
cast(current_timestamp as timestamp),
interval '60' minute
)
) as tbl (timestamp)
),
unnest(sequence(cast('2022-07-15 00:00' as timestamp), current_date, interval '1' day)) as t (day)
cross join
(select * from unnest(sequence(1, 24, 1)) as t (step))
)
,

peg as (
select
Expand Down
19 changes: 8 additions & 11 deletions lido/steth/steth_trades_peg_ratio.sql
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
/* Dune query number - 3480205 */
with hours as (
select
timestamp as hr,
date_trunc('day', timestamp) as d
date_add('hour', step, day) as hr,
day as d
from
unnest(
sequence(
date_trunc('hour', cast(current_timestamp as timestamp) - interval '1' year),
cast(current_timestamp as timestamp),
interval '60' minute
)
) as tbl (timestamp)
),
unnest(sequence(cast('2022-07-15 00:00' as timestamp), current_date, interval '1' day)) as t (day)
cross join
(select * from unnest(sequence(1, 24, 1)) as t (step))
)
,

peg as (
select
Expand All @@ -28,7 +25,7 @@ trades as (
sum(trades.token_trade_amount) as token_trade_amount,
sum(trades.token_trade_amount_eth) / sum(trades.token_trade_amount) as token_price_eth
from query_3480173 as trades
where trades.t > cast(current_timestamp as timestamp) - interval '1' year
where trades.t > cast('2022-07-15 00:00' as timestamp)
group by 1
),

Expand Down
4 changes: 2 additions & 2 deletions rocketpool/reth/reth_price.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ with weth as (
prices.usd
where
contract_address = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
and minute >= cast(current_timestamp - interval '1' year as timestamp)
and minute >= cast('2022-07-15 00:00' as timestamp)
group by
date_trunc('hour', minute)
)
Expand All @@ -21,7 +21,7 @@ token as (
prices.usd
where
contract_address = 0xae78736cd615f374d3085123a210448e74fc6393
and minute >= cast(current_timestamp - interval '1' year as timestamp)
and minute >= cast('2022-07-15 00:00' as timestamp)
group by
date_trunc('hour', minute),
contract_address
Expand Down
18 changes: 8 additions & 10 deletions rocketpool/reth/reth_price_peg_ratio.sql
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
/* Dune query number - 3671485 */
with hours as (
select
timestamp as hr,
date_trunc('day', timestamp) as d
date_add('hour', step, day) as hr,
day as d
from
unnest(
sequence(
date_trunc('hour', cast(current_timestamp as timestamp) - interval '1' year),
cast(current_timestamp as timestamp),
interval '60' minute
)
) as tbl (timestamp)
),
unnest(sequence(cast('2022-07-15 00:00' as timestamp), current_date, interval '1' day)) as tbl (day)
cross join
(select * from unnest(sequence(1, 24, 1)) as tbl (step))
)
,


peg as (
select
Expand Down
19 changes: 8 additions & 11 deletions rocketpool/reth/reth_trades_peg_ratio.sql
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
/* Dune query number - 3480165 */
with hours as (
select
timestamp as hr,
date_trunc('day', timestamp) as d
date_add('hour', step, day) as hr,
day as d
from
unnest(
sequence(
date_trunc('hour', cast(current_timestamp as timestamp) - interval '1' year),
cast(current_timestamp as timestamp),
interval '60' minute
)
) as tbl (timestamp)
),
unnest(sequence(cast('2022-07-15 00:00' as timestamp), current_date, interval '1' day)) as tbl (day)
cross join
(select * from unnest(sequence(1, 24, 1)) as tbl (step))
)
,

peg as (
select
Expand All @@ -35,7 +32,7 @@ trades as (
sum(trades.token_trade_amount) as token_trade_amount,
sum(trades.token_trade_amount_eth) / sum(trades.token_trade_amount) as token_price_eth
from query_3480086 as trades
where trades.t > cast(current_timestamp as timestamp) - interval '1' year
where trades.t > cast('2022-07-15 00:00' as timestamp)
group by 1
),

Expand Down
4 changes: 2 additions & 2 deletions swell/sweth_price.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ with weth as (
prices.usd
where
contract_address = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
and minute >= cast(current_timestamp - interval '1' year as timestamp)
and minute >= cast('2023-04-18 00:00' as timestamp)
group by
date_trunc('hour', minute)
)
Expand All @@ -21,7 +21,7 @@ token as (
prices.usd
where
contract_address = 0xf951e335afb289353dc249e82926178eac7ded78
and minute >= cast(current_timestamp - interval '1' year as timestamp)
and minute >= cast('2023-04-18 00:00' as timestamp)
group by
date_trunc('hour', minute),
contract_address
Expand Down
17 changes: 7 additions & 10 deletions swell/sweth_price_peg_ratio.sql
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
/* Dune query number - 3784108 */
with hours as (
select
timestamp as hr,
date_trunc('day', timestamp) as d
date_add('hour', step, day) as hr,
day as d
from
unnest(
sequence(
date_trunc('hour', cast(current_timestamp as timestamp) - interval '1' year),
cast(current_timestamp as timestamp),
interval '60' minute
)
) as tbl (timestamp)
),
unnest(sequence(cast('2023-04-18 00:00' as timestamp), current_date, interval '1' day)) as t (day)
cross join
(select * from unnest(sequence(1, 24, 1)) as t (step))
)
,

peg as (
select
Expand Down
19 changes: 8 additions & 11 deletions swell/sweth_trades_peg_ratio.sql
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
/* Dune query number - 3784121 */
with hours as (
select
timestamp as hr,
date_trunc('day', timestamp) as d
date_add('hour', step, day) as hr,
day as d
from
unnest(
sequence(
date_trunc('hour', cast(current_timestamp as timestamp) - interval '1' year),
cast(current_timestamp as timestamp),
interval '60' minute
)
) as tbl (timestamp)
),
unnest(sequence(cast('2023-04-18 00:00' as timestamp), current_date, interval '1' day)) as t (day)
cross join
(select * from unnest(sequence(1, 24, 1)) as t (step))
)
,

peg as (
select
Expand All @@ -35,7 +32,7 @@ trades as (
sum(trades.token_trade_amount) as token_trade_amount,
sum(trades.token_trade_amount_eth) / sum(trades.token_trade_amount) as token_price_eth
from query_3763812 as trades
where trades.t > cast(current_timestamp as timestamp) - interval '1' year
where trades.t > cast('2023-04-18 00:00' as timestamp)
group by 1
),

Expand Down

0 comments on commit 82c9ee8

Please sign in to comment.