Last updated:
0 purchases
PS3838 0.3.1
BET PS3838
Introduction
BET PS3838 This project aims to bet automatically on different odds available on PS3838. It is part of a bigger secret project, but can be used by anyone who wants to place some bets, or retrieve some football odds (indeed, only football for the moment).
Package functionalities
There are two classes in the package called "PS3838RetrieveOdds" and "PS3838AutomatedBets"
PS3838RetrieveOdds :
This class is used to retrieve the odds for a list of matches or to place bets on the PS3838 API. It also uses a CustomLogger to log the information.
Parameters:
- credentials (Dict[str, str]): The credentials to connect to the PS3838 API.
Example: {"username": "my_username", "password": "my_password"}
- list_matches (List[Dict[str, Any]]): A list of matches to retrieve the odds for or to place the bets for.
Example: [{"league" : 2036, "team1" : "Montpellier", "team2" : "Paris Saint-Germain", "date" : datetime(2024, 8, 17, 17, 0, 0), "result" : 2, "amount" : 5, "odd_min" : 1.05}, ...]. Note that the parameters "result", "amount" and "odd_min" are optional and only used when placing bets.
- logger_active (bool): A boolean to activate the logger. Default is True.
- to_bet (bool): A boolean to know if we want to retrieve the odds or place the bets. Default is False.
PS3838RetrieveOdds :
This class is used to retrieve the odds from the PS3838 API. It uses the Retrieve class to connect to the API and retrieve the odds for each match. It also uses a CustomLogger to log the information.
Parameters:
config (Dict[str, str]): The config to connect to the PS3838 API.
Example: {"username": "my_username", "password": "my_password"}
logger_active (bool): A boolean to activate the logger. Default is True.
logger_name (str): The name of the log file. Default is "PS3838.log".
The main function in this class is "retrieving()". This function retrieves the odds for all the matches until a given date and for a given list of leagues.
Parameters:
until_date (datetime): The date until which we want to retrieve the matches. Default is None, it retrieves everything in the specified leagues.
leagues (List[int]): A list of leagues for which we want to retrieve the matches. Default is None, it retrieves every league until the date specified.
Returns:
List[List[Dict[str, Any]]]: A list of matches with their corresponding odds.
Example: [{'id': 1595460299, 'starts': '2024-08-23T18:45:00Z', 'home': 'Paris Saint-Germain', 'away': 'Montpellier HSC', 'league': 2036, 'line_id': 2650184231, 'odds': {'home': 1.309, 'draw': 6.14, 'away': 8.47}}, ...]
PS3838AutomatedBets :
This class is used to place bets on the PS3838 API. It uses the Bet classes to connect to the API and place the bets. It also uses a CustomLogger to log the information.
Parameters:
config (Dict[str, str]): The config to connect to the PS3838 API.
Example: {"username": "my_username", "password": "my_password"}
list_matches (List[Dict[str, Any]]): A list of matches to bet on.
Example:
[{'id': 1596465583, 'starts': '2024-09-04T17:45:00Z', 'home': 'Resende FC', 'away': 'Artsul', 'league': 216059, 'line_id': 2673459336, 'odds': {'Team1': 2.05, 'Team2': 3.1, 'Draw': 3.25}, 'result': 1, 'amount': 5},
{'id': 1596465586, 'starts': '2024-09-04T17:45:00Z', 'home': 'Fluminense', 'away': 'AF Perolas Negras', 'league': 216059, 'line_id': 2673462355, 'odds': {'Team1': 1.159, 'Team2': 11.83, 'Draw': 5.83}, 'result': 0, 'amount': 5}, ...].
logger_active (bool): A boolean to activate the logger. Default is True.
to_bet (bool): A boolean to know if we really want to bets. Default is False, useful for testing the code.
The main function in this class is "betting()". This function places bets on the PS3838 API for a given list of matches, if the bets are not already placed and if the maintenance is not in progress.
Returns:
List[List[Dict[str, Any]]] | None: A list of matches with their corresponding odds if the bets were placed, None otherwise.
Example: [{'id': 1595460299, 'starts': '2024-08-23T18:45:00Z', 'home': 'Paris Saint-Germain', 'away': 'Montpellier HSC', 'league': 2036, 'line_id': 2650184231, 'odds': {'home': 1.309, 'draw': 6.14, 'away': 8.47}}, ...]
How to use the package
Here is an example of code to use the package
import PS3838
# CREDENTIALS PART
config = {'telegram': {'token': 'YOUR_TG_TOKEN', 'chat_id': 'YOUR_CHAT_ID'}, 'ps3838': {'username': 'YOUR_USERNAME', 'password': 'YOUR_PASSWORD'}, 'db': {'host': 'YOUR_HOST', 'port': 'YOUR_PORT', 'user': 'YOUR_USER', 'password': 'YOUR_PASSWORD', 'database': 'YOUR_DB'}}
# MATCHES PART
match1 = {
'id': 1596236279,
'starts': '2024-09-14T19:00:00Z',
'home': 'Paris Saint-Germain',
'away': 'Brest',
'league': 2036,
'line_id': 2673340912,
'odds': {'home': 1.296, 'away': 8.56, 'draw': 5.91},
'result': 1,
'amount': 5,
}
matches = [match1]
if __name__ == "__main__":
bet = PS3838.PS3838AutomatedBets(config, matches, logger_active=False, to_bet=True)
successfull_bets = bet.betting()
Logger
You can activate or desactivate the logger with the parameter "logger_active" when instantiating.
If the logger is active and a telegram token and chat id are provided in the config dict, then you will receive the logs on your telegram chatbot and on a PS3838.log file. (On telegram there are only the logs up to "INFO", not "DEBUG".)
If the logger is active and the telegram parameters are missing, then you will receive the logs only on a PS3838.log file.
If the logger is not active then you will not receive anything.
Here is an example of what the logger can display on Telegram :
License
This project is licensed under the MIT License - see the LICENSE file for details.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.