Skip to main content
We enforce an odds ladder to prevent diming. Your offer, in implied odds, must fall on one of the steps on the ladder. Currently, that is set to intervals of 0.125%, meaning that your offer cannot fall between the steps. An offer of 50.25% would be valid, but an offer of 50.20% would not. You can check if your odds would fall on the ladder by taking the modulus of your odds and 1.25 * 10 ^ 17 and checking if it’s equal to 0. You can get the current interval from GET /metadata. It will spit out a number from 0 to 1000, where 10 = 0.010%, and 125 = 0.125%.
Odds not on the ladder will be rejected and your order(s) will not be posted.

Validating and rounding odds

export const ODDS_LADDER_STEP_SIZE = 125n; // (0.125% = 125n, 0.25% = 250n, etc)

/**
 * Check if the odds are valid, i.e., in one of the allowed steps
 * @param odds Odds to check (as bigint)
 */
export function checkOddsLadderValid(odds: bigint): boolean {
  // Logic:
  // 100% = 10^20
  // 10% = 10^19
  // 1% = 10^18
  // 0.1% = 10^17
  // 0.001% = 10^15 → step = 10^15 * 125 = 1.25 * 10^17 = 0.125%
  const step = 10n ** 15n * ODDS_LADDER_STEP_SIZE;
  return odds % step === 0n;
}

/**
 * Rounds odds down to the nearest step.
 * @param odds Odds to round (as bigint).
 */
export function roundDownOddsToNearestStep(odds: bigint): bigint {
  const step = 10n ** 15n * ODDS_LADDER_STEP_SIZE;
  return (odds / step) * step;
}