Query editor
-- 元クエリ: 2248247 "profit per adress2" / https://dune.com/queries/2248247-- glpETH mar15 プールのアドレス別損益(変動金利 30.37% 前提・28 日)。2147524 の第 2 弾プール版。-- 変更点:-- - 合計を sum(cast(... as decimal(38,0))) → double に(Trino の整数除算回避 + Spark と同精度)-- - prices.usd に `minute >= now() - interval '7' day` を追加(結果は不変、スキャン量削減)-- - 注: profit は実行時点の WETH 価格を使う元仕様のまま(2023 年当時の絶対額とは一致しない)withswap as (selectevt_block_time,recipient,variableTokenDelta,fixedTokenDeltafromvoltz_arbitrum.glpEth_mar15_16days_vamm_evt_Swap),summ as (selectrecipient,cast(sum(cast(variableTokenDelta as decimal(38,0))) as double) / 1e18 as totalVar,cast(sum(cast(fixedTokenDelta as decimal(38,0))) as double) / 1e18 as totalFixfromswapGROUP BYrecipient),ethprice as (selectpricefromprices.usdwheresymbol = 'WETH'and minute >= now() - interval '7' dayorder byminute desclimit1)selectrecipient,(totalFix + totalVar * 30.37) * price * 28 / 365 / 100 as profit,totalVar,totalFix,pricefromsumm,ethpriceorder byprofit DESC