-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvalue_bets.py
More file actions
85 lines (62 loc) · 2.87 KB
/
value_bets.py
File metadata and controls
85 lines (62 loc) · 2.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
"""
Value betting finder example.
This example demonstrates how to find value betting opportunities
with positive expected value.
"""
import os
from odds_api import OddsAPIClient
# Get your API key from https://odds-api.io/#pricing
API_KEY = os.getenv("ODDS_API_KEY", "your_api_key_here")
def main():
with OddsAPIClient(api_key=API_KEY) as client:
print("=== Finding Value Bets ===\n")
# Find value bets from SingBet
# SingBet is often used as the "sharp" bookmaker for true probability
value_bets = client.get_value_bets(
bookmaker="SingBet",
include_event_details=True
)
if not value_bets:
print("No value bets found at the moment.")
return
print(f"Found {len(value_bets)} value betting opportunities!\n")
# Display value bets sorted by expected value
for i, bet in enumerate(value_bets[:15], 1):
print(f"=== Value Bet #{i} ===")
# Event details
if 'event' in bet:
event = bet['event']
home = event['home']
away = event['away']
print(f"Match: {away} @ {home}")
print(f"Sport: {event.get('sport', 'N/A')}")
print(f"League: {event.get('league', 'N/A')}")
print(f"Start: {event.get('startTime', 'N/A')}")
# Value bet details
if 'expectedValue' in bet:
ev = bet['expectedValue']
print(f"Expected Value: {ev:.2f}%")
if 'outcome' in bet:
print(f"Bet on: {bet['outcome']}")
if 'odds' in bet:
print(f"Odds: {bet['odds']}")
if 'impliedProbability' in bet:
print(f"Implied Probability: {bet['impliedProbability']:.2f}%")
if 'trueProbability' in bet:
print(f"True Probability: {bet['trueProbability']:.2f}%")
print()
# Example: Get more details about a specific event
if value_bets and 'event' in value_bets[0]:
first_event = value_bets[0]['event']
if 'id' in first_event:
event_id = str(first_event['id'])
print(f"=== Detailed Event Information ===")
event_details = client.get_event_by_id(event_id=int(event_id))
print(f"Event ID: {event_details.get('id')}")
print(f"Status: {event_details.get('status')}")
if 'participants' in event_details:
print("Participants:")
for participant in event_details['participants']:
print(f" - {participant['name']}")
if __name__ == "__main__":
main()