Dydx tutorial is an educational resource explaining perpetual futures funding premiums
Dydx tutorial is a procedure for tracing how order-book pressure becomes an hourly funding payment on dYdX Chain. Block proposers measure a market premium from impact bid and ask prices against the index price. The chain reduces those votes into minute samples, averages the samples over an hour and updates a funding index that transfers value between long and short positions. Positive funding makes longs pay shorts; negative funding reverses the direction. The sections below show the rate conversion, payment arithmetic, margin-based clamps and fixed software parameters. They also separate the displayed 8-hour rate from the one-hour amount that reaches realized P&L, the distinction that matters when estimating carrying cost.
In this guide
Funding premiums turn order-book pressure into an hourly carrying cost
When a perpetual trades away from its index, dYdX funding turns that gap into an hourly transfer between opposing positions in the market. For a trader deciding whether to hold across the next tick, the funding sign becomes part of carrying cost. A positive premium means bids support an impact sale above the index and longs pay shorts after aggregation. A negative premium means asks support an impact purchase below the index and shorts pay longs. Settlement repeats every 1 hour for BTC-USD, ETH-USD and SOL-USD positions, producing a named entry such as ETH-USD hourly funding.
How much does funding change a position’s P&L?
When position notional and the displayed rate are known, dYdX funding changes realized P&L by notional multiplied by the applicable hourly rate. The neighboring topic is handled in Dydx quick start.
Read the sign before the size
A positive rate is a cost to a long and a credit to a short; a negative rate reverses both entries. The sign doesn’t describe whether the underlying asset rose or fell. It identifies which side pays to counter the perpetual’s premium or discount. Funding runs through the USDC-denominated realized P&L of the subaccount, while entry-price P&L remains a separate component. A BTC-USD long can therefore gain on price and still record a funding debit during the same 1-hour interval.
Convert the display period before multiplying
The software expresses the aggregated premium on an 8-hour scale and realizes one eighth during a normal 3,600-second tick. Take one hypothetical position valued at 20,000 USDC with a positive 8-hour rate of 0.04%. Dividing by 8 gives 0.005% for the hour. Multiplying 20,000 by 0.00005 gives 1 USDC, so the long records a 1 USDC debit and the short receives the corresponding credit. On-chain arithmetic uses base quantums, the oracle price and the funding index, so a front end may show rounded decimals beside that 1 USDC funding debit.
Premium votes filter one block into an hour of data
When block proposers report different order-book views, dYdX Chain reduces those votes through a 60-second median and a 3,600-second average process.
Impact prices define the premium
The dYdX central limit order book supplies two depth-aware prices. The impact bid is the average fill price for a market sell of the impact notional; the impact ask is the corresponding market buy price. dYdX computes premium = [max(0, impact bid − index) − max(0, index − impact ask)] / index. The default liquidity-tier formula sets impact notional at 500 USDC divided by the initial margin fraction. A 5% fraction produces 10,000 USDC, while a 10% fraction produces 5,000 USDC. This depth test makes thin top-of-book quotes less decisive.
Votes become minute samples
Every CometBFT block proposer builds a FundingPremiumVote from its local dYdX order-book view. The vote is bounded before it enters state. At 30 seconds past each minute, the funding-sample epoch closes and the chain takes the median. The default software requires at least 15 votes for each minute sample and pads missing entries with zero before taking the median. Zero padding prevents a short block window from being treated like a fully populated one, while the median limits the effect of a single extreme vote.
Samples become an hourly rate
At the start of the hour, the funding-tick epoch processes 60 minute samples across 3,600 seconds. The implementation sorts the samples, removes 0 ppm from each tail under its software constant and averages the remainder, so the default is a simple mean. It then adds the market’s default 8-hour interest component, which is 0% in the default settings. The funding index realizes 1/8 of that combined 8-hour rate for the elapsed hour.
The dYdX Chain Indexer records premium samples, funding rates and funding-index updates for applications. A trading interface can translate those values into 1-hour, 8-hour or annualized views without changing consensus state. Because an annualized display extrapolates a short interval, the settled record is the clearer reconciliation point for a BTC-USD 1-hour funding entry.
How do margin tiers set the funding cap?
When a market’s initial and maintenance margins are farther apart, dYdX permits a wider funding cap because the formula scales with that margin gap.
From margin gap to cap
The clamp starts with the initial margin fraction minus the maintenance margin fraction. Default software multiplies that gap by 600% to cap the 8-hour funding-rate magnitude. With default settings, a 5% initial margin and 3% maintenance margin create a 12% maximum 8-hour funding rate, or 1.5% for one hour. Both positive and negative rates use the same absolute bound. The cap limits one settlement’s funding charge without altering the market’s oracle price, position size or maintenance threshold.
Premium votes receive a wider bound
Individual premium votes receive a much wider default clamp: 6,000% of the same margin gap. With a 2% gap, the per-vote magnitude stops at 120% before the median is taken. That number isn’t the hourly charge. The 15-vote minimum, median sampling and 60-sample hourly average act next, followed by the 600% funding-rate clamp. Keeping these bounds separate prevents a raw order-book observation from being mistaken for the final 1-hour rate.
Two markets with the same measured premium can settle at different caps when their liquidity tiers carry different margin fractions. The decisive inputs are the two margin fractions and the market’s 8-hour rate, as illustrated by the 12% cap.
Fixed parameters behind the funding calculation
When an implementation follows the default dYdX Chain settings, seven fixed parameters define its sampling cadence, arithmetic bounds and settlement timing directly.
| Parameter | Default value | Practical role | Security tier |
|---|---|---|---|
| Funding sample duration | 60 seconds | Closes each vote window | Consensus-enforced |
| Sample offset | 30 seconds past the minute | Schedules the sample boundary | Consensus-scheduled |
| Funding tick duration | 3,600 seconds | Applies hourly funding | Consensus-enforced |
| Funding realization period | 28,800 seconds, or 8 hours | Prorates the index delta | Deterministic arithmetic |
| Minimum votes per sample | 15 votes | Pads short windows with zeros | Governance-validated |
| Funding-rate clamp factor | 6,000,000 ppm, or 600% | Scales the margin-gap cap | Governance-validated |
| Premium-vote clamp factor | 60,000,000 ppm, or 6,000% | Bounds each proposed premium | Governance-validated |
| Pipeline summary | 60 seconds → 3,600 seconds → 28,800 seconds | Vote, sample and settle | Consensus-validated |
The funding index calculation uses a fixed 28,800-second realization period, so a normal 3,600-second tick applies exactly one eighth of the 8-hour rate. The code stores rate parameters in parts per million: 1,000,000 ppm equals 100%, while 1 ppm equals 0.0001%. That representation keeps integer arithmetic deterministic across validators. Timing parameters and clamp factors remain distinct; changing a 60-second sample window doesn’t automatically change the 28,800-second realization denominator.
The 15-vote minimum and 0 ppm tail removal address different gaps. The first handles too few block votes within one minute. The second controls whether extreme minute samples are discarded before the hourly mean. This Dydx tutorial treats the table as default software configuration because dYdX governance can amend state parameters on a deployment. A parameter audit should therefore pair each funding entry with its epoch settings and the 15-vote minimum.
Chain governance keeps funding parameters auditable
When a deployment changes funding behavior, dYdX Chain governance records the parameter change while Cosmos SDK consensus keeps the resulting arithmetic deterministic across validators. The DYDX community can govern epoch information, clamp factors and liquidity tiers, while CometBFT orders the blocks carrying premium votes. This design places funding inside the chain’s state transition rather than a private exchange ledger. Noble and IBC handle USDC movement in the wider Cosmos environment, but the hourly transfer remains a subaccount P&L update. Together, governance history and Indexer events preserve an auditable dYdX Chain funding index.
Dydx tutorial: quick answers
Does closing a dYdX position before the hourly tick avoid the next funding payment?
A position fully closed before the funding index updates doesn’t participate in the upcoming hourly transfer. dYdX Chain settles the funding index at the hourly tick, so block inclusion time controls the outcome. A closing order that remains unfilled leaves exposure open, while a completed reduction lowers the base quantity used for the next settlement.
Can an unfilled limit order receive or pay dYdX funding?
An unfilled limit order doesn’t receive or pay funding because funding applies to positions, not resting orders. Once any quantity fills, that filled amount becomes position exposure and joins later funding-index updates. Immediate-or-Cancel and Post-Only instructions change execution behavior, but neither creates funding exposure until the order produces a fill.
Which price values a dYdX funding payment?
The oracle index price values the position when dYdX Chain computes the funding-index change. Entry price still matters for trading P&L, while impact bid and impact ask prices determine the premium input. That separation means the order book shapes the rate, yet the oracle-priced base quantity determines the settlement amount.
Is dYdX funding paid in DYDX or USDC?
Funding settles through the USDC-denominated P&L of the trading subaccount rather than as a DYDX token transfer. A debit reduces realized P&L and a credit increases it. The DYDX token serves network functions such as staking and governance, while the perpetual’s quote accounting records the funding entry in USDC.
Why can the annualized dYdX funding display change so sharply?
Annualized funding jumps when a short measurement window is projected across a full year. The front end can display one-hour, 8-hour and annualized views of the same market signal. A brief order-book imbalance therefore looks much larger after annual extrapolation, even though only the scheduled hourly amount reaches the funding index at that tick.
Do cross-margin and isolated perpetuals use different funding pipelines?
Cross-margin and isolated perpetuals use the same funding pipeline, but each market keeps its own premium samples and funding rate. Margin mode changes how collateral supports the position, not the vote-to-sample arithmetic. Cross margin shares equity across eligible positions, while isolated margin confines collateral and risk to one position. Each market’s liquidity tier still determines its impact notional and clamps.
Could funding alone trigger liquidation on dYdX Chain?
Funding debits can push account equity below the applicable maintenance margin and thereby make a position eligible for liquidation. The payment itself doesn’t change the base position size, but it changes realized P&L and equity. A highly leveraged position with little margin buffer therefore has less capacity to absorb repeated positive funding while held long, or repeated negative funding while held short.