npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@rich-apis/polymarket-odds

v1.0.1

Published

Convert Polymarket probabilities to decimal, fractional, and American odds formats

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-odds

Usage

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.6

API

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