Match id and relatives Markets

Please post any questions regarding the program here.

Moderator: 2020vision

Match id and relatives Markets

Postby vigliani.gaspare » Thu Sep 12, 2024 5:57 am

Hi Gary,
Would it be possible to extrapolate all the football matches with all the related markets and the IDs to recall them via Com?
vigliani.gaspare
 
Posts: 32
Joined: Wed Aug 02, 2017 7:30 pm

Re: Match id and relatives Markets

Postby GaryRussell » Mon Sep 16, 2024 7:51 am

I assume from your previous post that you are using VB.Net. Here's sample VB.Net code (console application) to store the event names in a HashTable. The HashTable's key is the event name and the values are another HashTable containing the market id as the key and BfEvent object as the value. It specifically targets English Soccer, but can be easily adapted.

Code: Select all
Imports BettingAssistantCom.Application

Module Module1

    Private WithEvents BA As New ComClass
    Private soccerEvents As New Hashtable

    Sub Main()
        Dim sports() As Object
        Try
            sports = BA.getSports
            ' Load markets into HashTable
            For Each sport As BfSport In sports
                If sport.sport = "Soccer" Then
                    Console.WriteLine("Sport name:" & sport.sport & ", Sport id:" & sport.sportId)
                    recurseMarkets(sport.sportId, Nothing, False)
                    Exit For
                End If
            Next
            ' List markets
            For Each venue As String In soccerEvents.Keys
                For Each market As BfEvent In soccerEvents(venue).values
                    Console.WriteLine("Venue:" & venue & ", Match name:" & market.eventName & ", Market id:" & market.eventId)
                Next
            Next
            Console.WriteLine("**** Done ****")
            Console.ReadKey()
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
    End Sub

    Private Sub recurseMarkets(eventId As Long, parentEvent As BfEvent, isEnglishSoccer As Boolean)
        Dim markets() As Object
        markets = BA.getEvents(eventId)
        For Each market As BfEvent In markets
            If market.eventId = 0 Then Continue For
            If market.eventName <> "English Soccer" And Not isEnglishSoccer Then Continue For
            If isEnglishSoccer And market.isMarket Then
                If Not soccerEvents.ContainsKey(parentEvent.eventName) Then
                    soccerEvents.Add(parentEvent.eventName, New Hashtable)
                End If
                soccerEvents(parentEvent.eventName).Add(market.eventId.ToString, market)
            Else
                recurseMarkets(market.eventId, market, True)
            End If
        Next
    End Sub

End Module
User avatar
GaryRussell
Site Admin
 
Posts: 9867
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK


Return to Help

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 33 guests

Sports betting software from Gruss Software


The strength of Gruss Software is that it’s been designed by one of you, a frustrated sports punter, and then developed by listening to dozens of like-minded enthusiasts.

Gruss is owned and run by brothers Gary and Mark Russell. Gary discovered Betfair in 2004 and soon realised that using bespoke software to place bets was much more efficient than merely placing them through the website.

Gary built his own software and then enhanced its features after trialling it through other Betfair users and reacting to their improvement ideas, something that still happens today.

He started making a small monthly charge so he could work on it full-time and then recruited Mark to help develop the products and Gruss Software was born.

We think it’s the best of its kind and so do a lot of our customers. But you can never stand still in this game and we’ll continue to improve the software if any more great ideas emerge.