Query editor
/*──────────────────────────────────────────────────────────────Dogstar League – Contest Query - CURRENT WEEK Volume (This Week's Cohort & Pricing)▸ Shows the TOTAL WTV in USD accumulated THIS WEEK SO FAR (Mon-Now)by accounts created BY THE FUNDER **DURING THIS SAME CURRENT WEEK**.▸ Uses shared asset list from query_5034222.▸ Uses average daily prices calculated **based ONLY on trades from this current week so far**.▸ NOTE: Pricing might be volatile/sparse based on partial week's data.──────────────────────────────────────────────────────────────*/WITHparams AS (SELECT-- Define Current Week Boundaries for cohort, event, and pricing filteringdate_trunc('week', current_date) AS current_week_start,-- No end date needed for current week, as 'now' is the limit'GDBSXMDBDHVZ3OMNQWV5MMNPMPOJRZAGEAOVRYWXZG5VC5I5B4SOXSBW' AS funder,'GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN' AS usdc_issuer),-- Select accounts created ONLY during the current week (so far)accounts_created_this_week AS (SELECTh.accountFROM stellar.history_operations hJOIN params p ON TRUEWHEREh.type_string = 'create_account'AND h.funder = p.funder-- Filter accounts created strictly within the current weekAND h.closed_at >= p.current_week_start-- Implicitly ends 'now'),-- Reads from the centralized asset list query (ID: 5034222)is_allowed_asset AS (SELECT asset_code, asset_issuerFROM query_5034222 -- <<< ID de tu query de activos guardada),-- Operations from accounts created this week, occurring this weekops AS (SELECT 'ops' AS source_cte, date_trunc('day', o.closed_at) AS event_day, CASE WHEN o.asset_type='native' THEN 'XLM' ELSE o.asset_code END AS asset_code, CASE WHEN o.asset_type='native' THEN NULL ELSE o.asset_issuer END AS asset_issuer, CAST(o.amount AS DOUBLE) AS amountFROM stellar.history_operations oJOIN accounts_created_this_week acta ON o.source_account = acta.account -- Join accounts created this weekJOIN params p ON TRUEJOIN is_allowed_asset allowed ON (CASE WHEN o.asset_type='native' THEN 'XLM' ELSE o.asset_code END) = allowed.asset_code AND (CASE WHEN o.asset_type='native' THEN TRUE ELSE o.asset_issuer = allowed.asset_issuer END)WHERE o.type_string IN ('payment', 'path_payment_strict_send', 'path_payment_strict_receive', 'liquidity_pool_deposit', 'liquidity_pool_withdraw')AND o.closed_at >= p.current_week_start -- Event occurred this week),-- Trades from accounts created this week, occurring this weektrades AS (SELECT 'trades' AS source_cte, date_trunc('day', ht.closed_at) AS event_day, CASE WHEN ht.selling_asset_type='native' THEN 'XLM' ELSE ht.selling_asset_code END AS asset_code, CASE WHEN ht.selling_asset_type='native' THEN NULL ELSE ht.selling_asset_issuer END AS asset_issuer, CAST(ht.selling_amount AS DOUBLE) AS amountFROM stellar.history_trades htJOIN accounts_created_this_week acta ON ht.selling_account_address = acta.account OR ht.buying_account_address = acta.account -- Join accounts created this weekJOIN params p ON TRUEJOIN is_allowed_asset allowed_selling ON (CASE WHEN ht.selling_asset_type='native' THEN 'XLM' ELSE ht.selling_asset_code END) = allowed_selling.asset_code AND (CASE WHEN ht.selling_asset_type='native' THEN TRUE ELSE ht.selling_asset_issuer = allowed_selling.asset_issuer END)JOIN is_allowed_asset allowed_buying ON (CASE WHEN ht.buying_asset_type='native' THEN 'XLM' ELSE ht.buying_asset_code END) = allowed_buying.asset_code AND (CASE WHEN ht.buying_asset_type='native' THEN TRUE ELSE ht.buying_asset_issuer = allowed_buying.asset_issuer END)WHERE ht.selling_liquidity_pool_id IS NULLAND ht.closed_at >= p.current_week_start -- Event occurred this week),