MahrooUntitled Query
    Updated 2022-11-15
    -- NEAR NFT Sales Credit: pinehearst || https://app.flipsidecrypto.com/velocity/queries/9af989e2-9cfc-4a62-8499-1767a8c43189
    with nearpricet as (
    select timestamp::date as day,
    avg (price_usd) as usdprice
    from near.core.fact_prices
    where symbol = 'wNEAR'
    group by 1),

    flowpricet as (
    select timestamp::date as day,
    median (price_usd) as usdprice
    from flow.core.fact_prices
    where source = 'stableswap'
    and token_contract = 'A.1654653399040a61.FlowToken'
    group by 1),

    solpricet as (
    select block_timestamp::date as day,
    median (swap_to_amount/swap_from_amount) as USDPrice
    from solana.fact_swaps
    where swap_from_mint = 'So11111111111111111111111111111111111111112'
    and swap_to_mint in ('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v','Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB') --USDC,USDT
    and swap_to_amount > 0
    and swap_from_amount > 0
    and succeeded = 'TRUE'
    group by 1),

    TX_RECEIPT AS (
    select block_timestamp,
    tx_hash,
    tx_signer,
    receipt_object_id,
    regexp_substr(status_value, 'Success') as reg_success,
    receiver_id,
    logs
    FROM near.core.fact_receipts
    Run a query to Download Data