saeedmzn[NFT trades on Sei] - Total without price
    Updated 2024-05-30
    WITH
    raw_prices AS (
    SELECT
    livequery.live.udf_api (
    'https://flipsidecrypto.xyz/api/v1/queries/2c2ebd8f-fa1d-4328-bf69-cf0f793dcf03/data/latest'
    ) AS response
    ),
    sei_price as (
    select
    date_trunc(day,t.value:"DATE"::date)::date date ,
    t.value :"PRICE"::float price ,
    t.value:"VOLUME"::number trading_volume,
    t.value:"MCAP"::number mcap
    from
    raw_prices ,
    table(FLATTEN(parse_json(response:data))) t
    ),

    distinct_transactions as (
    select distinct tx_id
    from sei.core.fact_msg_attributes
    where ATTRIBUTE_VALUE = 'sei152u2u0lqc27428cuf8dx48k8saua74m6nql5kgvsu4rfeqm547rsnhy4y9'
    and ATTRIBUTE_KEY = '_contract_address'
    and msg_type in ('wasm-buy_now', 'wasm-accept_bid')
    and TX_SUCCEEDED = 'true'
    and block_timestamp::date >= current_date - 30
    ),
    seller_data as (
    select
    block_timestamp,
    tx_id,
    msg_index,
    ATTRIBUTE_VALUE as seller
    from sei.core.fact_msg_attributes
    where tx_id in (select tx_id from distinct_transactions)
    and ATTRIBUTE_KEY = 'nft_seller'
    QueryRunArchived: QueryRun has been archived