Query editor
-- This query used incompatible data types from Dune SQL alpha and may need to be updated.-- More details can be found on https://dune.com/docs/query/dunesql-changes/-- вот отсюда будет проще всего вытащить https://dune.com/queries/1088111/1863399--вроде даже вснужные расчеты есть, надо просто вытащить и по-другому упаковатьwith prices as --MATIC/stMATIC(selecttime,sum (price*amount) / sum(amount) as weight_avg_pricefrom(selectdate_trunc('day',evt_block_time) as time,CAST(_amount as double)/1e18 / --MATIC staked amount(select CAST(value as DOUBLE)/1e18from lido_ethereum.StMATIC_evt_Transfer l2where l2.evt_tx_hash = l1.evt_tx_hash-- and "contract_address" = '\x9ee91F9f426fA633d227f7a9b000E28b9dfd8599'and l2.to = l1._from) --stMATIC minted amountas price, --MATIC/stMATICCAST(_amount as DOUBLE) /1e18 as amount --MATIC staked amountfrom lido_ethereum.StMATIC_evt_SubmitEvent l1) ttgroup by 1),prices_with_lead as --MATIC/stMATIC(select time, lead(time, 1, date_trunc('day',now() + interval '24' hour)) over (order by time) as next_time,weight_avg_pricefrom prices), MATIC_prices as (select distinct date_trunc('day', minute) as time,last_value(price) over (partition by date_trunc('day', minute) order by minute range between unbounded preceding and unbounded following) as pricefrom prices.usd pwhere date_trunc('day', minute) >= DATE('2022-02-28')and "symbol" = 'MATIC'--order by 1 desc)select * from prices order by time desc/*--Dune v1with LIDO_stMATIC_txns as(--staking txnsselect "value"/1e18 as amount,"evt_block_time" as timefrom lido."StMATIC_evt_Transfer"where "from" = '\x0000000000000000000000000000000000000000'union all--unstaking txns