> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sx.bet/llms.txt
> Use this file to discover all available pages before exploring further.

# Unit Conversion

> Converting token amounts and odds formats

## Tokens

Token amounts in the API use an integer representation with a "decimals" value to avoid rounding issues. For example, 100 USDC is stored as 100 \* 10^6 = 100000000. Here is a table for the tokens supported by SX.bet and their associated decimals value

| Token | Address                                       | Decimals |
| ----- | --------------------------------------------- | -------- |
| USDC  | See `https://api.sx.bet/metadata` for address | 6        |

To convert from a nominal amount (such as 100 USDC) to the integer amount used in the API:

`apiAmount = nominalAmount * 10^decimals`

To convert back:

`nominalAmount = apiAmount / 10^decimals`

where `decimals` is specified in the above table.

***

## Odds

Odds are specified in an implied odds format like `839135214364235000`. To convert to a readable implied odds, divide by `10^20`. `839135214364235000` for example is 0.0839 or 8.39%

To convert from implied odds to decimal odds, inverse the number. For example, 0.0839 in decimal format is `1/0.0839 = 11.917`.

***

## Bookmaker odds

It's important to note how odds are displayed on sx.bet. Recall from [the order section](https://api.docs.sx.bet/#get-active-orders) that `percentageOdds` is from the perspective of the market maker. The odds that are displayed on sx.bet in the order books are what the taker will be receiving. Let's run through an example.

Suppose an order looks like the one on the right.

Here the maker is betting outcome one (`isMakerBettingOutcomeOne = true`) and receiving implied odds of `704552840724436400000 / 10^20 = 0.704552841`. Therefore the taker is betting *outcome two* and receiving implied odds of `1 - 0.704552841 = 0.295447159`. This would be displayed on sx.bet (what the user sees) under the second order book with odds of 29.5% in implied format, or `1 / 0.295447159 = 3.3847` in decimal format.
