1.1.3
Deno project to convert betting odds
Repository
Current version released
a week ago
Odds converter
A simple class and CLI tool to convert betting odds between formats.
CLI
Install
deno install -n odds https://deno.land/x/odds_converter/cli.ts
Usage
odds +750
Outputs:
.-----------------------------------------.
| Converted Odds |
|-----------------------------------------|
| Type | Value |
|--------------------------------|--------|
| US | +750 |
| Decimal | 8.5 |
| Fraction | 15/2 |
| Implied probability | 11.76% |
| | |
| Reciprocal US | -750 |
| Reciprocal Decimal | 1.13 |
| Reciprocal Fraction | 2/15 |
| Reciprocal implied probability | 88.24% |
'-----------------------------------------'
Odds class
Install
import { Odds } from "https://deno.land/x/odds_converter/odds.ts";
Usage
let odds = new Odds(1.5);
console.log(odds.decimalOdds); // 1.5
console.log(odds.usOdds); // -200
console.log(odds.usOddsString); // "-200"
console.log(odds.fractionOdds); // "1/2"
console.log(odds.impliedProbability); // 0.6666666666
console.log(odds.impliedProbabilityString); // 66.67%
odds = Odds.fromUS("+300");
console.log(odds.decimalOdds); // 4
console.log(odds.usOdds); // 300
console.log(odds.usOddsString); // "+300"
console.log(odds.fractionOdds); // "3/1"
console.log(odds.impliedProbability); // 0.25
console.log(odds.impliedProbabilityString); // "25%"
odds = Odds.fromFraction("5/4");
console.log(odds.decimalOdds); // 2.25
console.log(odds.usOdds); // 125
console.log(odds.usOddsString); // "+125"
console.log(odds.fractionOdds); // "5/4"
console.log(odds.impliedProbability); // 0.4444444444444
console.log(odds.impliedProbabilityString); // "44.44%"