Skip to content

What if i told you 🫵 that money can grow on trees? An arbitrage client built around the Odds v4 API

License

Notifications You must be signed in to change notification settings

robinmuhia/arbitrageClient

Repository files navigation

ArbitrageClient

Linting and Tests Coverage Status

Domain

What if i told you 🫵 that money can grow on trees?!? 🤑 Get free money!!!

Arbitrage betting is a strategy where a bettor takes advantage of differences in odds offered by different bookmakers to guarantee a profit. By placing bets on all possible outcomes of a sports event across different bookmakers, the bettor ensures that they will make a profit regardless of the outcome. This is possible when the odds offered by different bookmakers imply probabilities that add up to less than 100%. The bettor calculates the optimal bet sizes to ensure a profit regardless of the outcome. Arbitrage opportunities are usually short-lived and require quick action to exploit.

To learn more about arbitrage betting, read this

Usage

We currently only support version 4 of the Odds API and odds format of decimal.

Get an odds api key from Sport Odds API

You will need the following env variables and name them as is;

ODDS_API_BASE_URL="https://api.the-odds-api.com/v4"
ODDS_API_KEY=<SPORTS KEY HERE>

Installation

To install the SDK, you need to have Go 1.21

  go get github.com/robinmuhia/arbitrageClient

  import ("github.com/robinmuhia/arbitrageClient")

Implementation

package main

import (
  "context"

	"github.com/robinmuhia/arbitrageClient/arbs"
)

func main() {
	// Create a context
  ctx := context.Background()

  // We need to pass the params to get odds from specific formats
  // We currently only support decimal format for oddsFormat
  arbParams := arbs.ArbsParams{
              Region : "uk",
              Markets: "h2h",
              OddsFormat: "decimal",
              DateFormat: "iso",
             }
  threeArbs, twoArbs, err := arbs.GetAllArbs(ctx, arbParams)

  if err != nil {
    // handle err
  }

  fmt.Println(threeArbs, twoArbs)
}

Output

Average response time for the 95th percentile is around 53 seconds. So you can expect to receive a response within that time 95% of the time. This is because we call the api to get all sports with their odds then iteratively loop through all possible permutations. Any optimization techniques are appreciated.

// ThreeOddsArb represents the structure of how a match with three possible outcomes
// i.e a win, draw or loss will be represented in the response
type ThreeOddsArb struct {
	Title    string
	Home     string // home bookmarker
	HomeOdds float64 // home bookmarker odds
	HomeStake float64 // home stake you should place
	Draw     string // draw bookmarker
	DrawOdds float64 // draw bookmarker ddds
	DrawStake float64 // draw stake you should place
	Away     string // away bookmarker
	AwayOdds float64 // away book marker odds
	GameType string
	League   string
	Profit   float64
	GameTime string
}

// TwoOddsArb represents the structure of how a match with three possible outcomes
// i.e a win or loss will be represented in the response
type TwoOddsArb struct {
	Title    string
	Home     string // home bookmarker
	HomeOdds float64 // home bookmarker odds
	HomeStake float64 // home stake you should place
	Away     string // away bookmarker
	AwayOdds float64 // away book marker odds
	AwayStake float64 // away stake you should place
	GameType string
	League   string
	Profit   float64
	GameTime string
}

# daraja-go


# daraja-go

Contributing

Read the CONTRIBUTION.md file to see how you🫵 can contribute.

Description

The project implements the Clean Architecture advocated by Robert Martin ('Uncle Bob').

Points to note

  • Interfaces let Go programmers describe what their package provides–not how it does it. This is all just another way of saying “decoupling”, which is indeed the goal, because software that is loosely coupled is software that is easier to change.
  • Design your public API/ports to keep secrets(Hide implementation details) abstract information that you present so that you can change your implementation behind your public API without changing the contract of exchanging information with other services.

For more information, see:

About

What if i told you 🫵 that money can grow on trees? An arbitrage client built around the Odds v4 API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages