# American odds

> Converting decimal prices to American in one line.

## Decimal only on standard and dutching

`standard` and `dutching` serve decimal odds only: oddsFormat=american is a 400 there. `2up`, `each-way`, `extra-place`, `bog`, `raw` and the single-event route take oddsFormat=american and convert for you. On `standard` and `dutching`, convert yourself.

This matches the API's own conversion: a price at or below 1.0 has no American form (`null`), and halves round to even.

JavaScript:

```
const roundHalfEven = (x) => { const f = Math.floor(x); return x - f === 0.5 ? (f % 2 === 0 ? f : f + 1) : Math.round(x); };
const american = (d) => (d <= 1 ? null : d >= 2 ? roundHalfEven((d - 1) * 100) : roundHalfEven(-100 / (d - 1)));
const decimal = (a) => (a > 0 ? 1 + a / 100 : 1 + 100 / -a);
```

Source: https://oddsrelay.io/docs/guides/american-odds · the API contract: https://api.oddsrelay.io/v2/openapi.json
