Simple football prediction API
Project description
smartbetsAPI
"Punter's choice"
Worldwide soccer-matches predictor with a dedicated standalone Flask server as an endpoint and a package for intergrating the scripts in your own Python code.
Features
-
REST-API
-
Script intergration (package)
-
Non-AI
Installation and usage
Installation
- Linux
Python 3.7+ is required for this script to be fruitful to you.
- Installing through pip is always the most preferred way:
$ pip install smartbetsAPI
- For those who like enjoying the latest releases from Github like me, rather than waiting for the next release:
$ pip install git+https://github.com/Simatwa/smartbetsAPI.git
- The hard-core guys with trust issues are very much sorted this way:
$ git clone https://github.com/Simatwa/smartbetsAPI.git
$ cd smartbetsAPI
$ bash install.sh
#or
$ sudo bash install.sh
Usage
- Terminal
Running $ smartbetsAPI <api-password>
will fire up the Flask server with the following default configurations.
Command | Default |
---|---|
Port | 8000 |
Username | API |
Filename | None |
level (Logging) | 20 |
host | False |
debug | False |
no-net | False |
log | False |
colorize | False |
gui (Termux) | False |
- For instance :
$ smartbetsAPI mypass9876
Here is an example of a simple program that makes prediction using the api
.
Note
-
Content-Type of the response (predictions) is
application/json
-
Reinstall with
sudo
privileges ifsmartbetsAPI
command can't be found.
- For more information you can run
smartbetsAPI -h
- Importing Package
Module predictor
provides two ways of interacting with it at the programming level, based on the data-type
in which the teams have been packed and parsed to it:
- Using
predictorL
object which accepts teams (List data-type).
For example:
#!/usr/bin/env python3
from smartbets_API.predictor import predictor
teams = [
"Napoli", # Home team (index [0])
"AC Milan", # Away team (index [1])
]
# Instantiating predictor
predict = predictor()
# Using predictorL object to handle teams (List data-type)
predictions = predict.predictorL(teams)
# Display info
print(predictions)
#Output
#{'g': 8.0, 'gg': 65.0, 'ov15': 70.0, 'ov25': 40.0, 'ov35': 30.0, 'choice': 60.0, 'result': '2', 'pick': 'ov15'}
- Using
predictorD
object which takes teams (Dictionary data-type):
For example:
#!/usr/bin/env python3
from smartbets_API.predictor import predictor
teams = {
1: "Manchester City", # 1 for home-team
2: "Liverpool", # 2 for away-team
}
# Instantiating predictor
predict = predictor()
# Using predictorD object to handle teams (Dictionary data-type)
predictions = predict.predictorD(teams)
# Display info
print(predictions)
#Output
#{'g': 8.0, 'gg': 65.0, 'ov15': 60.0, 'ov25': 45.0, 'ov35': 30.0, 'choice': 56.16, 'result': '1', 'pick': 'gg'}
- The output initials are explained in the table below.
Parameter | Function |
---|---|
g | Goal-average of the two teams |
gg | Probability of both teams to score |
ov15 | Probability of having more than 2 goals |
ov25 | Probability of having more than 3 goals |
ov35 | Probability of having more than 4 goals |
choice | Probability of the specified 'result' to occur |
result | The most suitable outcome from [1,1x,x,2x,2] |
pick | The most suitable outcome from [1,1x,x,2x,2,gg,ov15,ov25,ov35] |
Note
- Probabilities are in percentange (%)
Further info
The predictor
class accepts multiple parameters that includes :
Parameter | Function | Default |
---|---|---|
include_position | Include team's league ranking in making predictions | False |
log | Log at api default log's path | False |
level | Logging level | 0 |
filename | Log to the filename specified | None |
color | Colorize the logs | False |
gui | Run with some Graphical interface notifications (Termux) | False |
api | Run with api-server's configurations | False |
The two predictor's object (predictorD
, predictorL
) accepts two parameters i.e.
-
teams - Required
-
net - Source of team's data - Default
True
(Online)
Source of data
Team performances are sourced from Soccerway after retrieving the uri from Google.
Warning Copyright related issues are liable to the user of this script!
Disclaimer
This project aims to help punters and bookmarkers to make informed and well researched soccer-predictions. Nevertheless, it is important to specify that 100% accuracy does not exist and smartbetsAPI can't guarantee the accuracy of the predictions. It is therefore your responsibility to trust the information generated by smartbetsAPI after evaluating its reliability. As the creator, I CANNOT be held responsible for any loss of capital that may occur during the use of this program.
Contributing and Support
Contributing
Contributions are always welcome!
Please take a look at the Contribution guidelines.
Feel free to open an Issue or to Fork this repo.
ToDo
-
Upgrade to Machine learning
-
Improve algorithim's accuracy
-
General code improvements
-
Fix bugs
Support
Consider donating to this project if you find it useful:
Credits
Special Thanks
-
YOU.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for smartbetsAPI-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ec16855f1c1abe33c023be3229b8b24334f74cd1a3225ec5e89a55798036ab6 |
|
MD5 | 2721e341e1269cce2909a29a4aa04256 |
|
BLAKE2b-256 | dfcd8d22e98b4cc4dca8489ab2933afff282f8dae64ca71199172149fabd2fa8 |