Closed tarang-axelerant closed 1 month ago
live key?
code?
live key?
yes, with live key
code?
We don't need to check the code. We can directly compare the sports on betfair.com with those on https://docs.developer.betfair.com/visualisers/api-ng-sports-operations/
I want to see your code please
I want to see your code please
I have used the Betfairlightweight library. Below is my code for calling the API to retrieve sports:
from betfairlightweight import APIClient
client = APIClient("", "", "")
client.set_session_token("")
client.betting.list_event_types()
This is what I get
import betfairlightweight
trading = betfairlightweight.APIClient("username")
trading.login()
horse_racing_event_type_id = trading.betting.list_event_types(lightweight=True)
[{'eventType': {'id': '1', 'name': 'Soccer'}, 'marketCount': 24826}, {'eventType': {'id': '2', 'name': 'Tennis'}, 'marketCount': 614}, {'eventType': {'id': '3', 'name': 'Golf'}, 'marketCount': 73}, {'eventType': {'id': '4', 'name': 'Cricket'}, 'marketCount': 248}, {'eventType': {'id': '5', 'name': 'Rugby Union'}, 'marketCount': 119}, {'eventType': {'id': '1477', 'name': 'Rugby League'}, 'marketCount': 75}, {'eventType': {'id': '6', 'name': 'Boxing'}, 'marketCount': 66}, {'eventType': {'id': '7', 'name': 'Horse Racing'}, 'marketCount': 782}, {'eventType': {'id': '8', 'name': 'Motor Sport'}, 'marketCount': 14}, {'eventType': {'id': '27454571', 'name': 'Esports'}, 'marketCount': 20}, {'eventType': {'id': '10', 'name': 'Special Bets'}, 'marketCount': 20}, {'eventType': {'id': '998917', 'name': 'Volleyball'}, 'marketCount': 1}, {'eventType': {'id': '11', 'name': 'Cycling'}, 'marketCount': 5}, {'eventType': {'id': '2152880', 'name': 'Gaelic Games'}, 'marketCount': 31}, {'eventType': {'id': '6422', 'name': 'Snooker'}, 'marketCount': 358}, {'eventType': {'id': '7511', 'name': 'Baseball'}, 'marketCount': 46}, {'eventType': {'id': '6423', 'name': 'American Football'}, 'marketCount': 4}, {'eventType': {'id': '7522', 'name': 'Basketball'}, 'marketCount': 353}, {'eventType': {'id': '7524', 'name': 'Ice Hockey'}, 'marketCount': 58}, {'eventType': {'id': '61420', 'name': 'Australian Rules'}, 'marketCount': 116}, {'eventType': {'id': '468328', 'name': 'Handball'}, 'marketCount': 66}, {'eventType': {'id': '3503', 'name': 'Darts'}, 'marketCount': 66}, {'eventType': {'id': '26420387', 'name': 'Mixed Martial Arts'}, 'marketCount': 21}, {'eventType': {'id': '4339', 'name': 'Greyhound Racing'}, 'marketCount': 511}, {'eventType': {'id': '2378961', 'name': 'Politics'}, 'marketCount': 56}]
This is what I get
import betfairlightweight trading = betfairlightweight.APIClient("username") trading.login() horse_racing_event_type_id = trading.betting.list_event_types(lightweight=True)
[{'eventType': {'id': '1', 'name': 'Soccer'}, 'marketCount': 24826}, {'eventType': {'id': '2', 'name': 'Tennis'}, 'marketCount': 614}, {'eventType': {'id': '3', 'name': 'Golf'}, 'marketCount': 73}, {'eventType': {'id': '4', 'name': 'Cricket'}, 'marketCount': 248}, {'eventType': {'id': '5', 'name': 'Rugby Union'}, 'marketCount': 119}, {'eventType': {'id': '1477', 'name': 'Rugby League'}, 'marketCount': 75}, {'eventType': {'id': '6', 'name': 'Boxing'}, 'marketCount': 66}, {'eventType': {'id': '7', 'name': 'Horse Racing'}, 'marketCount': 782}, {'eventType': {'id': '8', 'name': 'Motor Sport'}, 'marketCount': 14}, {'eventType': {'id': '27454571', 'name': 'Esports'}, 'marketCount': 20}, {'eventType': {'id': '10', 'name': 'Special Bets'}, 'marketCount': 20}, {'eventType': {'id': '998917', 'name': 'Volleyball'}, 'marketCount': 1}, {'eventType': {'id': '11', 'name': 'Cycling'}, 'marketCount': 5}, {'eventType': {'id': '2152880', 'name': 'Gaelic Games'}, 'marketCount': 31}, {'eventType': {'id': '6422', 'name': 'Snooker'}, 'marketCount': 358}, {'eventType': {'id': '7511', 'name': 'Baseball'}, 'marketCount': 46}, {'eventType': {'id': '6423', 'name': 'American Football'}, 'marketCount': 4}, {'eventType': {'id': '7522', 'name': 'Basketball'}, 'marketCount': 353}, {'eventType': {'id': '7524', 'name': 'Ice Hockey'}, 'marketCount': 58}, {'eventType': {'id': '61420', 'name': 'Australian Rules'}, 'marketCount': 116}, {'eventType': {'id': '468328', 'name': 'Handball'}, 'marketCount': 66}, {'eventType': {'id': '3503', 'name': 'Darts'}, 'marketCount': 66}, {'eventType': {'id': '26420387', 'name': 'Mixed Martial Arts'}, 'marketCount': 21}, {'eventType': {'id': '4339', 'name': 'Greyhound Racing'}, 'marketCount': 511}, {'eventType': {'id': '2378961', 'name': 'Politics'}, 'marketCount': 56}]
Please check the length of these objects and compare it with the sports listed on betfair.com. I see around 30 sports on betfair.com, but we are only getting 25 in the API call above.
But is that because there are events that don't contain markets?
But is that because there are events that don't contain markets?
No, that's not the reason. All events should contain markets, so the discrepancy in the number of sports is likely due to other factors. Additionally, some competitions differ between betfair.com and our API response. Despite this, we aim to obtain the exact data from betfair.com. Even if some sports don't have events or markets (which is unlikely), we should still be able to retrieve the exact data from betfair.com
What events are you missing? I see 27 on the website and 25 from the api. The two difference for me are the two "Today's card" for greyhounds and horse racing which are the same event_type_id. So i'd say that matches.
What events are you missing? I see 27 on the website and 25 from the api. The two difference for me are the two "Today's card" for greyhounds and horse racing which are the same event_type_id. So i'd say that matches.
If you check the cricket competitions, you'll notice that there are 10 competitions listed on betfair.com. However, in the API response, I'm only receiving 9. Additionally, betfair.com displays 'The Ashes', 'European cricket series', and 'women's international Twenty20 matches', which are missing from the API response. Instead, I'm receiving 'country championship division 1' and 'country championship division 2'. My goal is to obtain the exact data available on betfair.com.
Only 9 for me on the website and 9 on the API. Can only guess it might be a locale thing, apart from that I have no idea.
I've noticed that there are more event types available on the Betfair official website compared to the Betfair APIs. Is there a reason for this?
Additionally, I've observed that while comparing the Betfair UI to the Betfair APIs, I received some extra data, but some data is missing. I'm not sure why this discrepancy exists. Can someone provide assistance?
Furthermore, could someone please advise me on where I can obtain the data that is available on the Betfair UI but not in the Betfair API?
Thank you.