pietrektPOL Unrealized P/L
    Updated 5 hours ago
    -- FULL LP DEPOSIT TRANSACTIONS
    WITH lp_deposits AS (
    SELECT block_timestamp,
    CASE
    WHEN tx_id is not null then tx_id
    ELSE asset_tx_id
    END as tx_id,
    CASE
    WHEN from_address is not null THEN from_address
    ELSE asset_address
    END as address, pool_name, stake_units,
    rune_amount as amount_change_rune, rune_amount as true_amount_rune, 0 as slip_fee_rune,
    asset_amount as amount_change_asset, asset_amount as true_amount_asset, 0 as slip_fee_asset, 1 as type
    FROM thorchain.defi.fact_liquidity_actions WHERE lp_action = 'add_liquidity' and pool_name like '%.%'),
    -- FULL LP WITHDRAW TRANSACTIONS
    lp_withdrawals AS (
    SELECT block_timestamp,
    CASE
    WHEN tx_id is not null then tx_id
    ELSE asset_tx_id
    END as tx_id,
    CASE
    WHEN from_address is not null THEN from_address
    ELSE asset_address
    END as address, pool_name, -stake_units as stake_units,
    -rune_amount as amount_change_rune, -asset_amount as amount_change_asset, unstake_basis_points as basis_points, 0 as type
    FROM thorchain.defi.fact_liquidity_actions WHERE lp_action = 'remove_liquidity' and pool_name like '%.%'),

    lp_amount_withdrawn AS (SELECT a.block_timestamp, a.tx_id, address, a.pool_name, a.stake_units, amount_change_rune, amount_change_asset,
    CASE
    WHEN b.asset = 'THOR.RUNE' THEN asset_e8 / pow(10, 8)
    ELSE 0
    END AS rune_amount,
    CASE
    WHEN b.asset <> 'THOR.RUNE' THEN asset_e8 / pow(10, 8)
    ELSE 0
    Last run: about 5 hours agoAuto-refreshes every 24 hours
    DAY
    ASSET_NAME
    UNREALIZED_PL_RUNE
    TOTAL_UNREALIZED_PL_RUNE
    1
    2025-04-10 00:00:00.000Others887697.875354759-247740.180484406
    2
    2025-04-10 00:00:00.000BTC.BTC-1732215.88324767-247740.180484406
    3
    2025-04-10 00:00:00.000STABLECOIN596777.827408503-247740.180484406
    4
    2025-04-09 00:00:00.000BTC.BTC-1705781.00678088-236739.092319502
    5
    2025-04-09 00:00:00.000Others877984.376046352-236739.092319502
    6
    2025-04-09 00:00:00.000STABLECOIN591057.538415027-236739.092319502
    7
    2025-04-08 00:00:00.000STABLECOIN591507.434980634-453433.970657184
    8
    2025-04-08 00:00:00.000BTC.BTC-1895789.08542356-453433.970657184
    9
    2025-04-08 00:00:00.000Others850847.679785742-453433.970657184
    10
    2025-04-07 00:00:00.000Others846679.434039276-435765.604689026
    11
    2025-04-07 00:00:00.000STABLECOIN585814.128988486-435765.604689026
    12
    2025-04-07 00:00:00.000BTC.BTC-1868259.16771679-435765.604689026
    13
    2025-04-06 00:00:00.000Others819165.047063801-404410.967764087
    14
    2025-04-06 00:00:00.000STABLECOIN582837.127294883-404410.967764087
    15
    2025-04-06 00:00:00.000BTC.BTC-1806413.14212277-404410.967764087
    16
    2025-04-05 00:00:00.000STABLECOIN575714.498002637-368056.45497309
    17
    2025-04-05 00:00:00.000Others840350.107325213-368056.45497309
    18
    2025-04-05 00:00:00.000BTC.BTC-1784121.06030094-368056.45497309
    19
    2025-04-04 00:00:00.000Others838555.883974824-333620.700767597
    20
    2025-04-04 00:00:00.000STABLECOIN573488.897737077-333620.700767597
    ...
    2130
    145KB
    4s