KaskoazulGard.Money - ALGO backing
    Updated 2022-04-24
    with app_calls as (
    select tx_group_id
    from algorand.application_call_transaction
    where app_id = '684650147'
    and TRY_BASE64_DECODE_STRING(tx_message :txn :apaa [0] :: STRING) IS NOT NULL --= 'NewPosition'--
    ),

    collateral as (
    select block_timestamp::date as fecha,
    case receiver
    when 'MTMJ5ADRK3CFG3HGUI7FS4Y55WGCUO5CRUMVNBZ7FW5IIG6T3IU2VJHUMM' then 'fee'
    else 'collateral'
    end as payment,
    sum (amount) as daily,
    sum(daily) over (partition by payment order by fecha) as cum_payment
    from algorand.payment_transaction
    where tx_group_id in (select tx_group_id from app_calls)
    group by fecha, payment
    order by fecha desc
    )

    select fecha,
    daily,
    cum_payment as total
    from collateral
    where payment = 'collateral'
    Run a query to Download Data