DEV Community

96FGG Guide
96FGG Guide

Posted on

Settling Asian handicap quarter lines in vanilla JavaScript

Asian handicap lines look simple until you hit a quarter line such as −0.75 or −1.25. Those are not “almost a half line.” The stake is split in half and settled on two neighbouring lines, which is why a one-goal win can come back as a half-win rather than a full win or a push.

This article walks through the settlement rule, checks it against a published payout example, and then implements it in a small vanilla JavaScript function. It is educational maths, not betting advice. 18+.

Disclosure: I work on a Traditional Chinese football-betting guide that hosts a free in-browser version of this calculator. That website also contains affiliate links to a betting operator. This article does not include those links, and I am not asking you to place a bet.

The five possible results

For the team you backed, compute:

adjusted = (your team’s goals − opponent’s goals) + line

  • adjusted > 0: win
  • adjusted = 0: push (stake returned)
  • adjusted < 0: loss

A winning slice pays stake × decimal odds (that figure includes the returned stake). A push returns the stake. A loss pays 0.

Whole and half lines use a single line, so the bet has one result. Quarter lines use two lines.

If the quoted handicap is a multiple of 0.25 but not of 0.5 — for example −0.75 or −1.25 — split the stake equally over:

  • line − 0.25
  • line + 0.25

So −0.75 becomes half the stake at −1.00 and half at −0.5. In Hong Kong naming, that line is 半一 (“half-and-one”). −0.25 is 平半; −1.25 is 一/球半.

A published worked example

The Hong Kong Jockey Club has published a payout example that uses the same split. A HK$200 bet on −1/−1.5 at decimal odds 2.00:

  • If the team wins by exactly one goal: one half loses, one half is refunded, so the payout is HK$100.
  • If the team wins by two or more: both halves win, so the payout is HK$400 (stake plus profit).

We can use those two figures as a regression test for the function below.

Decimal odds 2.00 is the same as Hong Kong odds 1.00, because Hong Kong odds equal decimal odds minus 1. The win/push/loss result does not depend on the odds format; only the cash profit does.

The function

/**
 * Settle one Asian-handicap selection.
 * @param handicap Line on the team you backed, e.g. -0.75 or -1.25
 * @param goalDiff Your team’s goals minus the opponent’s goals
 * @param decimalOdds e.g. 2.00
 * @param stake e.g. 200
 */
function settleAsianHandicap({ handicap, goalDiff, decimalOdds, stake }) {
  const isQuarterLine = !Number.isInteger(handicap * 2);
  const lines = isQuarterLine
    ? [handicap - 0.25, handicap + 0.25]
    : [handicap];

  const perStake = stake / lines.length;
  let payout = 0;

  const parts = lines.map((line) => {
    const adjusted = goalDiff + line;
    let result;
    let partPayout;

    if (adjusted > 0) {
      result = "win";
      partPayout = perStake * decimalOdds;
    } else if (adjusted === 0) {
      result = "push";
      partPayout = perStake;
    } else {
      result = "loss";
      partPayout = 0;
    }

    payout += partPayout;
    return { line, result, partPayout };
  });

  return { parts, payout, profit: payout - stake };
}

// HKJC published example: HK$200 on [-1/-1.5] @ 2.00
const winByOne = settleAsianHandicap({
  handicap: -1.25,
  goalDiff: 1,
  decimalOdds: 2,
  stake: 200,
});
// payout 100 (half loss, half push)

const winByTwo = settleAsianHandicap({
  handicap: -1.25,
  goalDiff: 2,
  decimalOdds: 2,
  stake: 200,
});
// payout 400 (both halves win)
Enter fullscreen mode Exit fullscreen mode

In-play bets need one extra question

The function above does not know whether an in-play bet should use the official full-time score or only the goals scored after the bet was placed. Bookmakers differ. If you are settling a live bet, decide which goal difference you are feeding in before you call the function. A pure −0.5 line still cannot push under either convention.

The function also assumes regular time only. Extra time and penalties are a separate market rule.

Try it with your own numbers

There is a free live demo that uses this settlement rule, including quarter lines, and does the calculation in the browser (no account, and the numbers you type are not uploaded):

https://96fggguide.com/tools/asian-handicap-calculator/

The same logic is also used in a set of worked HKD simulations:

https://96fggguide.com/guides/hkd-simulations/

If you reimplement this, keep the two HKJC figures above as tests. If those fail, the split is wrong.

This article is for understanding settlement maths. It is not a prediction, and it does not claim that any operator is licensed in Hong Kong. Please gamble only if it is lawful where you are, and only with money you can afford to lose.

Top comments (0)