COM betStatus

Please post any questions regarding the program here.

Moderator: 2020vision

COM betStatus

Postby Bid » Tue Nov 17, 2009 1:07 pm

Hi,

I have a couple of questions on betStatus..

Firstly have the possible returns changed? I am currently using:

Code: Select all
Set bet = ba.getbet(tmpBetID)
        If bet.betStatus = "M" Then


to check if a certain bet has been fully matched. This seems to be triggering my code even if it was partially matched - for which I would expect 'MU'

My second question may well be related to the first. Does it matter how many tabs I have open and which tab the bet may relate to when I use the above code?

Many Thanks.
Bid
 
Posts: 74
Joined: Mon Oct 15, 2007 10:58 am

Postby GaryRussell » Tue Nov 17, 2009 1:50 pm

The function simply returns the result of the API call getBet so if it's wrong it would mean the API is at fault.

The API call also returns requestedSize and matchedSize so you could try checking for matchedSize<requestedSize to determine if partially matched. If you get matchedSize<requestedSize and betStatus='M' then the API is definitely at fault.

For this particular call it doesn't matter if you are using multiple tabs.
User avatar
GaryRussell
Site Admin
 
Posts: 9872
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

Postby Bid » Tue Nov 17, 2009 2:34 pm

Thanks - I'll give the size properties a go.
Bid
 
Posts: 74
Joined: Mon Oct 15, 2007 10:58 am

Postby Bid » Wed Jan 06, 2010 11:15 am

I seem to having problems with this again..

I am using VBA in MS Access. I have set the reference to Betting Assistant and at the top of the module I have:

Code: Select all
Dim ba As New BettingAssistantCom.ComClass


Within a function I have:

Code: Select all
Set bet = ba.getbet(tmpBetID)
betStatus = bet.betStatus
requestedSize = bet.requestedSize
matchedSize = bet.matchedSize


tmpBetID is being set correctly, however betStatus always equals "" and both requestedSize and matchedSize always equal 0. I really can't see what I'm doing wrong.. any ideas? I am sure this used to work in the past.

Do I need to declare bet as anything specific?
Bid
 
Posts: 74
Joined: Mon Oct 15, 2007 10:58 am

Postby GaryRussell » Wed Jan 06, 2010 11:37 am

I returns "" when the API request cannot return the bet details. Are you sure tmpBetID is correct? It expects it to be a string value.
User avatar
GaryRussell
Site Admin
 
Posts: 9872
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

Postby Bid » Wed Jan 06, 2010 3:20 pm

This is the code for a test form that I've been playing with. It has the timer set to 1 sec. I was trying to see at which times certain things are known. This is for an in-play football match.

gSpreadSheetLocation and gWorkSheet are globals.

As you can see tmpBetID is a String so it doesn't look like that's the problem. I'm sure there's something obvious, I just can't see it!

Code: Select all
Option Compare Database

Dim ba As New BettingAssistantCom.ComClass

Dim mXL As Object
Dim mblnBetPlaced As Boolean
Dim bet As Object

Private Sub Form_Close()

Set mXL = Nothing

End Sub

Private Sub Form_Open(Cancel As Integer)

Set mXL = GetObject(gSpreadSheetLocation)

End Sub

Private Sub Form_Timer()

Dim dblOdds As Double
Dim bet As Object
Dim tmpBetID As String
Dim betStatus As String
Dim requestedSize As Double
Dim matchedSize As Double

If Not mblnBetPlaced Then
    dblOdds = mXL.Worksheets(gWorkSheet).Range("F7")
    PlaceBet 1, "BACK", dblOdds, 2, mXL
    mblnBetPlaced = True
Else
    tmpBetID = mXL.Worksheets(gWorkSheet).Range("T7")
    If IsNumeric(tmpBetID) Or Right(tmpBetID, 1) = "P" Then
        If Right(tmpBetID, 1) = "P" Then tmpBetID = Left(tmpBetID, Len(tmpBetID) - 1)
        Set bet = ba.getbet(tmpBetID)
        betStatus = bet.betStatus
        requestedSize = bet.requestedSize
        matchedSize = bet.matchedSize
    End If
    Debug.Print Time & " ID: " & tmpBetID & " Status: " & betStatus & " Requested: " & requestedSize & " Matched: " & matchedSize
End If

End Sub
Bid
 
Posts: 74
Joined: Mon Oct 15, 2007 10:58 am

Postby GaryRussell » Wed Jan 06, 2010 3:44 pm

Can't see anything wrong with it. I took the following extract from your code and manually entered a bet ref in cell T7. It works fine. If you put this code into a new worksheet and enter a bet ref manually in T7 does it work? When you are getting a blank result is the debug statement confirming that tmpBetID contains a bet reference?

Code: Select all
Option Explicit

Dim ba As New BettingAssistantCom.ComClass

Private Sub Worksheet_Change(ByVal Target As Range)
    Dim tmpBetID As String
    Dim Bet As Object
    Dim betStatus As String
    Dim requestedSize As Double
    Dim matchedSize As Double
    tmpBetID = Range("T7")
    If IsNumeric(tmpBetID) Or Right(tmpBetID, 1) = "P" Then
        If Right(tmpBetID, 1) = "P" Then tmpBetID = Left(tmpBetID, Len(tmpBetID) - 1)
        Set Bet = ba.getbet(tmpBetID)
        betStatus = Bet.betStatus
        requestedSize = Bet.requestedSize
        matchedSize = Bet.matchedSize
    End If
    Debug.Print Time & " ID: " & tmpBetID & " Status: " & betStatus & " Requested: " & requestedSize & " Matched: " & matchedSize
End Sub
User avatar
GaryRussell
Site Admin
 
Posts: 9872
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

Postby Bid » Wed Jan 06, 2010 4:10 pm

Thanks for having a look. I'm at work so can't test anything until later this evening or tomorrow.

The debug.print definitely shows the correct value for tmpBetID.

I think the problem must have something to do with using MS Access? Have you tried accessing the COM interface through anything other than Excel?
Bid
 
Posts: 74
Joined: Mon Oct 15, 2007 10:58 am

Postby GaryRussell » Wed Jan 06, 2010 4:14 pm

Not through MS Access, but through a VB.Net application. If it was a problem of this nature the code would likely crash rather than return a blank value. I will add an API return code to the bet object so that you can output this to see why it doesn't like it. I will let you know when it's available.
User avatar
GaryRussell
Site Admin
 
Posts: 9872
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

Postby GaryRussell » Wed Jan 06, 2010 5:00 pm

I have PM'd you a download link for the latest Beta. You can output Bet.errorCode to see the return code from the API.
User avatar
GaryRussell
Site Admin
 
Posts: 9872
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

Postby Bid » Wed Jan 06, 2010 5:22 pm

Thanks. I'll let you know when I get a chance to try this out..
Bid
 
Posts: 74
Joined: Mon Oct 15, 2007 10:58 am

Postby Bid » Fri Jan 08, 2010 10:48 am

Thanks Gary, for whatever reason this new version is working perfectly! It does seem to take quite a while to return the data though. How long would you expect getbet to take?
Bid
 
Posts: 74
Joined: Mon Oct 15, 2007 10:58 am

Postby GaryRussell » Fri Jan 08, 2010 10:55 am

It depends on your connection, but it typically gets a fast response from the API, under 100ms. I'll look into it.
User avatar
GaryRussell
Site Admin
 
Posts: 9872
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

Postby Bid » Fri Jan 08, 2010 11:39 am

Wow - It seems to be taking 2 or 3 seconds for me. Never had a problem with response times directly from BA though. I'm on an 8 MB connnection.
Bid
 
Posts: 74
Joined: Mon Oct 15, 2007 10:58 am

Postby GaryRussell » Fri Jan 08, 2010 11:46 am

Are you sure that one statement is taking that long? Is there any chance your timing is around some other code that is taking that long?
User avatar
GaryRussell
Site Admin
 
Posts: 9872
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

Next

Return to Help

Who is online

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