degen


Namedegen JSON
Version 0.1.6 PyPI version JSON
download
home_pagehttps://github.com/jzuhusky/degen
SummaryProgramming with betting odds, made simple
upload_time2023-03-22 13:29:55
maintainer
docs_urlNone
authorJoey Zuhusky
requires_python
licenseMIT
keywords odds sportsbetting betting python betting gambling
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Degen 

### Programming with betting odds, made simple

*pronounced "dee-gen"* as in [Degenerate Gambler](https://www.urbandictionary.com/define.php?term=Degenerate%20Gambler)

![alt text](https://github.com/jzuhusky/degen/blob/master/coverage.svg?raw=true)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

## Table of Contents

1. [Installation](#installation)
2. [Getting Started](#getting-started)
3. [Examples](#examples)
4. [Developing / Contributing](#contributing--developing)


### Installation

```bash
pip install degen
```

## Getting Started

```python
from degen import AmericanOdds

odds = AmericanOdds(-110)
print(odds.value)
# >>> -110
```

### Easy conversion between odds types

There are 3 main `Odds` types provided by degen:
* `AmericanOdds` 
* `DecimalOdds`
* `ImpliedProbability` 

They all support the methods:
* `.to_american_odds()`
* `.to_decimal_odds()`
* `.to_implied_probability()`

*No more formulas*
 
## Examples
 
Example 0: simple odds objects
```python
from degen import AmericanOdds, DecimalOdds, ImpliedProbability

american_odds = AmericanOdds(-110)

decimal_odds: DecimalOdds = american_odds.to_decimal_odds()
print(decimal_odds.value)
# >>> 1.909090909090909090909090909

implied_probability: ImpliedProbability = american_odds.to_implied_probability()
print(implied_probability.value)
# >>> 0.5238095238095238095238095238
```

Example 1: Bitwise operators for simple odds computation, parlay using bitwise-and operator
```python
odds1 = AmericanOdds(-110)
odds2 = AmericanOdds(-110)

parlay_odds: AmericanOdds = odds1 & odds2
print(parlay_odds.value)
# >>> 264.4628099173553719008264463
```

Example 2: Computing *juice* or *the vig* using the bitwise-or operator
```python

juice = AmericanOdds(-110) | AmericanOdds(-110)

# Juice can't be represented by american odds, so the type of the juice 
# variable will be "ImpliedProbability" after the computation, which is still an Odds type. 
print(type(juice))
# >>> <class 'degen.odds_models.ImpliedProbability'>

# ImpliedProb > 1.0 provides a measure of "juiced" odds, or the book "vig"
print(juice.value)
# >>> 1.047619047619047619047619048

# You can ask all odds objects if they're "juiced"
print(juice.is_juiced)
# >>> True
```

# Contributing / Developing

Install requirements
```bash
pip install -r requirements-dev.txt -r requirements.txt
```

Run tox suite:

* Run black code fmt checks
* Run unittests
* Check coverage
* Generate coverage report & badge
```
tox
```

Test coverage has a floor of 95% - this will block a PR from getting approval if this threshold isn't met. 

## Todo

Contributions from other developers are always welcome, here are some things that need to be implemented:

* Fractional Odds
* Hong Odds 

### Notes

 * Everythign done with Decimals for numerical precision
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/jzuhusky/degen",
    "name": "degen",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "jzuhusky@gmail.com",
    "keywords": "odds sportsbetting betting python betting gambling",
    "author": "Joey Zuhusky",
    "author_email": "jzuhusky@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/42/e6/e10b7a3381e572715bf639163fd371fed5c4908e65e83dd551f96742f6d2/degen-0.1.6.tar.gz",
    "platform": null,
    "description": "# Degen \n\n### Programming with betting odds, made simple\n\n*pronounced \"dee-gen\"* as in [Degenerate Gambler](https://www.urbandictionary.com/define.php?term=Degenerate%20Gambler)\n\n![alt text](https://github.com/jzuhusky/degen/blob/master/coverage.svg?raw=true)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Getting Started](#getting-started)\n3. [Examples](#examples)\n4. [Developing / Contributing](#contributing--developing)\n\n\n### Installation\n\n```bash\npip install degen\n```\n\n## Getting Started\n\n```python\nfrom degen import AmericanOdds\n\nodds = AmericanOdds(-110)\nprint(odds.value)\n# >>> -110\n```\n\n### Easy conversion between odds types\n\nThere are 3 main `Odds` types provided by degen:\n* `AmericanOdds` \n* `DecimalOdds`\n* `ImpliedProbability` \n\nThey all support the methods:\n* `.to_american_odds()`\n* `.to_decimal_odds()`\n* `.to_implied_probability()`\n\n*No more formulas*\n \n## Examples\n \nExample 0: simple odds objects\n```python\nfrom degen import AmericanOdds, DecimalOdds, ImpliedProbability\n\namerican_odds = AmericanOdds(-110)\n\ndecimal_odds: DecimalOdds = american_odds.to_decimal_odds()\nprint(decimal_odds.value)\n# >>> 1.909090909090909090909090909\n\nimplied_probability: ImpliedProbability = american_odds.to_implied_probability()\nprint(implied_probability.value)\n# >>> 0.5238095238095238095238095238\n```\n\nExample 1: Bitwise operators for simple odds computation, parlay using bitwise-and operator\n```python\nodds1 = AmericanOdds(-110)\nodds2 = AmericanOdds(-110)\n\nparlay_odds: AmericanOdds = odds1 & odds2\nprint(parlay_odds.value)\n# >>> 264.4628099173553719008264463\n```\n\nExample 2: Computing *juice* or *the vig* using the bitwise-or operator\n```python\n\njuice = AmericanOdds(-110) | AmericanOdds(-110)\n\n# Juice can't be represented by american odds, so the type of the juice \n# variable will be \"ImpliedProbability\" after the computation, which is still an Odds type. \nprint(type(juice))\n# >>> <class 'degen.odds_models.ImpliedProbability'>\n\n# ImpliedProb > 1.0 provides a measure of \"juiced\" odds, or the book \"vig\"\nprint(juice.value)\n# >>> 1.047619047619047619047619048\n\n# You can ask all odds objects if they're \"juiced\"\nprint(juice.is_juiced)\n# >>> True\n```\n\n# Contributing / Developing\n\nInstall requirements\n```bash\npip install -r requirements-dev.txt -r requirements.txt\n```\n\nRun tox suite:\n\n* Run black code fmt checks\n* Run unittests\n* Check coverage\n* Generate coverage report & badge\n```\ntox\n```\n\nTest coverage has a floor of 95% - this will block a PR from getting approval if this threshold isn't met. \n\n## Todo\n\nContributions from other developers are always welcome, here are some things that need to be implemented:\n\n* Fractional Odds\n* Hong Odds \n\n### Notes\n\n * Everythign done with Decimals for numerical precision",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Programming with betting odds, made simple",
    "version": "0.1.6",
    "split_keywords": [
        "odds",
        "sportsbetting",
        "betting",
        "python",
        "betting",
        "gambling"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "42e6e10b7a3381e572715bf639163fd371fed5c4908e65e83dd551f96742f6d2",
                "md5": "13f85cb6d0062d68d699f2c7d31f298d",
                "sha256": "10ced4b48c31f17142e3789f5961982d84589045f9a5880e8fcfad77f78ed888"
            },
            "downloads": -1,
            "filename": "degen-0.1.6.tar.gz",
            "has_sig": false,
            "md5_digest": "13f85cb6d0062d68d699f2c7d31f298d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5309,
            "upload_time": "2023-03-22T13:29:55",
            "upload_time_iso_8601": "2023-03-22T13:29:55.069655Z",
            "url": "https://files.pythonhosted.org/packages/42/e6/e10b7a3381e572715bf639163fd371fed5c4908e65e83dd551f96742f6d2/degen-0.1.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-22 13:29:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "jzuhusky",
    "github_project": "degen",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "tox": true,
    "lcname": "degen"
}
        
Elapsed time: 0.05209s