Code Monkey home page Code Monkey logo

wagerbrain's Introduction

WagerBrain

A package containing the essential math and tools required for sports betting and gambling. Once you've scraped odds from Covers.com, Pinnacle, Betfair, or wherever, import WagerBrain and start hunting for value bets.

Image of The Big Board

Phase 1 (complete):

  • Convert Odds between American, Decimal, Fractional
  • Convert Odds to Implied Win Probabilities and back to Odds
  • Calculate Profit and Total Payouts
  • Calculate Expected Value
  • Calculate Kelly Criterion
  • Calculate Parlay Odds, Total Payout, Profit

Phase 2 (complete):

  • Evaluate Wager-Arbitrage Opportunities
  • Calculate bookmaker spread/cost
  • Calculate the Bookmaker's Vig
  • Calculate Win Probability from a team's ELO (538-style)

Phase 3 (in progress):

  • Scrapers to gather data (Basketball Reference, KenPom etc.) [Partially implemented]
  • Value Bets (take in sets of odds, probabilities and output the most effective betting implementation)
  • Scan for Arbitrage (search scrape bookmakers to feed into Phase 2's Arbitrage evaluator)

Examples

Parlay 3 wagers from different sites offering different odds-styles:

odds = [1.91, -110, '9/10']
parlay_odds(odds)
>>>> 6.92

No clue how to read decimal odds because you're American? (wager * decimals odds, though...super simple), then convert them back to American-style odds:

american_odds(6.92)
>>>> +592

What's the Vig on the Yankees vs Dodgers?

Yankees -115
Dodgers +105
Betting 115 to win 100 on Yankees
Betting 100 to win 205 on Dodgers

vig(115,215,100,205)
>>>> 2.26%

Arbitrage Example

            5Dimes	Pinnacle
Djokovic    *1.360*	1.189
Nadal	    3.170	*5.500*

odds = [1.36, 5.5]
stake = 1000
basic_arbitrage(odds, stake)

>>>> Bet $801.53 on Djokovic
>>>> Bet $198.47 on Nadal
>>>> Win $90.51 regardless of the outcome

KenPom NCAAB Scraper

ken_pom_scrape()
>>>>
        Rk                    Team  Conf  ...   OppO   OppD  NCOS AdjEM
0      1.0                  Kansas   B12  ...  107.4   94.7        9.58
1      2.0                 Gonzaga   WCC  ...  103.5  101.0       -2.09
2      3.0                  Baylor   B12  ...  106.4   96.2        1.38
3      4.0                  Dayton   A10  ...  104.1  101.3       -0.74
4      5.0                    Duke   ACC  ...  106.0   98.7        2.60
..     ...                     ...   ...  ...    ...    ...         ...
364  349.0  Maryland Eastern Shore  MEAC  ...   97.6  104.1        7.78
365  350.0                  Howard  MEAC  ...   96.7  105.0        0.96
366  351.0  Mississippi Valley St.  SWAC  ...   97.8  103.9        5.14
367  352.0            Kennesaw St.  ASun  ...  102.0  103.7        4.10
368  353.0             Chicago St.   WAC  ...  100.6  104.3       -0.75

wagerbrain's People

Contributors

sedemmler avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.