@rich-apis/polymarket-odds
v1.0.1
Published
Convert Polymarket probabilities to decimal, fractional, and American odds formats
Maintainers
Readme
@rich-apis/polymarket-odds
Convert Polymarket probabilities to decimal, fractional, and American odds formats. Zero dependencies, pure JavaScript.
Part of the PolySignals toolkit for Polymarket analytics. See also: @rich-apis/polymarket-sdk
Install
npm install @rich-apis/polymarket-oddsUsage
const odds = require('@rich-apis/polymarket-odds');
// Polymarket shows "Yes" at 65% probability
const result = odds.convert(0.65);
console.log(result);
// {
// decimal: 1.5385,
// fractional: "7/13",
// american: -186,
// impliedProbability: 0.65
// }
// Individual conversions
odds.toDecimal(0.65); // 1.5385
odds.toFractional(0.65); // "7/13"
odds.toAmerican(0.65); // -186
// Convert back to probability
odds.fromDecimal(2.0); // 0.5
odds.fromAmerican(-150); // 0.6API
convert(probability) → { decimal, fractional, american, impliedProbability }
All-in-one conversion. Takes a probability between 0 (exclusive) and 1 (inclusive).
toDecimal(probability) → number
Returns decimal odds (e.g. 1.5385). Standard in Europe and exchanges.
toFractional(probability) → string
Returns fractional odds as a string (e.g. "3/2"). Standard in the UK.
toAmerican(probability) → number
Returns American/moneyline odds (e.g. -186 or +233). Standard in the US.
- Negative = favourite (bet that much to win $100)
- Positive = underdog (win that much on a $100 bet)
fromDecimal(decimalOdds) → number
Convert decimal odds back to implied probability.
fromAmerican(americanOdds) → number
Convert American odds back to implied probability.
Why?
Polymarket displays probabilities as percentages (e.g. 65%), but many traders think in odds formats they already know from sports betting. This tiny utility bridges that gap.
Related
- PolySignals Whale Bot - Real-time Polymarket whale movement alerts
@rich-apis/polymarket-sdk- Full Polymarket API client (coming soon)
License
MIT
