SalehS8-Smart Money-Strategy-Swaps
    Updated 2023-02-03
    with sol_price as(
    select
    block_timestamp::date as day_price
    ,median (div0(swap_to_amount,swap_from_amount)) as avg_price
    from solana.fact_swaps
    where swap_to_mint in ('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
    ,'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB')
    and swap_from_mint = 'So11111111111111111111111111111111111111112'
    and succeeded = 'TRUE'
    group by 1
    order by 1
    )
    ,lst_token_add as (
    select
    TOKEN_ADDRESS
    ,SYMBOL
    ,DECIMALS
    from solana.core.dim_tokens
    union all
    select
    'So11111111111111111111111111111111111111112'
    ,'SOL'
    ,0
    from solana.core.dim_tokens
    )
    ,token_price as (
    select
    RECORDED_HOUR::date as day_price
    ,p.symbol
    ,TOKEN_ADDRESS
    ,case TOKEN_ADDRESS
    when 'FaiPGacTM7YBmacumbg4ZnDx7sKtGcG3LkcVoqfddEA7' then 9
    when '8udZmv2RrHpU8rPZhphUGhHpmyAqc9UzV4UihpThKvYh' then 11
    when 'ZEExktbqMM5ZMS569pCNbzky92KeEmiFeVwR3exfBNn' then 5
    when '45HfvXJHY9msY2i4EmUpume1mSMLUvdaWsJRbctAobQM' then 6
    else decimals
    Run a query to Download Data