Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/simatwa/smartbetsapi
Soccer prediction package fitted with REST API
https://github.com/simatwa/smartbetsapi
api betting fastapi football-analysis football-api football-app football-data gambling predictions soccer
Last synced: 4 months ago
JSON representation
Soccer prediction package fitted with REST API
- Host: GitHub
- URL: https://github.com/simatwa/smartbetsapi
- Owner: Simatwa
- License: gpl-3.0
- Created: 2023-01-17T15:12:32.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-13T16:46:59.000Z (10 months ago)
- Last Synced: 2024-04-14T11:16:48.550Z (10 months ago)
- Topics: api, betting, fastapi, football-analysis, football-api, football-app, football-data, gambling, predictions, soccer
- Language: Python
- Homepage: https://smartbetsapi.onrender.com
- Size: 1.02 MB
- Stars: 7
- Watchers: 5
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
smartbetsAPI
> "Punter's choice"Worldwide soccer-matches predictor with Fast-API and a package for integrating the scripts in your own [Python](https://python.org) code.
## Features
- REST-API
- Script integration (package)
- Non-ML## Installation and usage
### Installation
*Python 3.9+* is required for this script to be fruitful to you.
- Installing through pip is always the most preferred way:```sh
pip install smartbetsAPI
```- For those who like enjoying the **latest** releases from [Github](https://github.com) like [me](https://github.com/Simatwa), rather than waiting for the next one:
```sh
pip install git+https://github.com/Simatwa/smartbetsAPI.git```
To install it alongside `REST-API` dependencies simply run:
```sh
pip install "smartbetsapi[api]"
```### Usage
1. Terminal
Running `$ smartbetsAPI ` will fire up the FastAPI 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 :
```sh
$ smartbetsAPI mypass9876```
> [!TIP]
> `Docs` will be available at : http://localhost:8000/v1/docs
> `Redoc` will be available at : http://localhost:8000/v1/redocHere is an example of a [simple program](examples/bet_at_rest_api_level.py) that makes prediction using the REST API.
![api running](assets/api_running.gif)
> [!Note]
> Reinstall with `sudo` privileges if `smartbetsAPI` command can't be found.> Example predicting using REST API
```py
from smartbets_API import predictor
predict = predictor('http://localhost:8080','password')
bets=predict.get_predictions('Arsenal','Manchester')
print(bets)
#Output
#(True, {'choice': 55.56, 'g': 14.0, 'gg': 80.0, 'ov15': 80.0, 'ov25': 65.0, 'ov35': 55.0, 'pick': 'ov15', 'result': '1'})
```* For more information you can run `smartbetsAPI -h`
2. 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](examples/predict_using_list.py):```py
#!/usr/bin/env python3
from smartbets_API.predictor import predictorteams = [
"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](examples/predict_using_dict.py):```py
#!/usr/bin/env python3
from smartbets_API.predictor import predictorteams = {
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_positionInclude 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 FalseThe 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](https://int.soccerway.com) after retrieving the *uri* from [Google](https://www.google.com).
> **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](https://github.com/Simatwa), 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](CONTRIBUTING.md).
Feel free to open an [Issue](https://github.com/Simatwa/smartbetsAPI/issues) or to [Fork](https://github.com/Simatwa/smartbetsAPI/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:
### API Health Status
| No. | API | Status |
|--------|-----|--------|
| 1. | [On-render](https://smartbetsapi.onrender.com) | [cron-job](https://lfx48519.status.cron-job.org) |## Credits
- [x] [Soccerway](https://int.soccerway.com)
- [x] [Google](https://www.google.com)
- [x] [Python.org](https://python.org)## Special Thanks
* [x] [victhepythonista](https://github.com/victhepythonista)
* [x] YOU.