Query editor
-- Pendle-LPT -> mFARM Dec 10 2025WITH raw_data AS (SELECT http_get('https://api-v2.pendle.finance/core/v2/1/markets/0x56649da435f9a9a57ee9c4c06b728e4ba84fcc6b/history?time_frame=hour') as response)SELECTfrom_iso8601_timestamp(json_extract_scalar(result, '$.timestamp')) as timestamp,-- Liquidity metricsCAST(json_extract_scalar(result, '$.liquidity.usd') AS DOUBLE) as liquidity_usd,CAST(json_extract_scalar(result, '$.liquidity.acc') AS DOUBLE) as liquidity_acc,-- Trading volumeCAST(json_extract_scalar(result, '$.tradingVolume.usd') AS DOUBLE) as trading_volume_usd,-- TVLCAST(json_extract_scalar(result, '$.totalTvl.usd') AS DOUBLE) as total_tvl_usd,-- Underlying APY componentsCAST(json_extract_scalar(result, '$.underlyingInterestApy') AS DOUBLE) as underlying_interest_apy,CAST(json_extract_scalar(result, '$.underlyingRewardApy') AS DOUBLE) as underlying_reward_apy,CAST(json_extract_scalar(result, '$.underlyingApy') AS DOUBLE) as underlying_apy,-- Market pricingCAST(json_extract_scalar(result, '$.impliedApy') AS DOUBLE) as implied_apy,-- YT APY (longYieldApy from docs)CAST(json_extract_scalar(result, '$.ytFloatingApy') AS DOUBLE) as yt_floating_apy,-- PT discountCAST(json_extract_scalar(result, '$.ptDiscount') AS DOUBLE) as pt_discount,CAST(json_extract_scalar(result, '$.ptDiscount') AS DOUBLE) * 100 as pt_discount_pct,-- LP and voter rewardsCAST(json_extract_scalar(result, '$.swapFeeApy') AS DOUBLE) as swap_fee_apy,CAST(json_extract_scalar(result, '$.pendleApy') AS DOUBLE) as pendle_apy,CAST(json_extract_scalar(result, '$.lpRewardApy') AS DOUBLE) as lp_reward_apy,CAST(json_extract_scalar(result, '$.voterApy') AS DOUBLE) as voter_apy,-- Aggregated APYCAST(json_extract_scalar(result, '$.aggregatedApy') AS DOUBLE) as aggregated_apy,-- Calculated metricsCAST(json_extract_scalar(result, '$.aggregatedApy') AS DOUBLE) -CAST(json_extract_scalar(result, '$.underlyingApy') AS DOUBLE) as pendle_bonus_apy,CAST(json_extract_scalar(result, '$.swapFeeApy') AS DOUBLE) +CAST(json_extract_scalar(result, '$.lpRewardApy') AS DOUBLE) +CAST(json_extract_scalar(result, '$.pendleApy') AS DOUBLE) as total_lp_apy,-- Pool reserves (PT and SY in the AMM)CAST(json_extract_scalar(result, '$.totalPt') AS DOUBLE) as total_pt,CAST(json_extract_scalar(result, '$.totalPt') AS DOUBLE) -LAG(CAST(json_extract_scalar(result, '$.totalPt') AS DOUBLE)) OVER (ORDER BY from_iso8601_timestamp(json_extract_scalar(result, '$.timestamp'))) as total_pt_hourly_change,CAST(json_extract_scalar(result, '$.totalSy') AS DOUBLE) as total_sy,CAST(json_extract_scalar(result, '$.totalSy') AS DOUBLE) -LAG(CAST(json_extract_scalar(result, '$.totalSy') AS DOUBLE)) OVER (ORDER BY from_iso8601_timestamp(json_extract_scalar(result, '$.timestamp'))) as total_sy_hourly_change,