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/with reinv as (select"tx".block_time,"ex"."positionId",("erc_tf".value / pow(10, "tok".decimals)) * median_price "value"from optimism."transactions" "tx"join alpha_homora_v2."homora_bank_evt_PutCollateral" "pc" on "pc"."evt_tx_hash" = "tx"."hash"join alpha_homora_v2."homora_bank_call_execute" "ex" on "ex"."call_tx_hash" = "tx"."hash"-- join alpha_homora_v2."homora_bank_call_getCurrentPositionInfo" "cpi" on "cpi".output_owner = "from"join erc20."ERC20_evt_Transfer" "erc_tf" on "erc_tf".evt_tx_hash = "tx".hash and "tx"."from" = "erc_tf"."from"join erc20."tokens" "tok" on "tok".contract_address = "erc_tf".contract_addressjoin prices."approx_prices_from_dex_data" "pr" on "pr".contract_address = "erc_tf".contract_address and DATE_TRUNC('hour', "tx".block_time + INTERVAL '30 minute') = "pr".hour-- join dune_user_generated."uniswap_v3_pool_info" "usw" on "usw."where"tx"."from" = '{{user_address}}'and substring(encode("ex".data, 'hex'), 1,8) = '5d12ab7e'order by "tx".block_time asc,"ex"."positionId","tok".symbol asc)select date_trunc('day', block_time) "date", "positionId",value, sum("value") over ( order by block_time) from reinv