Skip to main content

A package to interact with the PS3838 API, especially to retrieve odds and bet automatically.

Project description

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).

How to use the package

Here is an example of code to use the package

import PS3838

def betting():
    print("oui")

Package functionalities

There are two functions in the package, plus one python file that can be useful for league correspondency :

  • retrieving : This function retrieves the odds for a given list of matches. Thanks to the credentials, it creates a Retrieve API which is used to connect to PS3838. Then several functions are used to find each match and their corresponding odds.

      **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.
              Example: [{"league" : 2036, "team1" : "Montpellier", "team2" : "Paris Saint-Germain", "date" : datetime(2024, 8, 17, 17, 0, 0)}, ...]
          - api_retrieve (Optional[Retrieve]): An optional Retrieve object to use to retrieve the matches. If not provided, it will be created.
          - logger_active (bool): A boolean to activate the logger. Default is True.
          - logger (Optional[CustomLogger]): An optional CustomLogger object to use to log the information. If not provided, it will be created.
          
      **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', 'rotNum': '3121', 'liveStatus': 2, 'status': 'O', 'parlayRestriction': 2, 'altTeaser': False, 'resultingUnit': 'Regular', 'betAcceptanceType': 0, 'version': 545200449, 'league': 2036, 'result': None, 'amount': None, 'odd_min': None, 'line_id': 2650184231}, {'team1_odds': 1.309, 'draw_odds': 6.14, 'team2_odds': 8.47}), ...]
    
  • betting : This function places bets on the PS3838 API for a given list of matches. It retrieves the odds for each match and then places the bets under some conditions (bet not already placed, odds above a certain threshold, etc.).

      **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 place the bets for. Note that they have to have 3 additional parameters "result", "amount", "odd_min".
              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}, ...]
          - logger_active (bool): A boolean to activate the logger. Default is True.
    
      **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', 'rotNum': '3121', 'liveStatus': 2, 'status': 'O', 'parlayRestriction': 2, 'altTeaser': False, 'resultingUnit': 'Regular', 'betAcceptanceType': 0, 'version': 545200449, 'league': 2036, 'result': 1, 'amount': 5, 'odd_min': 1.05, 'line_id': 2650184231}, {'team1_odds': 1.309, 'draw_odds': 6.14, 'team2_odds': 8.47}), ...]
    
  • leagues_correspondency.py This file is the correspondency between the main leagues od sport_api and the ones of PS3838, because they are not excatly the same. Not everything has been linked but the most famous ones. To be sure that it finds the correspondency, you must use the league ID of sport API, to find the league ID of PS3838. Then in the code you must use the league ID of PS3838, and not the name of the league.

    for match in matches:
        print("oui")
    

Schema of the retrieving function

Schema of the betting function

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PS3838-0.1.1.tar.gz (57.3 kB view hashes)

Uploaded Source

Built Distribution

PS3838-0.1.1-py3-none-any.whl (65.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page