StangFASTbase - 08
    Updated 2023-12-12
    --- Sausagers


    with

    tab0 AS
    (
    SELECT
    date_trunc( '{{period}}' , a.hour ) AS date
    , avg( a.price ) AS price
    , a.decimals AS decimal
    , a.symbol AS symbol
    FROM
    avalanche.price.ez_hourly_token_prices a
    WHERE
    a.token_address = '0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7'
    GROUP BY 1 , 3 , 4
    ORDER BY 1 DESC
    )
    ,
    tab1 AS
    (
    SELECT
    a.block_timestamp::date AS dt
    , a.tx_hash AS tx
    , a.origin_from_address AS bu
    , a.to_address AS se
    , ( ( a.raw_amount_precise / power( 10 , c.decimal ) ) * c.price ) AS us
    , b.project_name AS pj
    , b.tokenid AS tk
    , case
    when a.origin_to_address = '0x398baa6ffc99126671ab6be565856105a6118a40' then 'Hyperspace'
    when a.origin_to_address = '0xae079eda901f7727d0715aff8f82ba8295719977' then 'Joepegs'
    end
    AS mk
    FROM
    Run a query to Download Data