Query editor
-- 元クエリ: 2151823 "profit per transaction" / https://dune.com/queries/2151823-- glpETH feb19 プールの約定 1 本ごとの概算損益(変動金利 26.81416703% 前提・28 日)と約定価格 pri。-- 変更点:-- - int256 の除算を cast(... as double) で明示(Trino の整数除算回避)-- - prices.usd に `minute >= now() - interval '7' day` を追加(結果は不変、スキャン量削減)-- - 注: profit / price は実行時点の WETH 価格を使う元仕様のままwithswap as (selectevt_block_time,recipient,variableTokenDelta,fixedTokenDelta,fixedTokenDeltaUnbalancedfromvoltz_arbitrum.glpEth_feb19_28days_vamm_evt_Swap),summ as (selectevt_block_time as mydate,recipient,cast(fixedTokenDeltaUnbalanced as double) as fixedTokenDeltaUnbalanced,cast(variableTokenDelta as double) / 1e18 as totalVar,cast(fixedTokenDelta as double) / 1e18 as totalFixfromswap),ethprice as (selectpricefromprices.usdwheresymbol = 'WETH'and minute >= now() - interval '7' dayorder byminute desclimit1)selectmydate,recipient,(totalFix - totalVar * -26.81416703) * price / 365 * 28 / 100 as profit,totalVar,fixedTokenDeltaUnbalanced / totalVar / 1e18 as pri,totalFix,pricefromsumm,ethpriceorder byprofit DESC