Updated 2024-06-10
    -- forked from Totals By Token @ https://flipsidecrypto.xyz/edit/queries/9f5f791c-e4b2-4de9-a5f3-b5008e49c067

    -- forked from Totals @ https://flipsidecrypto.xyz/edit/queries/74f6d98d-47a7-4820-89c4-cc6726bda18f

    -- forked from Daily Fees Stats @ https://flipsidecrypto.xyz/edit/queries/fa47ff2c-c6a3-4258-bc56-5802cdcba6ba

    /* with cte1 AS (
    SELECT live.udf_api(
    'https://ipfs.io/ipfs/QmTnw8jdV9epXTYGWtP9nFCH1BtuXYRQp6FECcVNi3kuuE'
    ) AS response
    ) */
    with cte1 AS (
    SELECT
    livequery.live.udf_api(
    'GET',
    'https://science.flipsidecrypto.xyz/googlesheets/readsheet',
    { 'Content-Type': 'application/json' },
    {
    'sheets_id' : '1qvNORmqkdAEzJCQHh2RPWbThMDCROxY5p3vRWN7eJGc',
    'tab_name' : 'byToken'
    }
    ) as response
    )
    , my_data AS (
    SELECT
    value:date_str::date AS date
    , value:pool_token::text AS pool_token
    -- , value:increase_calls::integer AS increase_calls
    -- , value:inc_users::integer AS inc_users
    -- , value:opens::integer AS opens
    -- , value:add_collateral_actions::integer AS add_collateral_actions
    -- , value:added_collateral::float AS added_collateral
    -- , value:long_collateral::float AS long_collateral
    -- , value:short_collateral::float AS short_collateral
    , value:increase_fees_usd::float AS increase_fees_usd
    -- , value:positions::integer AS positions
    QueryRunArchived: QueryRun has been archived