Query editor
-- TODO; there seem to be spikes on some days that are unlikely to be real; need to track down n fix the artifact-- Used for:-- Percent Discount (negative) or Premium (positive); line chart showing reth_peg_pct_divergence and steth_peg_pct_divergence-- rETH Exchange Rate Over Time; line chart showing NAV rate and market rate-- rETH Discount (-) or Premium (+); counter showing reth_peg_pct_divergence to 4 decimalsWITHlrt_trades AS (SELECTblock_time AS time,tx_hash,token_bought_address AS lrt_token,token_bought_amount AS lrt_amount,amount_usdFROM dex.tradesWHERE blockchain = 'ethereum'AND token_bought_address in (0x35fA164735182de50811E8e2E824cFb9B6118ac2, -- eETH0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee, -- weETH0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7, -- rsETH0xbf5495Efe5DB9ce00f80364C8B423567e58d2110, -- ezETH0xFAe103DC9cf190eD75350761e95403b7b8aFa6c0, -- rswETH0xD9A442856C234a39a81a089C06451EBAa4306a72 -- pufETH)-- AND block_time >= CAST('2024-02-01' AS TIMESTAMP)union allSELECTblock_time AS time,tx_hash,token_sold_address AS lrt_token,token_sold_amount AS lrt_amount,amount_usdFROM dex.tradesWHERE blockchain = 'ethereum'AND token_sold_address in (0x35fA164735182de50811E8e2E824cFb9B6118ac2, -- eETH0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee, -- weETH0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7, -- rsETH0xbf5495Efe5DB9ce00f80364C8B423567e58d2110, -- ezETH0xFAe103DC9cf190eD75350761e95403b7b8aFa6c0, -- rswETH0xD9A442856C234a39a81a089C06451EBAa4306a72 -- pufETH)-- AND block_time >= CAST('2024-02-01' AS TIMESTAMP)),lrt_trades_eth_amount AS (SELECTt.time,tx_hash,case t.lrt_tokenwhen 0x35fA164735182de50811E8e2E824cFb9B6118ac2 then 'etherfi-eETH'when 0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee then 'etherfi-weETH'when 0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7 then 'kelp-rsETH'when 0xbf5495Efe5DB9ce00f80364C8B423567e58d2110 then 'renzo-ezETH'when 0xFAe103DC9cf190eD75350761e95403b7b8aFa6c0 then 'swell-rswETH'when 0xD9A442856C234a39a81a089C06451EBAa4306a72 then 'puffer-pufETH'else null end as lrt_symbol,t.lrt_amount,