Hedging a Betfair back bet with a lay at shorter odds — the arithmetic, commission-adjusted P&L, partial hedges, and when to hedge rather than let it run.
A back bet at 4.0 that drifts to 3.5 before the off is a position you no longer need to hold. Hedging — laying the same selection at shorter odds — converts the open position into a guaranteed profit whatever the outcome. It is the most underused tool in a recreational trader’s kit, partly because the arithmetic looks trivial and partly because it isn’t: commission, invalid tick sizes and partial hedges all change the numbers. This post covers the hedge calculation in Java, the commission adjustment, and the trading decision around when hedging is right.
You backed £100 on a runner at 4.0. It is now trading at 3.5. Lay the same runner at 3.5 with stake L. Two outcomes:
100 × (4.0 − 1) = £300 on the back, and pay out L × (3.5 − 1) = 2.5L on the lay.L from the lay.Setting the two outcomes equal — the definition of a locked-in profit:
300 − 2.5L = L − 100
400 = 3.5L
L = 114.29
The general form collapses to something almost too simple to need a calculator:
layStake = backStake × backOdds / layOdds
100 × 4.0 / 3.5 = 114.29, and the guaranteed profit — ignoring commission for a moment — is layStake − backStake = £14.29. That £14.29 is the market’s payment for taking the other side of your edge at a better price than you got.
Betfair charges commission on net winnings, so the two outcomes are not actually equal once commission is applied. The commission is charged on the winning side of each settled market, which means the hedge’s guaranteed profit is slightly different per outcome:
record HedgeResult(double layStake, double profitIfWins, double profitIfLoses) {
double guaranteed() { return Math.min(profitIfWins, profitIfLoses); }
}
HedgeResult hedge(double backStake, double backOdds, double layOdds, double commissionRate) {
double layStake = backStake * backOdds / layOdds;
double commission = 1.0 - commissionRate;
double profitIfWins = (backStake * (backOdds - 1.0) - layStake * (layOdds - 1.0)) * commission;
double profitIfLoses = layStake - backStake;
return new HedgeResult(layStake, profitIfWins, profitIfLoses);
}
With a 2% commission and the example above, the win side nets £14.29 × 0.98 ≈ £14.00 while the loss side still nets the full £14.29 (a losing market generates no commission). The guaranteed figure is the smaller of the two — and a good calculator shows both, because the asymmetry matters when you are comparing a hedge against greening up.
The lay stake is only usable if the lay price is a valid tick on the Betfair ladder. 3.5 is fine; 3.52 does not exist. A production calculator validates the price against the tick-size table for the price band before computing anything, and snaps to the nearest valid price when the user types an invalid one — otherwise the “guaranteed” profit is fiction. The same rule applies to the stake: it must respect the minimum bet increment for the market.
You do not have to lock the whole position. Hedging a fraction f of the back stake locks in f of the guaranteed profit while leaving the rest exposed to the runner winning at full odds:
double partialLay = backStake * f * backOdds / layOdds;
Partial hedging is how a trader expresses conviction: the more the price shortens, the more they lock, while keeping a live position on the outcome they still believe in. The maths is the same formula applied to a reduced stake — the only real decision is f, which is a risk question, not a maths one.
The calculator is the easy half; the decision is the hard half. Hedging makes sense when:
It makes less sense when the price has only drifted slightly, or when you have a genuine edge on the win side that a hedge would cap. Hedging also differs from greening up: greening equalises profit across all outcomes of a market, while a hedge targets one position. I covered the greening arithmetic separately in greening up — locking in profits; the two belong in the same toolbox but answer different questions.
layStake = backStake × backOdds / layOdds — if you remember one formula, this is it.The /hedging/ calculator demo on this site animates exactly this flow — back stake, back odds, current lay odds in, optimal lay stake, liability and guaranteed P&L for both outcomes out, with commission and tick-ladder validation built in. It is the calculator from this post, live.
If you’re building trading tooling around the Betfair API and want the arithmetic handled right, discuss your project.