Compare commits
13
Commits
main
..
d26a0970b8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d26a0970b8 | ||
|
|
ec34469663 | ||
|
|
46a7f09488 | ||
|
|
66d0ba5b72 | ||
|
|
484983c554 | ||
|
|
e15eff3bc1 | ||
|
|
2ffee3f4c1 | ||
|
|
83700a4d4d | ||
|
|
8e35d88d75 | ||
|
|
976f90a42c | ||
|
|
8e20f1d7aa | ||
|
|
c559a947fb | ||
|
|
8cde725967 |
@@ -9,7 +9,7 @@ Previously there were records dating back to 1992 that were removed by the websi
|
|||||||
I am welcoming anyone who wants to to port it to their own state/country to do so. I currently have a website www.wvlotterypredictor.xyz hosting my numbers to be refreshed daily. Collaboration and suggestion to a more accurate algorithm is also welcome. I can be contacted about the project through my site email, on here, or on the Twitter linked on my site.
|
I am welcoming anyone who wants to to port it to their own state/country to do so. I currently have a website www.wvlotterypredictor.xyz hosting my numbers to be refreshed daily. Collaboration and suggestion to a more accurate algorithm is also welcome. I can be contacted about the project through my site email, on here, or on the Twitter linked on my site.
|
||||||
|
|
||||||
# How the site works
|
# How the site works
|
||||||
- Each game has its own script. It pulls every past draw from the WV Lottery results api (the same one wvlottery.com uses for its past draws page), adds the older records from the excel files where there are any, and counts how often each number has been drawn. The chance shown is the actual odds of that ticket hitting, every ticket has the same odds so the forecast is just going with the numbers that have been called the most.
|
- Each game has its own script. It pulls every past draw from the WV Lottery results api (the same one wvlottery.com uses for its past draws page), adds the older records from the excel files where there are any, and counts how often each number has been drawn.
|
||||||
- On the site the scripts write their numbers to a csv instead of printing them. cron runs each one about 45 minutes after that game's drawing so the new numbers are already posted.
|
- On the site the scripts write their numbers to a csv instead of printing them. cron runs each one about 45 minutes after that game's drawing so the new numbers are already posted.
|
||||||
- The site itself is Django served by gunicorn behind nginx. It reads the csv files for the home page and caches the page in redis, which gets cleared every hour.
|
- The site itself is Django served by gunicorn behind nginx. It reads the csv files for the home page and caches the page in redis, which gets cleared every hour.
|
||||||
|
|
||||||
@@ -17,5 +17,10 @@ I am welcoming anyone who wants to to port it to their own state/country to do s
|
|||||||
|
|
||||||
# CHANGELOG
|
# CHANGELOG
|
||||||
- September 26th 2026: wvlottery.com was rebuilt and the old history tables are gone, so every script now pulls past draws from the json results api the new site uses. Added Cash Pop. Updated Mega Millions odds for the 2025 changes.
|
- September 26th 2026: wvlottery.com was rebuilt and the old history tables are gone, so every script now pulls past draws from the json results api the new site uses. Added Cash Pop. Updated Mega Millions odds for the 2025 changes.
|
||||||
- September 26th 2026 (later): The excel records were never actually getting counted (they use - and the site used –), they are now. Numbers that cant be drawn anymore since the ball ranges changed get skipped. Chance is now the real odds of the forecast ticket winning instead of the frequency number, Daily3 and Daily4 are the odds for a box play.
|
|
||||||
- June 29th 2022: Added support for old data that was previously scrubbed from the lottery site. It is more accurate and includes more data than the previous one. Chance for daily3 is now bugged however due to the large amount of numbers and dates. This will be fixed soon.
|
- June 29th 2022: Added support for old data that was previously scrubbed from the lottery site. It is more accurate and includes more data than the previous one. Chance for daily3 is now bugged however due to the large amount of numbers and dates. This will be fixed soon.
|
||||||
|
|
||||||
|
# TODO:
|
||||||
|
- Correct chance numbers for Daily3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
# WVLottopy: Matteo DiBiagio
|
# WVLottopy: Matteo DiBiagio
|
||||||
from fractions import Fraction as frac
|
from fractions import Fraction as frac
|
||||||
from math import comb
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import requests
|
import requests
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
@@ -39,15 +38,11 @@ def get_data():
|
|||||||
date, nums = get_data()
|
date, nums = get_data()
|
||||||
|
|
||||||
# Formatting
|
# Formatting
|
||||||
# Site numbers come split by – and the excel records by - so it splits on both
|
|
||||||
hyphenfree = []
|
hyphenfree = []
|
||||||
for x in nums:
|
for x in nums:
|
||||||
hyphenfree.append(x.replace('–',', ').replace('-',', '))
|
hyphenfree.append(x.replace('–',', '))
|
||||||
splitlist = ", ".join(hyphenfree)
|
splitlist = ", ".join(hyphenfree)
|
||||||
sep = splitlist.split(", ")
|
sep = splitlist.split(", ")
|
||||||
# Only count numbers that can still be called, the ball ranges have changed over the years
|
|
||||||
# so the old records have some numbers that dont exist in the game anymore
|
|
||||||
sep = [x for x in sep if x.isdigit() and 1 <= int(x) <= 25]
|
|
||||||
|
|
||||||
for n in range(0, 25):
|
for n in range(0, 25):
|
||||||
most_common= Counter(sep).most_common(6)
|
most_common= Counter(sep).most_common(6)
|
||||||
@@ -55,9 +50,8 @@ for n in range(0, 25):
|
|||||||
frequency = [v[-1] for v in most_common]
|
frequency = [v[-1] for v in most_common]
|
||||||
|
|
||||||
sorted_nums = sorted(likely_nums, key=lambda x: (len(x), x))
|
sorted_nums = sorted(likely_nums, key=lambda x: (len(x), x))
|
||||||
# Chance = 1 / every possible ticket, 25 choose 6 = 177100
|
total_freq = sum(frequency)
|
||||||
# every ticket has the same odds, the forecast just goes with the numbers that get called the most
|
Chance = frac(total_freq, 177100) # Chance = number call freq / all possible numbers i.e. 177100
|
||||||
Chance = frac(1, comb(25, 6))
|
|
||||||
Forecast = str(" - ".join(sorted_nums))
|
Forecast = str(" - ".join(sorted_nums))
|
||||||
|
|
||||||
print(f"Likely numbers are . . . {Forecast} \n"
|
print(f"Likely numbers are . . . {Forecast} \n"
|
||||||
|
|||||||
@@ -34,8 +34,6 @@ for x in nums:
|
|||||||
hyphenfree.append(x.replace('–',', '))
|
hyphenfree.append(x.replace('–',', '))
|
||||||
splitlist = ", ".join(hyphenfree)
|
splitlist = ", ".join(hyphenfree)
|
||||||
sep = splitlist.split(", ")
|
sep = splitlist.split(", ")
|
||||||
# Only keep 1 - 15, just in case anything weird comes back from the site
|
|
||||||
sep = [x for x in sep if x.isdigit() and 1 <= int(x) <= 15]
|
|
||||||
|
|
||||||
for n in range(0, 15):
|
for n in range(0, 15):
|
||||||
most_common= Counter(sep).most_common(3)
|
most_common= Counter(sep).most_common(3)
|
||||||
|
|||||||
@@ -6,10 +6,6 @@ from collections import Counter
|
|||||||
|
|
||||||
|
|
||||||
def get_data():
|
def get_data():
|
||||||
# Old records from the excel sheets, wvlottery.com took these down but they go back to the early 90s on some games
|
|
||||||
df_old = pd.read_excel('./excel_lotto_records/daily3.xlsx')
|
|
||||||
salvaged = df_old[['Date', 'Numbers']]
|
|
||||||
|
|
||||||
url = 'https://gateway.loyalty.wvlottery.com/services/jackpot/api/v1/jackpot-results?gameId=9&jackpotStatus=PAYABLE&size=500&sort=externalId,drawDate,desc&page='
|
url = 'https://gateway.loyalty.wvlottery.com/services/jackpot/api/v1/jackpot-results?gameId=9&jackpotStatus=PAYABLE&size=500&sort=externalId,drawDate,desc&page='
|
||||||
header = {
|
header = {
|
||||||
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.75 Safari/537.36",
|
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.75 Safari/537.36",
|
||||||
@@ -29,7 +25,7 @@ def get_data():
|
|||||||
dfs = [pd.DataFrame(web)]
|
dfs = [pd.DataFrame(web)]
|
||||||
pd.set_option('display.max_rows', None)
|
pd.set_option('display.max_rows', None)
|
||||||
# Specifies no max rows, otherwise only shows 10 records
|
# Specifies no max rows, otherwise only shows 10 records
|
||||||
df = pd.concat([dfs[0], salvaged], ignore_index=True)
|
df = dfs[0]
|
||||||
df2 = df[['Date', 'Numbers']]
|
df2 = df[['Date', 'Numbers']]
|
||||||
date = list(df2['Date'])
|
date = list(df2['Date'])
|
||||||
nums = list(df2['Numbers'].astype('str'))
|
nums = list(df2['Numbers'].astype('str'))
|
||||||
@@ -38,14 +34,11 @@ def get_data():
|
|||||||
date, nums = get_data()
|
date, nums = get_data()
|
||||||
|
|
||||||
# Formatting
|
# Formatting
|
||||||
# Site numbers come split by – and the excel records by - so it splits on both
|
|
||||||
hyphenfree = []
|
hyphenfree = []
|
||||||
for x in nums:
|
for x in nums:
|
||||||
hyphenfree.append(x.replace('–',', ').replace('-',', '))
|
hyphenfree.append(x.replace('–',', '))
|
||||||
splitlist = ", ".join(hyphenfree)
|
splitlist = ", ".join(hyphenfree)
|
||||||
sep = splitlist.split(", ")
|
sep = splitlist.split(", ")
|
||||||
# Only keep actual digits, gets rid of any blanks from the excel records
|
|
||||||
sep = [x for x in sep if x.isdigit() and int(x) <= 9]
|
|
||||||
|
|
||||||
for n in range(0, 10):
|
for n in range(0, 10):
|
||||||
most_common= Counter(sep).most_common(3)
|
most_common= Counter(sep).most_common(3)
|
||||||
@@ -53,10 +46,10 @@ for n in range(0, 10):
|
|||||||
frequency = [v[-1] for v in most_common]
|
frequency = [v[-1] for v in most_common]
|
||||||
|
|
||||||
sorted_nums = sorted(likely_nums, key=lambda x: (len(x), x))
|
sorted_nums = sorted(likely_nums, key=lambda x: (len(x), x))
|
||||||
# Chance = playing the forecast as a box (any order), 3 different digits can come up 6 ways out of 1000 = 3/500
|
total_freq = sum(frequency)
|
||||||
# playing it straight (exact order) is 1/1000
|
Chance = frac(total_freq, 15000) # Chance = number call freq / all possible numbers i.e. 1000
|
||||||
Chance = frac(6, 1000)
|
|
||||||
Forecast = str(" - ".join(sorted_nums))
|
Forecast = str(" - ".join(sorted_nums))
|
||||||
|
|
||||||
print(f"Likely numbers are . . . {Forecast} \n"
|
print(f"Likely numbers are . . . {Forecast} \n"
|
||||||
f"With percent chance of winning being {Chance}")
|
f"With percent chance of winning being {Chance} \n"
|
||||||
|
f"DISCLAIMER: This set's chance is innacurate due to how many numbers are drawn per day.")
|
||||||
@@ -38,14 +38,11 @@ def get_data():
|
|||||||
date, nums = get_data()
|
date, nums = get_data()
|
||||||
|
|
||||||
# Formatting
|
# Formatting
|
||||||
# Site numbers come split by – and the excel records by - so it splits on both
|
|
||||||
hyphenfree = []
|
hyphenfree = []
|
||||||
for x in nums:
|
for x in nums:
|
||||||
hyphenfree.append(x.replace('–',', ').replace('-',', '))
|
hyphenfree.append(x.replace('–',', '))
|
||||||
splitlist = ", ".join(hyphenfree)
|
splitlist = ", ".join(hyphenfree)
|
||||||
sep = splitlist.split(", ")
|
sep = splitlist.split(", ")
|
||||||
# Only keep actual digits, gets rid of any blanks from the excel records
|
|
||||||
sep = [x for x in sep if x.isdigit() and int(x) <= 9]
|
|
||||||
|
|
||||||
for n in range(0, 9):
|
for n in range(0, 9):
|
||||||
most_common= Counter(sep).most_common(4)
|
most_common= Counter(sep).most_common(4)
|
||||||
@@ -53,9 +50,8 @@ for n in range(0, 9):
|
|||||||
frequency = [v[-1] for v in most_common]
|
frequency = [v[-1] for v in most_common]
|
||||||
|
|
||||||
sorted_nums = sorted(likely_nums, key=lambda x: (len(x), x))
|
sorted_nums = sorted(likely_nums, key=lambda x: (len(x), x))
|
||||||
# Chance = playing the forecast as a box (any order), 4 different digits can come up 24 ways out of 10000 = 3/1250
|
total_freq = sum(frequency)
|
||||||
# playing it straight (exact order) is 1/10000
|
Chance = frac(total_freq, 10000) # Chance = number call freq / all possible numbers i.e. 10000
|
||||||
Chance = frac(24, 10000)
|
|
||||||
Forecast = str(" - ".join(sorted_nums))
|
Forecast = str(" - ".join(sorted_nums))
|
||||||
|
|
||||||
print(f"Likely numbers are . . . {Forecast} \n"
|
print(f"Likely numbers are . . . {Forecast} \n"
|
||||||
|
|||||||
+3
-11
@@ -1,13 +1,11 @@
|
|||||||
# WVLottopy: Matteo DiBiagio
|
# WVLottopy: Matteo DiBiagio
|
||||||
from fractions import Fraction as frac
|
from fractions import Fraction as frac
|
||||||
from math import comb
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import requests
|
import requests
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
|
|
||||||
|
|
||||||
def get_data():
|
def get_data():
|
||||||
# Old records from the excel sheets, wvlottery.com took these down but they go back to the early 90s on some games
|
|
||||||
df_old = pd.read_excel('./excel_lotto_records/lotto_america.xlsx')
|
df_old = pd.read_excel('./excel_lotto_records/lotto_america.xlsx')
|
||||||
salvaged = df_old[['Date', 'Numbers', 'SB']]
|
salvaged = df_old[['Date', 'Numbers', 'SB']]
|
||||||
|
|
||||||
@@ -41,16 +39,11 @@ def get_data():
|
|||||||
date, nums, SBs = get_data()
|
date, nums, SBs = get_data()
|
||||||
|
|
||||||
# Formatting
|
# Formatting
|
||||||
# Site numbers come split by – and the excel records by - so it splits on both
|
|
||||||
hyphenfree = []
|
hyphenfree = []
|
||||||
for x in nums:
|
for x in nums:
|
||||||
hyphenfree.append(x.replace('–',', ').replace('-',', '))
|
hyphenfree.append(x.replace('–',', '))
|
||||||
splitlist = ", ".join(hyphenfree)
|
splitlist = ", ".join(hyphenfree)
|
||||||
sep = splitlist.split(", ")
|
sep = splitlist.split(", ")
|
||||||
# Only count numbers that can still be called, the ball ranges have changed over the years
|
|
||||||
# so the old records have some numbers that dont exist in the game anymore
|
|
||||||
sep = [x for x in sep if x.isdigit() and 1 <= int(x) <= 52]
|
|
||||||
SBs = [x for x in SBs if 1 <= x <= 10]
|
|
||||||
|
|
||||||
for n in range(0, 52):
|
for n in range(0, 52):
|
||||||
most_common= Counter(sep).most_common(5)
|
most_common= Counter(sep).most_common(5)
|
||||||
@@ -63,9 +56,8 @@ for n in range(0, 10):
|
|||||||
frequency_sb = [v[-1] for v in most_common_sb]
|
frequency_sb = [v[-1] for v in most_common_sb]
|
||||||
|
|
||||||
sorted_nums = sorted(likely_nums, key=lambda x: (len(x), x))
|
sorted_nums = sorted(likely_nums, key=lambda x: (len(x), x))
|
||||||
# Chance = 1 / every possible ticket, 52 choose 5 white balls times 10 star balls = 25989600
|
total_freq = sum(frequency + frequency_sb)
|
||||||
# every ticket has the same odds, the forecast just goes with the numbers that get called the most
|
Chance = frac(total_freq, 25989600) # Chance = number call freq / all possible numbers i.e. 25,989,600
|
||||||
Chance = frac(1, comb(52, 5) * 10)
|
|
||||||
Forecast = str(" - ".join(sorted_nums))
|
Forecast = str(" - ".join(sorted_nums))
|
||||||
|
|
||||||
print(f"Likely numbers are . . . {Forecast} SB: {SB}\n"
|
print(f"Likely numbers are . . . {Forecast} SB: {SB}\n"
|
||||||
|
|||||||
+3
-10
@@ -1,6 +1,5 @@
|
|||||||
# WVLottopy: Matteo DiBiagio
|
# WVLottopy: Matteo DiBiagio
|
||||||
from fractions import Fraction as frac
|
from fractions import Fraction as frac
|
||||||
from math import comb
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import requests
|
import requests
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
@@ -42,16 +41,11 @@ def get_data():
|
|||||||
date, nums, PBs = get_data()
|
date, nums, PBs = get_data()
|
||||||
|
|
||||||
# Formatting
|
# Formatting
|
||||||
# Site numbers come split by – and the excel records by - so it splits on both
|
|
||||||
hyphenfree = []
|
hyphenfree = []
|
||||||
for x in nums:
|
for x in nums:
|
||||||
hyphenfree.append(x.replace('–',', ').replace('-',', '))
|
hyphenfree.append(x.replace('–',', '))
|
||||||
splitlist = ", ".join(hyphenfree)
|
splitlist = ", ".join(hyphenfree)
|
||||||
sep = splitlist.split(", ")
|
sep = splitlist.split(", ")
|
||||||
# Only count numbers that can still be called, the ball ranges have changed over the years
|
|
||||||
# so the old records have some numbers that dont exist in the game anymore
|
|
||||||
sep = [x for x in sep if x.isdigit() and 1 <= int(x) <= 69]
|
|
||||||
PBs = [x for x in PBs if 1 <= x <= 26]
|
|
||||||
|
|
||||||
for n in range(0, 69):
|
for n in range(0, 69):
|
||||||
most_common = Counter(sep).most_common(5)
|
most_common = Counter(sep).most_common(5)
|
||||||
@@ -64,9 +58,8 @@ for n in range(0, 26):
|
|||||||
frequency_pb = [v[-1] for v in most_common_pb]
|
frequency_pb = [v[-1] for v in most_common_pb]
|
||||||
|
|
||||||
sorted_nums = sorted(likely_nums, key=lambda x: (len(x), x))
|
sorted_nums = sorted(likely_nums, key=lambda x: (len(x), x))
|
||||||
# Chance = 1 / every possible ticket, 69 choose 5 white balls times 26 powerballs = 292201338
|
total_freq = sum(frequency + frequency_pb)
|
||||||
# every ticket has the same odds, the forecast just goes with the numbers that get called the most
|
Chance = frac(total_freq, 292201338) # Chance = number call freq / all possible numbers i.e. 292201338
|
||||||
Chance = frac(1, comb(69, 5) * 26)
|
|
||||||
Forecast = str(" - ".join(sorted_nums))
|
Forecast = str(" - ".join(sorted_nums))
|
||||||
|
|
||||||
print(f"Likely numbers are . . . {Forecast} PB: {PB}\n"
|
print(f"Likely numbers are . . . {Forecast} PB: {PB}\n"
|
||||||
|
|||||||
+3
-10
@@ -1,6 +1,5 @@
|
|||||||
# WVLottopy megamil: Matteo DiBiagio
|
# WVLottopy megamil: Matteo DiBiagio
|
||||||
from fractions import Fraction as frac
|
from fractions import Fraction as frac
|
||||||
from math import comb
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import requests
|
import requests
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
@@ -41,16 +40,11 @@ def get_data():
|
|||||||
date, nums, MBs = get_data()
|
date, nums, MBs = get_data()
|
||||||
|
|
||||||
# Formatting
|
# Formatting
|
||||||
# Site numbers come split by – and the excel records by - so it splits on both
|
|
||||||
hyphenfree = []
|
hyphenfree = []
|
||||||
for x in nums:
|
for x in nums:
|
||||||
hyphenfree.append(x.replace('–',', ').replace('-',', '))
|
hyphenfree.append(x.replace('–',', '))
|
||||||
splitlist = ", ".join(hyphenfree)
|
splitlist = ", ".join(hyphenfree)
|
||||||
sep = splitlist.split(", ")
|
sep = splitlist.split(", ")
|
||||||
# Only count numbers that can still be called, the ball ranges have changed over the years
|
|
||||||
# so the old records have some numbers that dont exist in the game anymore
|
|
||||||
sep = [x for x in sep if x.isdigit() and 1 <= int(x) <= 70]
|
|
||||||
MBs = [x for x in MBs if 1 <= x <= 24]
|
|
||||||
|
|
||||||
for n in range(0, 70):
|
for n in range(0, 70):
|
||||||
most_common= Counter(sep).most_common(5)
|
most_common= Counter(sep).most_common(5)
|
||||||
@@ -63,9 +57,8 @@ for n in range(0, 25):
|
|||||||
frequency_mb = [v[-1] for v in most_common_mb]
|
frequency_mb = [v[-1] for v in most_common_mb]
|
||||||
|
|
||||||
sorted_nums = sorted(likely_nums, key=lambda x: (len(x), x))
|
sorted_nums = sorted(likely_nums, key=lambda x: (len(x), x))
|
||||||
# Chance = 1 / every possible ticket, 70 choose 5 white balls times 24 mega balls = 290472336
|
total_freq = sum(frequency + frequency_mb)
|
||||||
# every ticket has the same odds, the forecast just goes with the numbers that get called the most
|
Chance = frac(total_freq, 290472336) # Chance = number call freq / all possible numbers i.e. 290472336
|
||||||
Chance = frac(1, comb(70, 5) * 24)
|
|
||||||
Forecast = str(" - ".join(sorted_nums))
|
Forecast = str(" - ".join(sorted_nums))
|
||||||
|
|
||||||
print(f"Likely numbers are . . . {Forecast} MB: {MB}\n"
|
print(f"Likely numbers are . . . {Forecast} MB: {MB}\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user