Skip to content

danielcardeenas/surebet

Repository files navigation

Surebet 💵

GitHub license codebeat badge

Extendible, customizable real-time arbitrage scanning and placing software


Surebet is an extendible and customizable real-time arbitrage scanning and placing software designed to help you find and place arbitrage bets across multiple bookmakers or sources. It supports various betting strategies, uses fuzzy string matching to identify matching events between sources, and is built for flexibility and scalability.

Table of Contents


Features

Surebet offers the following key features:

Feature Description
Retriever Agnostic Supports any retriever type (websockets, API calls, Selenium, Puppeteer, etc.) via a common interface.
Multiple Sources/Bookies Handles arbitrage opportunities across multiple bookmakers simultaneously.
Customizable Arbers Allows custom arbitrage strategies. Examples: H2H Arber, 1x2 Arber.
Genetic Strategies Built-in support for customizable genetic algorithms. See available strategies.
Fiat Conversion Includes fixed fiat-to-fiat conversion for betting across currencies. See money module.
Fuzzy String Matching Uses fuzzy string matching (via fuzzball.js) to identify similar events between bookmakers.
Predefined Arbers Includes predefined strategies for markets like H2H (tennis, MMA) and 1x2 (soccer).

Installation

To get started with Surebet, clone the repository and install the necessary dependencies:

git clone https://github.com/danielcardeenas/surebet.git
cd surebet
npm install

Usage

Getting Started

Here's how to use Surebet for basic H2H arbitrage betting:

  1. Import the required modules:

    import { H2HArber } from '@arbers';
    import { Betfair, Bookmaker } from '@bookies';
    import { money } from '@money/currencies';
  2. Create instances of your bookmakers:

    const [betfair, bookmaker] = await Promise.all([
      Betfair.instance({ headless: false }, money.USD),
      Bookmaker.instance({ headless: false }, money.USD),
    ]);
  3. Login to the bookmaker accounts:

    await betfair.login({ user: 'yourUsername', password: 'yourPassword' });
  4. Define retrievers to fetch live betting opportunities:

    const retrievers = [
      {
        bookie: betfair,
        retriever: () => betfair.repo().live.tennis.h2h({ include: ['back'] }),
      },
      {
        bookie: bookmaker,
        retriever: () => bookmaker.repo().live.tennis.h2h(),
      },
    ];
  5. Start the arbitrage process:

    const investment = { amount: 200, currency: money.USD };
    const tennisArber = new H2HArber(retrievers, investment);
    
    tennisArber.start();
    
    // Listen for the close event
    tennisArber.closed.pipe(take(1)).subscribe(() => {
      process.exit(0);
    });

Example

The following example demonstrates Surebet's output when identifying arbitrage opportunities:

shell example


Customization

Custom Arbers

Surebet supports custom arbitrage strategies. You can implement your own by extending the base Arber class. Examples of predefined arbers include:

To create a custom arber:

  1. Extend the base Arber class.
  2. Implement your strategy logic based on your requirements.

Custom Retrievers

Retrievers are responsible for fetching live betting opportunities from sources or bookmakers. Surebet supports retrievers from various sources, such as APIs, websockets, or browser automation tools like Puppeteer.

To create a custom retriever:

  1. Implement a retriever function that conforms to the common interface.
  2. Use the retriever in your arber setup.

Example retriever for a custom source:

const customRetriever = {
  bookie: customBookieInstance,
  retriever: () => customBookieInstance.repo().live.soccer.h2h(),
};

Build and Run

To build and run the project, use the following commands:

# Build the project
npm run build

# Run tests (optional)
npm test

# Start the application
npm start

License

Surebet is licensed under the MIT License. Feel free to use, modify, and distribute the software as per the license terms.


For more details, visit the Surebet Repository.

🖥️ Working example

0815.mov

Releases

No releases published

Packages

No packages published