lanoKLAY related Volume in Capybara
    Updated 2024-07-19
    -- forked from Sajjadiii / Capy Bara 2 @ https://flipsidecrypto.xyz/Sajjadiii/q/iJJCSwykAo_f/capy-bara-2

    with current_price_tab AS (
    SELECT
    TO_TIMESTAMP(value[0] :: string) as date,
    value[1]::string as price,
    'WKLAY' :: string AS token_contract
    FROM (SELECT livequery.live.udf_api('https://api.coingecko.com/api/v3/coins/klay-token/market_chart?vs_currency=usd&days=365&interval=daily&precision=3') as resp)
    ,LATERAL FLATTEN (input => resp:data:prices)


    ),
    current_price_tab2 AS (

    SELECT
    TO_TIMESTAMP(value[0] :: string) as date,
    value[1]::string as price,
    'WETH' :: string AS token_contract
    FROM (SELECT livequery.live.udf_api('https://api.coingecko.com/api/v3/coins/weth/market_chart?vs_currency=usd&days=365&interval=daily&precision=3') as resp)
    ,LATERAL FLATTEN (input => resp:data:prices)

    ),

    data_tab AS (
    SELECT 'WKLAY'::string AS symbol, '0x19aac5f612f524b754ca7e7c41cbfa2e981a4432'::string AS token_address, 18::string AS decimal
    UNION ALL
    SELECT 'USDT'::string, '0x5c13e303a62fc5dedf5b52d66873f2e59fedadc2'::string, 6::string
    UNION ALL
    SELECT 'USDC'::string, '0x608792deb376cce1c9fa4d0e6b7b44f507cffa6a'::string, 6::string
    UNION ALL
    SELECT 'WETH'::string, '0x98a8345bb9d3dda9d808ca1c9142a28f6b0430e1'::string, 18::string
    UNION ALL
    SELECT 'USDT'::string, '0x9025095263d1e548dc890a7589a4c78038ac40ab'::string, 18::string
    UNION ALL
    SELECT 'WETH'::string, '0x55acee547df909cf844e32dd66ee55a6f81dc71b'::string, 18::string
    )
    QueryRunArchived: QueryRun has been archived