papagorgio23 / bettoR

R Package for Sports betting
https://papagorgio23.github.io/bettoR/
Other
64 stars 8 forks source link

Create function to calculate CLV for spreads and totals #8

Open aqsmith08 opened 3 years ago

aqsmith08 commented 3 years ago

I see that you have a clv_calc function which calculates closing line value for a moneyline bet. Would it be possible to create a function to calculate clv for spreads and totals?

Example

Let's use the Pacific vs. Loyola Marymount Men's College Basketball game on Jan 16, 2021 as an example. My bet was Pacific -1 (-108). My current process to calculate CLV manually is this (and boy is it slow/painful):

  1. Looks up the spread closing odds for Pinnacle using SportsBookReview. There I see the closing odds as Pacific -1.5 (-118) and Loyola +1.5 (+101).
  2. I make sure the League is NCAAB, the Bet Type is Spread and the Odds Type is US. Then, I enter 1.5 into Spread, -118 into Fave Price and +101 into Dog Price using the SBR Half Point Calculator.
  3. I see that Pacific -1 corresponds to -127.7 so I round it to -128 and enter it into my spreadsheet for the Closing Line Odds.
  4. I calculate (using spreadsheet formulas) the implied probability of both -108 (51.9%) and -128 (55.9%).
  5. Finally, I calculate the CLV with (55.9% - 51.9%) / 51.9% which returns 7.8% CLV.

Possible Solution

This feels like a great opportunity for someone to calculate push probabilities and have this be incorporated into the package. I found this article helpful. If we have the push probabilities already calculated, then we could have a function like:

calculate_spread_clv <- function(my.bet.spread = NA, my.bet.price = NA, closing.spread.num = NA, fave.price = NA, dog.price = NA) {
  etc
}

When this function is called, it would return the CLV. In the example provided above, it'd return 7.8% (assuming my math is correct).

papagorgio23 commented 3 years ago

I love your thinking here! I have a list of ideas and calculating CLV for spread and total bets was definitely on the TODO list.

I like how you structured a possible solution. I've talked to quite a few bettors and there are some slight differences of opinions on CLV calculations but my ultimate goal is to automate the majority of the manual work that you and most everyone else goes though when trying to track CLV. I think this is a very doable function to add to the package and I will try to add in a little flexibility to account for the differences I've seen for accounting for the worth of points for spread and total CLV.

Now that football season is dying down, I'm hoping to have more free time to dedicate to this package. I hope you're enjoying it so far and please continue to suggest new ideas because I'm open to anything. Thanks!

aqsmith08 commented 3 years ago

Love it. Thanks! If I can help you, let me know.

Cwadmail commented 2 years ago

Awesome idea! Such a hassle to do this calc by hand, especially for spreads and totals. @papagorgio23 have you been able to come up with something for this?

aqsmith08 commented 2 years ago

Thanks for pinging this thread, @Cwadmail. Now that NCAAB is almost here, I'll be doing this manually again.

@papagorgio23, you alluded to CLV being calculated differently by folks. Is the way I describe standard or the exception? I'd be willing to take a pass on this function but I'd want direction on how to calculate CLV, especially if the way I calculate it in the example isn't standard.

papagorgio23 commented 2 years ago

I'm sorry I still haven't gotten around to this...Life has been nonstop for the last year+... But @aqsmith08 you are more than welcome to try it out! Your solution is solid and pretty standard (I've seen slight variations but this is more common). I know getting this into the package would be way helpful.

Create a branch and add it in. If you need help with anything just ping me.