Updated 2022-10-04
    with transactions as (
    select
    tx : receipt[6] : outcome : logs[0] as tx_log,
    tx : actions[0] : FunctionCall : deposit / pow(10, 24) as salee,
    block_timestamp
    from
    near.core.fact_transactions
    where
    (
    tx : receipt[6] : outcome : executor_id = 'marketplace.paras.near'
    or tx : receipt[0] : outcome : executor_id = 'x.paras.near'
    )
    ),
    sales as (
    select
    block_timestamp,
    salee,
    TRY_PARSE_JSON(tx_log) as json_parse,
    json_parse : params : price / pow(10, 24) as sale_price,
    json_parse : params : nft_contract_id as nft_contract,
    json_parse : type as sale_type,
    json_parse : params : buyer_id as buyer,
    json_parse : params : owner_id as seller,
    json_parse : params : is_offer as offer
    from
    transactions

    ),
    final as (
    select
    date_trunc('week', block_timestamp) as date,
    sum(sale_price) as sales_volume,
    sum(salee) as sales_volume2,
    sales_volume + sales_volume2 as " daily sales volume",
    sum(offer) as "offer_volume",
    Run a query to Download Data