winnie-fsEvaluate Jolly Jokers copy
    Updated 2023-04-12
    -- forked from Diamond / Evaluate Jolly Jokers @ https://staging.flipsidecrypto.xyz/Diamond/q/untitled-query-8hjM4Q

    SELECT
    "Date",
    COUNT(*) AS "Total Trades",
    SUM(Contained) AS "Jolly Jokers Traded",
    sum("Jolly Jokers Traded") over (
    order by
    "Date"
    ) as "Total Traded"
    FROM
    (
    SELECT
    to_date(BLOCK_TIMESTAMP) as "Date",
    *,
    CASE
    WHEN CHARINDEX(
    'A.699bf284101a76f1.JollyJokers',
    EVENT_DATA::String
    ) > 0 THEN 1
    ELSE 0
    END AS Contained
    FROM
    FLOW.CORE.FACT_EVENTS
    where
    event_contract IN ('A.9066631feda9e518.Swap')
    and block_timestamp >= '2022-11-15'
    and event_type = 'ProposalExecuted'
    and TX_SUCCEEDED = TRUE
    )
    GROUP BY
    "Date"
    order by
    1 desc


    Run a query to Download Data