ArioLiquidium interest and repaid loans
    Updated 2025-01-31
    select *,
    sum("User Interest Earned (BTC)") over(order by day) as "Cum. User Interest Earned (BTC)",
    sum("Loan Repaid (BTC)") over(order by day) as "Cum. Loan Repaid (BTC)",
    sum("User Interest Earned (USD)") over(order by day) as "Cum. User Interest Earned (USD)",
    sum("Loan Repaid (USD)") over(order by day) as "Cum. Loan Repaid (USD)"
    from (
    select
    DATE_TRUNC('day', block_timestamp) AS day,
    SUM(val1_out)*4 AS "User Interest Earned (BTC)",
    SUM(val2_out) AS "Loan Repaid (BTC)",
    sum(val1_out * price)* 4 as "User Interest Earned (USD)",
    SUM(val2_out * price) AS "Loan Repaid (USD)"
    FROM
    (
    SELECT
    *
    FROM
    (
    SELECT
    tx_id,
    MAX(block_timestamp) as block_timestamp,
    MAX(CASE WHEN input.index = 0 THEN input.PUBKEY_SCRIPT_ADDRESS END) as tx1_in,
    MAX(CASE WHEN input.index = 1 THEN input.PUBKEY_SCRIPT_ADDRESS END) as tx2_in,
    MAX(CASE WHEN input.index = 2 THEN input.PUBKEY_SCRIPT_ADDRESS END) as tx3_in,
    MAX(CASE WHEN input.index = 3 THEN input.PUBKEY_SCRIPT_ADDRESS END) as tx4_in,
    MAX(CASE WHEN input.index = 4 THEN input.PUBKEY_SCRIPT_ADDRESS END) as tx5_in,
    MAX(CASE WHEN input.index = 5 THEN input.PUBKEY_SCRIPT_ADDRESS END) as tx6_in,
    MAX(CASE WHEN input.index = 6 THEN input.PUBKEY_SCRIPT_ADDRESS END) as tx7_in,
    MAX(CASE WHEN input.index = 7 THEN input.PUBKEY_SCRIPT_ADDRESS END) as tx8_in,
    MAX(CASE WHEN input.index = 8 THEN input.PUBKEY_SCRIPT_ADDRESS END) as tx9_in,
    MAX(CASE WHEN input.index = 9 THEN input.PUBKEY_SCRIPT_ADDRESS END) as tx10_in,
    MAX(CASE WHEN output.index = 0 THEN output.PUBKEY_SCRIPT_ADDRESS END) as tx1_out,
    MAX(CASE WHEN output.index = 0 THEN output.VALUE END) as val1_out,
    MAX(CASE WHEN output.index = 1 THEN output.PUBKEY_SCRIPT_ADDRESS END) as tx2_out,
    MAX(CASE WHEN output.index = 1 THEN output.VALUE END) as val2_out,
    Last run: 3 months ago
    DAY
    User Interest Earned (BTC)
    Loan Repaid (BTC)
    User Interest Earned (USD)
    Loan Repaid (USD)
    Cum. User Interest Earned (BTC)
    Cum. Loan Repaid (BTC)
    Cum. User Interest Earned (USD)
    Cum. Loan Repaid (USD)
    1
    2024-08-27 00:00:00.0000.03069520.65969521903.71630440914.29630436.195847521629.139078422274834.78658488102535371.755041
    2
    2024-08-17 00:00:00.0000.006123040.16012304364.07595849520.915958436.165152321628.479383222272931.07028088102494457.458737
    3
    2024-08-12 00:00:00.0000.001895760.09189576111.474479525403.6544795236.159029281628.319260182272566.99432248102484936.542779
    4
    2024-08-07 00:00:00.0000.002719880.13198985154.929804567518.405835736.157133521628.227364422272455.51984296102479532.888299
    5
    2024-08-06 00:00:00.0000.00104780.039797857.92028842199.942788436.154413641628.095374572272300.5900384102472014.482464
    6
    2024-08-05 00:00:00.0000.002435040.09643501131.72348885216.6518659536.153365841628.055576772272242.66975001102469814.539675
    7
    2024-08-02 00:00:00.0000.004324960.74932496274.9519486448289.9169486436.15093081627.959141762272110.9462612102464597.887809
    8
    2024-08-01 00:00:00.0000.003371680.13337168218.532067528644.3520675236.146605841627.20981682271835.99431256102416307.970861
    9
    2024-07-31 00:00:00.0000.000207240.0082072413.73876856544.0907685636.143234161627.076445122271617.46224504102407663.618793
    10
    2024-07-30 00:00:00.0000.065667042.300667044351.68421808152168.3992180836.143026921627.068237882271603.72347648102407119.528025
    11
    2024-07-27 00:00:00.0000.01938360.945383571317.3317179264249.2006722736.077359881624.767570842267252.03925841102254951.128806
    12
    2024-07-26 00:00:00.0000.020216161.534516111359.0654672103469.298134936.057976281623.822187272265934.70754049102190701.928134
    13
    2024-07-25 00:00:00.0000.080550643.541960525189.83075496228180.2028630336.037760121622.287671162264575.64207329102087232.629999
    14
    2024-07-24 00:00:00.0000.035001361.45696122318.301834296494.122898935.957209481618.745710642259385.81131833101859052.427136
    15
    2024-07-23 00:00:00.0000.056892282.480102133792.75946236165400.4337107335.922208121617.288749442257067.50948413101762558.304237
    16
    2024-07-22 00:00:00.0000.10268924.567428856943.13706152308810.0125740835.865315841614.808647312253274.75002177101597157.870527
    17
    2024-07-21 00:00:00.0000.18799048.2398399512612.08639192552800.8459762235.762626641610.241218462246331.61296025101288347.857953
    18
    2024-07-20 00:00:00.0000.114177565.04534717626.8537306337081.2254753435.574636241602.001378512233719.52656833100735547.011976
    19
    2024-07-19 00:00:00.0000.11729825.187747647615.3835474337627.9646442635.460458681596.956031412226092.67283773100398465.786501
    20
    2024-07-18 00:00:00.0000.130149486.105608858366.88451088392313.9417756835.343160481591.768283772218477.28929033100060837.821857
    ...
    280
    38KB
    248s