← Back to posts
DeFi/18 min read/March 10, 2025

Understanding Funding Rates for DeFi Perpetuals

My journey learning about funding rate systems at Opyn - understanding the concept the research team built, and what most people get wrong about how perpetuals stay anchored to spot prices.

DeFiPerpetualsFunding RatesOpynSmart Contracts

My journey understanding funding rate systems at Opyn - learning how the concept works and the stuff that doesn't make it into the docs but probably should.

Why I Spent Months Obsessing Over Funding Rates

When I first joined Opyn, I thought funding rates were just some mathematical formula that someone smarter than me had figured out. Boy was I wrong. The research team at Opyn had already built out this incredible funding rates concept, and I spent months learning how these systems work. Through understanding and working with their implementation, I realized funding rates are basically the magic that keeps perpetuals from completely breaking.

Here's the thing that clicked for me: regular futures have expiration dates, so prices naturally converge to spot when they expire. But perpetuals? They trade forever. Without some forcing mechanism, a BTC perpetual could theoretically trade at $100k while spot BTC is at $50k. That's where funding rates come in.

It's simple economics: when the perp trades above spot, longs pay shorts until enough people switch sides to bring the price back down. When it trades below spot, shorts pay longs.

When I first saw Squeeth funding rates, they seemed way too high and I had no clue why. I was a total noob and couldn't figure it out. A few friends mentioned it might be because of the convex ETH² exposure, but honestly I didn't get what that meant at the time. It was only after spending more time understanding the mechanics that I realized traders were willing to pay these massive premiums for that unique risk profile.

The whole system works because:

  • Without funding, perp prices would drift off into la-la land
  • Arbitrageurs make money keeping everything aligned across different venues
  • Traders can actually calculate what their positions will cost them over time

Basically, funding rates are what make perpetuals actually work instead of just being broken derivatives.

The Math That Actually Matters (And What I Wish Someone Told Me Earlier)

I'm going to save you weeks of confusion here. Most funding rate explanations make this seem way more complicated than it is. The basic formula that everyone uses is:

Funding Rate = (TWAP_Premium + Interest_Rate) * Funding_Interval

Let me break this down like I wish someone had for me:

TWAP_Premium: This is just how much the perp price differs from spot, averaged over time
Interest_Rate: Usually a tiny fixed amount (like 0.01% per 8 hours) representing the cost of leverage. Think of it as the fee you pay to borrow money to take a leveraged position - in traditional finance, if you want to go long $100k of ETH but only have $10k, you need to borrow $90k and pay interest on that loan. This component captures that borrowing cost
Funding_Interval: How often people actually pay/receive funding

The premium calculation is straightforward:

Premium = (Perp_Price - Spot_Price) / Spot_Price

But here's what I learned debugging our system at 3am: you can't just use instant prices. Market makers would manipulate the hell out of that. So everyone uses TWAPs (time-weighted averages) over 8 hours or so.

Real example that helped me finally get it: Say ETH spot is $2,000 and the perp is at $2,010:

Premium = (2010 - 2000) / 2000 = 0.5%
Add the tiny interest rate = 0.01%
Total funding rate = 0.51% per 8 hours

If you're long 1 ETH worth of perps, you pay 1 ETH * 0.51% = 0.0051 ETH in funding.

Sounds simple, right? Wait until you try implementing it...

Why Funding Rate Caps Actually Make Sense

I remember seeing funding rates hit crazy numbers during volatile periods on various protocols when things got wild. At first I didn't understand why this was happening or why it mattered so much. But after watching traders get completely destroyed by funding costs (not even the actual price movements), I started to piece together why most protocols implement caps.

Typical caps I've seen:

  • dYdX: ±0.75% per 8 hours (pretty conservative)
  • Perpetual Protocol: ±10% per day (more aggressive)
  • GMX: Just uses borrowing fees instead (completely different approach)

After thinking about it more, the caps make sense for two reasons: they prevent manipulation attacks and stop funding costs from completely wiping out one side of the trade during market stress.

The Wild Idea That Actually Worked: In-Kind Funding

Okay, so this is where things get interesting. Most perp protocols just move money between traders every 8 hours - longs pay shorts or vice versa. Pretty straightforward.

When I joined Opyn, the research team had already built this brilliant approach where funding costs were baked directly into the token itself. No cash transfers, no complex payment systems, just continuous adjustment of the token's value.

When I first encountered this concept, I was completely confused - "wait, how the hell does that work?" It took me a while to understand, but after spending time with the team and really digging into the mechanics, I realized it was actually genius:

Traditional funding:

Every 8 hours, money moves between traders
Your position size stays the same, your cash balance changes

Opyn's in-kind funding:

No money moves between traders
The token itself adjusts in value continuously
Funding costs are literally embedded in the economics

It was weird to explain to users at first, but way more elegant once people (including me) finally got it.

How the Normalization Factor Works

The normalization factor is probably my favorite piece of financial engineering that the Opyn research team created. It starts at 1.0 and just keeps adjusting based on funding costs:

// This is the core of how it works
uint256 normalizationFactor = 1e18; // Starts at 1.0
uint256 fundingRate = getFundingRate();

// Update continuously (not every 8 hours like others)
normalizationFactor = normalizationFactor * (1e18 + fundingRate) / 1e18;

// Your position value becomes:
uint256 positionValue = originalDebt * normalizationFactor * underlyingPrice;

For Squeeth specifically:

oSQTH Value = Original Debt × Normalization Factor × ETH²

What this means in practice: if you're long Squeeth and funding is positive, the normalization factor slowly reduces your oSQTH's value over time. You're "paying" funding through dilution instead of cash.

I spent way too many hours understanding the edge cases in this system, but damn it was elegant once I grasped how it all worked together.

Why the Team Chose This Approach

The in-kind funding approach the research team developed was honestly a lot more complex than just copying what dYdX was doing. But it had some real advantages:

  1. Gas efficiency: No complex payment systems moving money around every 8 hours
  2. Continuous funding: Instead of discrete payments, funding accrues every block
  3. Simpler UX: Traders don't have to worry about having enough cash for funding payments
  4. Elegant math: The economics are baked right into the token

One quirky thing in the system was multiplying oSQTH prices by 10,000:

uint256 oSQTHPrice = (ethPrice * ethPrice * 10000) / normalizationFactor;

This made prices more readable (instead of tiny decimals), but man did it cause confusion when other protocols tried to integrate with us. I probably answered a hundred questions about why our prices seemed "off" by exactly 10,000x.

Looking back, maybe normal scaling would have been clearer, but it worked fine once everyone understood it.

What This Actually Meant for Traders

In practice, here's how it played out:

  • Longs: Your oSQTH slowly lost value due to the normalization factor (you're paying funding through dilution)
  • Shorts: You benefited as the normalization factor decreased (receiving funding through appreciation)
  • End result: Same economics as traditional funding, just way more elegant

The hardest part was explaining this to users. People are used to seeing cash leave their account for funding. With the system the Opyn team designed, the funding cost was invisible until someone interacted with the protocol's contracts (which would update the normalization factor). Some traders loved it, others found it confusing as hell.

How Everyone Else Does It (And Why We Did It Differently)

After working on this stuff for months, I got pretty familiar with how different protocols handle funding. Each approach has its own quirks:

dYdX: The "Traditional" Approach

dYdX basically copied what BitMEX and FTX were doing in CeFi:

  • Cash payments every hour
  • Fixed 0.01% interest rate per 8 hours
  • Caps at ±0.75% per 8 hours
  • Chainlink oracles for price feeds

The good: TradFi traders immediately understood it. Predictable timing, clear cash flows.

The bad: Complex settlement systems, higher gas costs, and those discrete payment times created MEV opportunities that bots absolutely loved to exploit.

Real example: If you're long 10 ETH on dYdX and the funding rate is 0.1% per 8 hours, every 8 hours exactly $20 (assuming $2000 ETH) gets deducted from your account balance and transferred to short traders. You can see this cash flow directly in your account history.

I remember looking at their implementation and thinking "this is going to be expensive on mainnet" - and I was right.

GMX: The "Screw Funding Rates" Approach

GMX just said "forget traditional funding rates" and went with borrowing fees instead. Traders pay fees to borrow from the liquidity pool, rates adjust based on utilization.

Clever in some ways: simpler to implement, continuous fees, backed by actual reserves.

Weird in others: different mental model for traders, less direct price anchoring, and the whole thing depends on what's in the pool.

Real example: Say you want to go long 5 ETH on GMX. Instead of paying funding to other traders, you pay a borrowing fee to the GLP pool - maybe 2% annually if ETH utilization is high. If the pool is 80% utilized for ETH longs, your borrowing rate goes up. No direct connection to spot-perp price differences.

Honestly, I respect them for trying something completely different. Sometimes the best solution is to just throw out the playbook.

What the Opyn Team Built

The approach:

  • Funding baked into the token itself
  • Continuous adjustment (no 8-hour discrete payments)
  • Zero cash transfers between traders
  • Worked for both regular perps and crazy stuff like Squeeth

The good: Extremely gas efficient, continuous funding, worked for non-linear payoffs that other systems couldn't handle.

The bad: Required a lot of user education. Traditional traders were confused as hell at first. More complex token mechanics meant more potential bugs.

Real example: You mint 1 oSQTH when ETH is $2000 (so you owe 1 ETH² worth). Over time, positive funding slowly decreases the normalization factor from 1.0 to 0.95. When you want to close, you still owe the same debt, but now each oSQTH is worth less due to the lower normalization factor - you've "paid" funding through this dilution, not cash.

But honestly? I'm still amazed by this system. It was genuinely innovative and solved real problems with existing approaches.

Perpetual Protocol: The AMM Experiment

Perp Protocol tried to bring AMM mechanics to perpetuals with virtual Uniswap-like price discovery.

Cool idea: decentralized price discovery, familiar DeFi patterns, AMM-based liquidity.

Practical issues: Virtual AMMs are complex as hell, impermanent loss dynamics get weird, and funding rates could be pretty volatile.

Real example: You go long 3 ETH on Perp Protocol at $2000. The virtual AMM determines your entry price based on slippage against the virtual liquidity. Every 8 hours, if the virtual AMM price is above the Chainlink index price, you pay funding. But the funding rate depends on how imbalanced the virtual AMM has become, which could swing wildly.

I give them credit for trying something different, but the complexity made me appreciate our simpler approach even more.

The Comparison That Actually Matters

Protocol Payment Type Frequency Price Oracle Caps My Take
dYdX Cash Hourly Chainlink ±0.75%/8h Safe but expensive
GMX Borrowing Fees Continuous Chainlink/Pyth Dynamic Creative but weird
Opyn In-Kind Continuous Chainlink/TWAP None Elegant but confusing
Perp Protocol Cash 8 hours Chainlink ±10%/day AMM complexity

Each approach makes different trade-offs. dYdX prioritized familiarity, GMX prioritized simplicity, we prioritized elegance, and Perp Protocol prioritized decentralization.

Honestly, there's no "right" answer - it depends on what you're optimizing for.

The Oracle Nightmare (And Why TWAPs Saved Our Ass)

Let me tell you about oracles and funding rates. Getting price feeds right is absolutely critical, and there are so many ways to screw it up.

How the Oracle System Works

For Squeeth, our oracle setup was:

  • Chainlink ETH/USD for the main index price (reliable, battle-tested)
  • Uniswap V3 TWAP for funding calculations (manipulation-resistant)
  • TWAP period to smooth out the noise

For Opyn Markets, we got much more sophisticated:

  • Chainlink + Pyth Network for primary feeds
  • Uniswap TWAPs for premium calculations
  • Multiple oracle sources with flexible configuration

The multiple oracle setup became crucial because Opyn Markets is designed to serve as infrastructure for the next layer of products. We wanted to support any market on any asset pair with any oracle - so the system needed to be flexible enough to handle whatever combinations builders wanted to create on top of us.

I learned through experience that redundancy matters. The team had a few close calls where one oracle started acting weird, and having backups saved from major issues.

Why TWAPs Are Essential

Using instant prices for funding calculations is asking for trouble. Here's why TWAPs are so important:

  1. Anti-manipulation: Way harder to manipulate a TWAP average than a single block
  2. Smooths out noise: Random price spikes don't create insane funding rates
  3. Captures real trends: Long-term price differences are what funding should reflect

The TWAP math is straightforward:

// TWAP calculation
uint256 timeWeightedPrice = 0;
uint256 totalTime = 0;

for (uint256 i = 0; i < observations.length - 1; i++) {
    uint256 timeDelta = observations[i+1].timestamp - observations[i].timestamp;
    timeWeightedPrice += observations[i].price * timeDelta;
    totalTime += timeDelta;
}

uint256 twapPrice = timeWeightedPrice / totalTime;

I remember one time ETH spiked 10% for like 5 minutes due to some weird trade, then came right back down. With instant prices, that would have created a massive funding rate spike. With TWAP, it barely registered. That's when I really appreciated the design.

Why Oracle "Lag" is Actually Perfect

Here's something counterintuitive I learned: the "lag" in TWAPs isn't a bug, it's a feature.

Why lag actually helps:

  • Prevents manipulation: Can't game funding by causing short-term price spikes
  • Filters out noise: Random price movements don't create funding costs
  • Captures real trends: Only sustained differences matter
  • Self-correcting: Any temporary lag gets smoothed out over time

Real example: Say ETH jumps from $2,000 to $2,100 for 5 minutes then drops back. With instant prices, that brief spike would create a massive funding rate. With our TWAP, it barely registers.

I used to worry about this lag, thinking it made our system less responsive. But after seeing it in action during volatile periods, I realized it was actually making the system more fair and harder to manipulate.

The Implementation Details That Ate My Weekends

Gas optimization was crucial (this is Ethereum after all):

// Store cumulative observations to save gas
struct Observation {
    uint256 timestamp;
    uint256 priceCumulative;
}

// Efficient TWAP calculation
function getTWAP(uint256 period) public view returns (uint256) {
    Observation memory latest = observations[observations.length - 1];
    Observation memory oldest = observations[observations.length - period];

    return (latest.priceCumulative - oldest.priceCumulative) /
           (latest.timestamp - oldest.timestamp);
}

Oracle failure handling (learned this the hard way):

  • Always have fallback oracles
  • Circuit breakers for when prices go completely insane
  • Manual override for "oh shit" moments

I probably spent more time on oracle edge cases than the core funding logic. But when oracles break, everything breaks, so it was worth the paranoia.

Honestly, oracle design for DeFi derivatives could be its own blog post. Maybe I'll write that next.

What I Learned Watching Our System in Production

Running funding rate systems in the wild taught me things that no amount of theoretical modeling could have prepared me for.

The Squeeth Funding Rate Reality Check

Funding rates were higher, just as designed. I remember discussing this with colleagues - many people thought it was expensive. But this wasn't unexpected - the higher rates were meant to reflect the value of that convex ETH² exposure. The second power creates convexity that traders were willing to pay premiums for, especially when things got volatile.

Longs almost always paid. Because of Squeeth's convex nature (gains accelerate as ETH rises), the perp almost always traded at a premium. Long positions consistently paid funding to shorts, which created this interesting yield opportunity for sophisticated market makers.

The rare "silver platter" moments. During major ETH crashes, Squeeth occasionally flipped to negative funding rates. I called these "gifts served on a silver platter" - you could get paid to hold convex upside exposure right when it was most valuable.

These patterns taught me that funding rates aren't just mathematical constructs - they're real expressions of market sentiment and risk appetite.

Funding Rates as a Crystal Ball

Watching funding rates became like reading market psychology in real time:

High positive funding (longs paying through the nose):

  • Everyone was bullish as hell
  • Traders throwing money at convex upside exposure
  • Usually happened right before major ETH rallies (not always, but often enough to notice)

Low or negative funding (shorts paying):

  • Pure fear in the market
  • People desperately hedging
  • Almost always during major market stress events

I started checking Squeeth funding rates as part of my daily market sentiment gauge. It was honestly more reliable than most traditional indicators.

The Arbitrage Opportunities Created

The different funding mechanism created some interesting arb opportunities:

Squeeth vs regular perps: Smart traders would delta-hedge Squeeth against linear ETH perps, capturing funding rate differences while staying market-neutral. We'd see these huge sophisticated positions that were basically just funding rate arbitrage.

Continuous vs discrete funding: Our normalization factor approach meant funding accrued every block, while other protocols paid every 8 hours. This created temporal arbitrage opportunities that some traders absolutely loved.

Watching these arbitrageurs work was honestly fascinating. They were basically getting paid to keep our prices efficient across different venues.

The Revenue Trade-off

Opyn's approach: The protocol didn't directly capture funding fees like other protocols. Instead, the value went to the ecosystem through better price discovery and lower gas costs.

Traditional approach: Protocols like dYdX make money on every funding payment. Direct revenue but more complex infrastructure.

Looking back, maybe the protocol left money on the table. But the approach aligned with the broader goal of creating more efficient markets, even if it didn't directly fill the treasury.

How Traders Had to Adapt (And The Confusion Along the Way)

The education problem: Holy shit, explaining in-kind funding to users was hard. People kept asking "where's my funding payment?" not realizing it was happening through token dilution.

Strategy changes: Traders had to completely rethink position management. No more "I'll hold until the next funding payment" - funding was accruing every single block.

I spent countless hours in Discord explaining how the system worked. Eventually the team got better at the messaging, but there was definitely a learning curve.

What Market Makers Told Us (The Good and The Ugly)

The complexity: Market making Squeeth required understanding gamma, funding dynamics, and our weird normalization factor all at once. Not many people could handle that complexity.

The hedging nightmare: Market makers needed sophisticated strategies to hedge both the underlying exposure and the funding costs. Funding rate volatility became a major factor in their profitability calculations.

The feedback: Some MMs loved the system for its continuous nature and gas efficiency. Others hated it because it was so different from what they were used to.

Ultimately, the market makers who "got it" did really well. But we definitely lost some potential liquidity from people who couldn't adapt to our approach.

Where I Think This Is All Heading

The Cool Stuff People Are Working On

Cross-chain funding arbitrage: As DeFi spreads across different chains, funding rate differences between networks are creating new opportunities. Some protocols are trying to implement cross-chain funding mechanisms.

Adaptive funding systems: Moving beyond fixed formulas to systems that actually adapt to market conditions. Kind of like how AMMs evolved from simple constant product to concentrated liquidity.

Funding + yield farming mashups: People are starting to combine funding rates with DeFi yield strategies, creating these complex products that mix perpetual exposure with yield generation.

The Problems Nobody's Solved Yet

  1. MEV in funding payments: Those discrete 8-hour payments create MEV opportunities that people are definitely exploiting
  2. Exotic derivatives funding: How do you implement funding for weird synthetic assets and power perpetuals?
  3. Regulatory uncertainty: Nobody really knows how regulators will treat funding rate mechanisms

Honestly, I think we're still in the early days of funding rate innovation. The space is evolving fast, and there's probably some breakthrough waiting to be discovered.


These are my thoughts from learning about and working with funding rate systems in production. The theory is important, but nothing beats seeing how these mechanisms behave when real money is on the line.