Query editor
WITH MARKETPLACES AS (SELECT *FROM dune.ton_foundation.dataset_labelsWHERE category = 'merchant'AND subcategory = 'offchain_marketplace'), TON_WALLETS AS (SELECT addressFROM ton.accounts AWHERE 1=1AND cardinality(FILTER(A.interfaces, i->regexp_like(i, 'wallet_.*') )) > 0), DEPOSITS_TON AS (SELECTM.block_date,M.source AS buyer,NULL AS seller,DEST_LABEL.name AS marketplace_name,M.value * P.price_usd AS net_value_usd,M.value * P.price_ton AS net_value_tonFROM ton.messages MINNER JOIN TON_WALLETSON TON_WALLETS.address = M.sourceLEFT JOIN MARKETPLACES AS SOURCE_LABELON SOURCE_LABEL.address = M.sourceLEFT JOIN MARKETPLACES AS DEST_LABELON DEST_LABEL.address = M.destinationLEFT JOIN ton.prices_daily PON P.timestamp = M.block_dateAND P.token_address = '0:0000000000000000000000000000000000000000000000000000000000000000'WHERE 1=1AND DEST_LABEL.address IS NOT NULLAND SOURCE_LABEL.name IS DISTINCT FROM DEST_LABEL.name-- Расширяем дату начала до 2022AND M.block_date >= DATE '2022-01-01'AND M.direction = 'in'AND NOT M.bouncedAND COALESCE(opcode, 0) != 260734629), WITHDRAWS_TON AS (SELECTM.block_date,NULL AS buyer,M.destination AS seller,SOURCE_LABEL.name AS marketplace_name,M.value * P.price_usd * (-1) AS net_value_usd,M.value * P.price_ton * (-1) AS net_value_tonFROM ton.messages MINNER JOIN TON_WALLETSON TON_WALLETS.address = M.destinationLEFT JOIN MARKETPLACES AS SOURCE_LABELON SOURCE_LABEL.address = M.sourceLEFT JOIN MARKETPLACES AS DEST_LABELON DEST_LABEL.address = M.destinationLEFT JOIN ton.prices_daily PON P.timestamp = M.block_dateAND P.token_address = '0:0000000000000000000000000000000000000000000000000000000000000000'