Moeasei a dexs platforms 1
    Updated 2023-10-21
    with price as (
    SELECT
    --- thanks to Hess
    TO_TIMESTAMP(value [0] :: string) as date,
    'SEI' as symbol,
    value [1] as price
    from
    (
    SELECT
    livequery.live.udf_api(
    'https://api.coingecko.com/api/v3/coins/sei-network/market_chart?vs_currency=usd&days=90&interval=daily&precision=3'
    ) as resp
    ),
    LATERAL FLATTEN (input => resp:data:prices)
    ),

    mid as (
    select
    * ,

    case
    when CURRENCY_IN = 'factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/871jbn9unTavWsAe83f2Ma9GJWSv6BKsyWYLiQ6z3Pva' then 'USDT'
    when CURRENCY_IN = 'factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/Hq4tuDzhRBnxw3tFA5n6M52NVMVcC19XggbyDiJKCD6H' then 'USDCet'
    when CURRENCY_IN = 'factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/DUVFMY2neJdL8aE4d3stcpttDDm5aoyfGyVvm29iA9Yp' then 'USDCpo'
    when CURRENCY_IN = 'usei' then 'SEI'
    when CURRENCY_IN = 'factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/4tLQqCLaoKKfNFuPjA9o39YbKUwhR1F8N29Tz3hEbfP2' then 'WETH'
    when CURRENCY_IN = 'factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/7edDfnf4mku8So3t4Do215GNHwASEwCWrdhM5GqD51xZ' then 'USDCar'
    when CURRENCY_IN = 'ibc/ED07A3391A112B175915CD8FAF43A2DA8E4790EDE12566649D0C2F97716B8518' then 'OSMO'
    when CURRENCY_IN = 'ibc/F082B65C88E4B6D5EF1DB243CDA1D331D002759E938A0F5CD3FFDC5D53B3E349' then 'USDC.axl'
    when CURRENCY_IN = 'ibc/0EC78B75D318EA0AAB6160A12AEE8F3C7FEA3CFEAD001A3B103E11914709F4CE' then 'ASTRO'
    when CURRENCY_IN = 'factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/DUVFMY2neJdL8aE4d3stcpttDDm5aoyfGyVvm29iA9Yp' then 'USDCpo'
    when CURRENCY_IN = 'sei1zmqvpt7e8ewv5fhh5p9jzmc70jq5u6rgj8tct8yuk8a3lkkkv0cs0urlju' then 'BTC'
    when CURRENCY_IN = 'factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/871jbn9unTavWsAe83f2Ma9GJWSv6BKsyWYLiQ6z3Pva' then 'USDT.bs'
    when CURRENCY_IN = 'factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/9fELvUhFo6yWL34ZaLgPbCPzdk9MD1tAzMycgH45qShH' then 'USDC.so'
    when CURRENCY_IN = 'factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/3VKKYtbQ9iq8f9CaZfgR6Cr3TUj6ypXPAn6kco6wjcAu' then 'USDC.op'
    when CURRENCY_IN = 'sei1hujt4dydg2lt0yaw8qp6gs3e78fv0tsehp6temwfq28m356v6kmqt9lctc' then 'sDODGE'
    Run a query to Download Data