Using COM to retrieve Bet Info

Please post any questions regarding the program here.

Moderator: 2020vision

Using COM to retrieve Bet Info

Postby dgs2001 » Tue Apr 07, 2009 9:32 am

Hi All

I'm trying to use the COM interface to check all bets on a second tab in BA which is just set to load markets at off of .

However all I'm getting returned by ba.getBet(mybetrefs(i)) is nothing.

Does the COM call only cover the market open at that point or is it a global thing?

Code: Select all
'''     Run Through and get Bet Refs , Query this through Com to Get Matched
            p1 = 3
            i = -1
            With ws
               Do
               i = i + 1
               ReDim Preserve mybetrefs(i)
'''     Only check future Race Bet Refs Not Previous Ones
                If currentTime < Format(.Range("B" & p1), "HH:MM") Then
                    If currentMarketOffTime > Format(.Range("B" & p1), "HH:MM") Then
                    mybetrefs(i) = .Range("L" & p1)
                        ReDim Preserve betMatchedStake(i)
                            betMatchedStake(i) = ba.getBet(mybetrefs(i))
'''     Check For Cancelled And Re-bet
                                If betMatchedStake(i).betstatus <> "C" Then
'''     Get Matched Stake and place on selections Sheet
                                betMatchedStake(i) = betMatchedStake(i).matchedSize
                                    .Range("I" & p1) = betMatchedStake(i)
                                Else: goReBet (mybetrefs(i))
                                End If
                    End If
                Else: i = i - 1
                End If
'''     Loop through Sheet till All Refs Checked
               p1 = p1 + 1
               Loop Until .Range("L" & p1) = ""
            End With


Any pointers gratefully recieved Duncan
User avatar
dgs2001
 
Posts: 334
Joined: Thu Apr 05, 2007 4:53 pm
Location: The Home Of National Hunt

Postby GaryRussell » Tue Apr 07, 2009 10:43 am

Your code is reading the bet ref from column L in your worksheet? Is this correct? It's usually in column T.
User avatar
GaryRussell
Site Admin
 
Posts: 9703
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

Postby dgs2001 » Tue Apr 07, 2009 12:49 pm

Yes column L has the bet Ref and when I step through it is picked up correctly.

I am mainly checking previously unmatched bets have now been matched, I don't know if that makes a difference.

Duncan
User avatar
dgs2001
 
Posts: 334
Joined: Thu Apr 05, 2007 4:53 pm
Location: The Home Of National Hunt

Postby GaryRussell » Tue Apr 07, 2009 3:58 pm

I'm a bit slow today.

Try changing your statement to read as follows.

Code: Select all
set betMatchedStake(i) = ba.getBet(mybetrefs(i))
User avatar
GaryRussell
Site Admin
 
Posts: 9703
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

Postby dgs2001 » Wed Apr 08, 2009 12:15 am

Thanks for the reply Gary

Trust me when it comes to your program your faster than me in your sleep.
Code: Select all
set betMatchedStake(i) = ba.getBet(mybetrefs(i))

Alas this did'nt work so I started going through your examples of COM spreadsheets.

I decided that maybe this should work
Code: Select all
Private Sub Worksheet_Change(ByVal Target As Range)

Dim wb As Workbook
Set wb = ThisWorkbook
Dim upBA As Worksheet
Set upBA = wb.Worksheets("Bets_Update")
Dim ws As Worksheet
Set ws = wb.Worksheets("Selections_")
Dim mybetrefs As String
Dim p1 As Integer, p2 As Integer, i As Long
Dim betMatchedStake() As Variant

Dim ba As New BettingAssistantCom.ComClass

If Target.Columns.count <> 16 Then Exit Sub
   
    Application.EnableEvents = False
             
'''     Run Through and get Bet Refs
            p1 = 3
            With ws
               Do
                 mybetrefs = .Range("L" & p1)
                 
                 betMatchedStake = ba.getBets               
         
'''     Check For Cancelled And Re-bet
                                If betMatchedStake(0).betstatus <> "C" Then
'''     Get Matched Stake and place on selections Sheet
                                     betMatchedStake(0) = betMatchedStake(0).matchedSize
                                    .Range("I" & p1) = betMatchedStake(0)
                                Else: goReBet (mybetrefs)
                                End If                   
'''     Loop through Sheet till All Refs Checked
               p1 = p1 + 1
               Loop Until .Range("L" & p1) = ""
            End With
    Application.EnableEvents = True
 
End Sub

However this gives a type mismatch:Error 13 on the betMatchedStake = ba.getBets

So then I started trying your example COM spreadsheets and they give the same error :13 Type mismatch on the following-
Code: Select all
tradedVolume = ba.getTradedVolume(Cells(r, 1).Value)

or
Code: Select all
Set bal = ba.getBalance(2)


I have checked that the BettingassistantCom is ticked in the references and pasted the BA Help File code in to a config file in the Excel.exe folder.

I'm using Office 2007 and Vista if thats relevant?

Ah one other thing in the days of old I copied my BA installation folder and renamed it BA1 to have a second instance of BA (Before the Excellent Profile addition), however my bloody computer won't let me delete that folder.

Keeps telling me I don't have permission even though I'm the creator and owner.
Could this stubborn instance of BA be upsetting my install?.


Duncan
User avatar
dgs2001
 
Posts: 334
Joined: Thu Apr 05, 2007 4:53 pm
Location: The Home Of National Hunt

Postby GaryRussell » Wed Apr 08, 2009 6:24 am

Sounds like a problem another user was having. It could be that communication is blocked between Excel and Betting Assistant. It needs to communicate over port 8000. I can have a look using our remote assistance application if you want, if so please contact me on gruss@blueyonder.co.uk
User avatar
GaryRussell
Site Admin
 
Posts: 9703
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK


Return to Help

Who is online

Users browsing this forum: No registered users and 21 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.