ba.placebets COM Placement Order

Please post any questions regarding the program here.

Moderator: 2020vision

ba.placebets COM Placement Order

Postby jc0r » Wed Oct 11, 2017 2:33 pm

Anyone know why when you submit multiple bets, they don't always place in the order they were intended?

So you can have the following

Code: Select all
    Dim refs() As String
    Dim selecIds(59) As Long
    Dim betTypes(59) As String
    Dim odds(59) As Double
    Dim stake(59) As Double
    Dim tokens(59) As String

selecIds(0) = 1
selecIds(1) = 2
selecIds(2) = 3
selecIds(3) = 4
selecIds(4) = 5
selecIds(5) = 6
selecIds(6) = 7
selecIds(7) = 8
selecIds(8) = 9

betTypes(0) = "B"
betTypes(1) = "B"
betTypes(2) = "B"
betTypes(3) = "B"
betTypes(4) = "B"
betTypes(5) = "B"
betTypes(6) = "B"   
betTypes(7) = "B"
betTypes(8) = "B"

odds(0) = 100
odds(1) = 200
odds(2) = 300 
odds(3) = 400
odds(4) = 500
odds(5) = 600
odds(6) = 700
odds(7) = 800
odds(8) = 900

stake(0) = 0.2
stake(1) = 0.2
stake(2) = 0.2
stake(3) = 0.2
stake(4) = 0.2
stake(5) = 0.2
stake(6) = 0.2
stake(7) = 0.2
stake(8) = 0.2


I want (0) to be first, (1) to be second etc. A lot of the time it works, but sometimes it doesn't and I can't figure out why. I use the bet reference given by Betfair to determine which one was submitted first.

Any idea?

Thanks
User avatar
jc0r
 
Posts: 67
Joined: Wed Mar 15, 2006 6:13 pm
Location: Birmingham

Re: ba.placebets COM Placement Order

Postby osknows » Wed Oct 11, 2017 3:53 pm

It's the same when using the API directly, there's no guarantee of ordering.

What you can do is use the token as a dictionary key. Eg say you want to track both BACK and LAY bets separately, each time a new bet is going to be placed create a unique key that can be used in the token eg BACK1, BACK2, BACK3, LAY1, LAY2, LAY2 etc

eg create a class module to hold the bet details, say clsBet

Code: Select all
Public Token As String
Public BetId As String
Public selectionId As Long
Public MarketId As String
Public betType As String
Public Stake As Double
Public Odds As Double
Public Matched As String


then create a dictionary to hold multiple instances of clsBet

Code: Select all
Dim BetRefDict As Object
Set BetRefDict = CreateObject("Scripting.Dictionary") 'Add reference to Microsoft Scripting Dictionary


Create a new clsBet and add it to the dictionary

Code: Select all
Set newBet = New clsBet
newBet.Token = "BACK1"
neBet.MarketId = 1.xxxxxx
newBet.Odds = XYZ
'etc

BetRefDict.Add newBet.Token, newBet


then when each bet is received in the ba_betPlaced event you can lookup the dictionary key using the token and add the betId

Code: Select all
If BetRefDict.Exists(token) Then
 BetRefDict(token).BetId = ref
End If


You then have full bet details and can link it to a betId
User avatar
osknows
 
Posts: 946
Joined: Wed Jul 29, 2009 12:01 am

Re: ba.placebets COM Placement Order

Postby jc0r » Wed Oct 11, 2017 4:08 pm

Many thanks for the detailed reply. Unfortunately, I have no need to track bets, i only care which bet actually gets submitted first to the exchange. So unless I submit them separately, am I right in thinking I cannot control this through ba.placebets sending an array of bets?

Many thanks
User avatar
jc0r
 
Posts: 67
Joined: Wed Mar 15, 2006 6:13 pm
Location: Birmingham

Re: ba.placebets COM Placement Order

Postby osknows » Wed Oct 11, 2017 4:47 pm

Using the same method you can timestamp the bets you are submitting if you need to determine timing of bets between different ba.placebets requests. There's no way to know what was placed first though in a single ba.placebets request as all bets were placed in the same request and received in the same response.
User avatar
osknows
 
Posts: 946
Joined: Wed Jul 29, 2009 12:01 am


Return to Help

Who is online

Users browsing this forum: Bing [Bot] and 30 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.