Last active
April 8, 2022 09:19
-
-
Save kgravenreuth/a7a768a4875f4799112dbc22ac4b78d4 to your computer and use it in GitHub Desktop.
Cloudbet API Sports Odds in Go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var markets []*bookmaker.Market | |
// traverse markets, e.g. soccer asian handicap | |
for marketKey, market := range event.GetMarkets() { | |
// traverse submarkets, e.g. soccer asian handicap -> | |
for submarketKey, submarket := range market.GetSubmarkets() { | |
// traverse selections, e.g. home team +0.5 | |
for _, selection := range submarket.GetSelections() { | |
lineID := strings.TrimRight(fmt.Sprintf("%s/%s?%s", marketKey, selection.GetOutcome(), selection.GetParams()), "?") | |
fmt.Println("line id: %v", lineID) | |
fmt.Println("max bet: %v", selection.MaxStake) | |
fmt.Println("odds: %v", selection.Price) | |
fmt.Println("probability: %v", selection.Probability) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment