pringleman83 / sportsbook Goto Github PK
View Code? Open in Web Editor NEWA sports data scraping and analysis tool
License: GNU General Public License v3.0
A sports data scraping and analysis tool
License: GNU General Public License v3.0
When the custom pretty print function displays a list or dictionary, it only displays items up to the last multiple of 3. Anything else is omitted.
For example, there are 37 leagues to choose from, but only 36 are displayed. Some leagues have 20 teams to choose from, but only 18 are displayed.
... and, of course, importing league data doesn't import them either.
This means that imported data can't be used to run predictions. It also can't be used for any possible future uses that require fixture information or (in the more distant future) results data.
The best solution I can think of is to store the fixtures in the league_data dictionary. Maybe also store predictions in that dictionary too. It would make future analysis simpler.
Maybe there could be a menu for export type (League info only, fixtures, predictions etc...)
Please discuss...
Whens scraping multiple leagues, on occasion, two "X League download complete" updates appear on the same line.
This is related to the threading that is taking place to speed up the scraping process. The print statement that displays that message may need a lock on it.
Dropping this for the future just in case someone ever ran out of stuff to do.
Basically add a database system that'd store every data the user looked for and perhaps having a lot of games/data we could add some precision to the prediction as we'd have some trend line.
I fixed a few issues in the project including menu responses that didn't make sense, incorrect text spacing and a bit of further tidying. Unfortunately, these were lost in the last update (that'll teach me to branch!). I'm just in the process of reintroducing them.
Would be awesome to add a pipfile and a installation md.
That would ease new contributors and we can say pretty much that it's the canon for almost every open python project.
A pipfile is a file generated from 'pipenv' (a python packaging manager) it's the sum of pip and virtualvenv, using pipenv and having a pipfile, any new contributor would only need to write 1 command on their terminal to have anything they need (modules) automatically installed, all the process step by step would be written in the installation.md/howtouse.md/whatevername.md.
I could do that in no time once you approve of this.
The import json and export json functions in football.py need to be moved to the common functions file. This will involve making sure that they are properly referenced when called.
The import and export functions will also need to be ask the user for a filename to save to. For the export function (which currently accepts a filename argument), this will mean reducing the number of arguments taken and therefore altering any code that calls the function.
Any questions, comment or get in touch on Slack.
I think this would help you update code.
Master branch could stay untouched until you build up enough features, while feature branch would allow you and other people to contribute.
Cheers, sara
The current display shows wins, draws and losses per game compared on the same chart as goals for and against per game and points per game.
The problem is, the highest wins, draws and/or losses per game can only ever be 1. The highest goals for/against per game is unlimited. The highest points per game can only be 3. The three comparisons each need their own charts.
An interesting addition would be goal difference per game. However, this would also run to negative numbers on the y axis and so, again, would need another chart.
The ideal solution would either be to display multiple charts at once, or to utilise the next button that shows on the chart. However, the "next chart" option might not work in some interpreters (such as Spyder) as the charts are displayed inline. Trial and error...
LOG:
Selected league(s):
5 Spanish Primera
(1) Select another league
(2) Download upcoming fixtures*
(3) Display upcoming fixtures*
(4) Run analytics on upcoming fixtures*
(5) Display analytics in upcoming fixtures*
(6) Single game analysis from fixture list*
(7) Manual single game analysis
(8) Reports
(9) Import data from JSON file
(10) Clear currently loaded league data
(M) Previous menu
Items marked with a * are not available in this version.
7
1 Barcelona
2 Real Madrid
3 Sevilla
4 Atlético Madrid
5 Real Betis
6 Deportivo Alavés
7 Espanyol
8 Celta de Vigo
9 Getafe
10 Real Valladolid
11 Girona
12 Villarreal
13 Real Sociedad
14 Valencia
15 Athletic Club
16 Levante
17 Eibar
18 Rayo Vallecano
19 Huesca
20 Leganés
Select home team from the above list.
1
Select home team from the above list.
2
Select home team from the above list.
6
Select home team from the above list.
Am I missing something? This is not working as intended right?
Once the project gets bigger it might be interesting to make an UI for it, so it'd go from being a CLI (command line interface) app to a full featured desktop app :P!.
Hi I`m guessing this is based on home win away win and draws
So this match is a draw Chojniczanka Chojnice 2 Bytovia Bytów 2 ?
But I have seen a match e.g. stockport 5 west ham 1
as stockport as 5 what does this mean please
James
Maybe redact a TODO.md with ideas/features or open some issues about that :P ?
When the scraped website is down the project misbehaves ultimately resulting in an error. This needs a check to be implemented to see if the scraped website is available.
A new sub menu needs to be added for visual analysis options.
This needs to be added to the main football menu.
In the league selection menu (the wrong place for this option, but that's another issue), there are options to export the current leagueData dictionary to a JSON file and to import a previously exported dictionary from a JSON file.
The filename for exporting and importing is currently fixed to leagueData.
The system appears to work. When exported, the generated file appears to be accurate. When imported after the code is freshly run, I can run the display league option (also wrongly in the league selection menu) and the leagueData dictionary that has been imported from the JSON file is displayed.
However, the main football menu doesn't recognise that a league is loaded (it states "No league selected" and when I attempt to run a manual single game analysis (in the main football menu), none of the teams that should be available are listed.
I suspect the import process isn't placing some or all of the elements of the JSON file where they need to be in the dictionary.
This is a priority on my huge list of things to do.
Is it still possible to join the slack workspace? Is it still active?
The link in the README is broken.
When the Bet Study scarper is selected the benchmark method of generating predictions doesn't produce any results.
Fixtures, results and league data all appear to be scraped and accessible, so this is a mystery for now.
Set up a new prediction list standard (for storing predictions):
[["Prediction name","Game Date", "Time", "Home Team", "Home Team Score", "Away Team", "Away Team Score", "Prediction Algorithm", "Data associated with this prediction"]]
Set up a list of prediction algorithms:
["Prediction name", "Prediction algorithm"]
Ask the user what algorithm to use when running predictions:
The project is looking good bit it's getting a bit big, maybe instead of wrapping everything in functions we can start playing with some classes, that'd make the code insanely more tidy
The league selection screen needs to:
This causes an infinite loop due to input validation not being able to confirm a valid option has been selected. A simple fix that requires a quick check that a league has been selected before the option can be chosen.
The league menu needs some further options:
This will need some code implementing, probably generating a list of the selected leagues and iterating through that list, processing the league and fixture scraping function).
After selecting the option to generate predictions for current fixtues, an option needs to be introduced to display the predictions there and then.
The fixture scraping process currently scrapes the next 15 fixtures for each league. All of these fixtures are stored in the fixtures list.
As dates are also scraped, this can and should be tidied up so that fixtures within a specific date range are saved only. This should be the next 7 days by default, but the idea is open for discussion and ideas (could load all fixtures from the next three available dates).
The project is getting a bit dense, with all those .md files and what not, to make it easier I will follow common practice of putting al the code relevant files ina src
(source) folder.
The select_leagues function needs to be separated so that there is a separate function for the selection of leagues only. The new function needs an extra argument for whether multiple selection is allowed. This could be set by default to True or False.
I expect it will only be necessary for it to take the available leagues list and optional Boolean value for multi and it will return the selected league(s). The format of the returned item will need some consideration of other functions. Ideally, It'll always be a list, even if the list only contains one item. It may be necessary to edit dependant functions to make this work though.
Sometimes, scraped fixtures aren't being displayed in the correct order. This is probably due to threading the scraping process as this means that multiple threads are adding fixtures to the fixtures list at the same time. A lock currently prevents this from causing data to become corrupt, but I don't think it's enough to keep the leagues from falling out of order.
Resolution: Add post processing after each scrape to sort the fixtures into league order. This needs to be done automatically, what ever scrape system is used, before predictions are run. The code would need to be added to the scraper_function, after scraping takes place.
I found out Multiplication based on time calculation where you can win bet with stake 100 for 100k jackpot, but i cant complete on python but i did with excel, but here i need some help from you,.
im happy to share my method with you, but i dont no how to communicate with you, im in lodon, i noticed your from birmingahm, 00447309686227
give me a call, I predict 95 percentage of cricket matches, with python on excel. maths python model,00447309686227 please give me a call, if its work its jackpot,
When searching for fixtures within a specified range, the code only checks for the future date when it needs to stop looking. Eg. for fixtures over the next five days, it will gather all predictions for until 5 days from now.
In the scraping process, anything with a score is considered a result. If there is no score it is considered a fixture.
The problem is, if a game is postponed, the "P" from the score is replaced with "" and the game is being considered a fixture. As there is no filter for how far back to look when looking for fixtures, the postponed games still show in fixtures. There is some logic to this I guess, as the games still need to be played. However, if the game is refactored into the fixtures, it'll show twice.
Anyway, I need to change how this works so that postponed games are not shown in upcoming fixtures.
This menu was the only menu in the early stages of the project. However, now there are three options that need to be moved to appropriate places in the football menu. Options 97, 98 and 99 (Display league data, Import JSON and Export JSON respectively).
They would probably go into a sub menu in Reports (found in the main football menu).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.