To place multiple bets on the same market you need to load up the .bets array with the details of each bet. You have already created this array in the PlaceBets section but it only holds the details of one bet at present - .bets(0).
So all you need is to loop through obets with the details of each bet and then add this to you .bets() array. Rinse and repeat until all bet details are added then send the bet in the usual manner.
Hope this makes sense - I can't provide actual code as I'm not at home so don't have access to it but if you're still struggling let me know and I'll post some code when I get home.
Using VB2008 to acccess the Betfair API: A tutorial
Collapse
This topic is closed.
X
X
-
Hi All
Thanks to mumbles for an excelent tutorial
i have read through all 74 pages and tried to get some of the code to work
wonder of wonders it works -- i did copy and paste so no typos
just a quick query as to how do i place a multiple bet -- did i miss this in the tutorial?
horse1 win -- horse 2 win -- horse 3 win
or
football match 1 draw -- football match 2 draw -- football match 3 draw
these = treble bet i think but how do i code this type of bet
any pointers would be great
Leave a comment:
-
I was wondering if we could use profit and loss values and the current bestprices to lay and back to determine the bets we need to place in order to green.
Is that possible?
Leave a comment:
-
One more thing, lets say Lay odd 1 is 1.01 - there's no back odd in that selection but it will remain as 1.01.Originally posted by Geierkind View PostHaha, so it's really first level
Thank you very much, before your solution I was confident that I already knew a little bit about it 
If you do this
It will be fine I think.Code:With .marketPrices With .runnerPrices(0) If .bestPricesToBack.Length > 0 Then Back1 = .bestPricesToBack(0).price Else Back1 = "" End If End With
Leave a comment:
-
GetAllMarkets weird issue
Something weird is happening to my GetAllMarkets response.
This is my code:
This code should select all soccer markets that have started in the last 10 minutes or will start in the next 10 minutes.Code:With oMarketsReq .header = oHeaderUK() ReDim .eventTypeIds(0) : .eventTypeIds(0) = 1 'This selects soccer .fromDate = Now.AddMinutes(-10) .toDate = Now.AddMinutes(10) End With oMarketsResp = BetFairUK.getAllMarkets(oMarketsReq)
It works fine mostly but occasionaly it will ignore my date parameters and just give me ALL soccer markets.
Any idea what could be causing this?
Leave a comment:
-
Haha, so it's really first level
Thank you very much, before your solution I was confident that I already knew a little bit about it
Leave a comment:
-
You need to add this
Code:With .marketPrices With .runnerPrices(0) [B]If .bestPricesToBack.Length > 0 Then[/B] Back1 = .bestPricesToBack(0).price [B]End If[/B] End With
Leave a comment:
-
Hi there. I got a problem here, which is really over my head because I really can't think of an explanation.
I get prices for all Markets which fit a certain criteria (cleansheet or some other), with a modified showmprices-sub:
[examplary for 3-Way Match Odds]
This is the Prices-Sub (which later works without problems, the above is the sub in question I think):Code:Sub ShowMprices3(ByVal MpriceResp As BFUK.GetMarketPricesResp) Dim Back1, Back2, Back3 As String With MpriceResp CheckHeader(.header) If .errorCode = BFUK.GetMarketPricesErrorEnum.OK Then With .marketPrices With .runnerPrices(0) Back1 = .bestPricesToBack(0).price End With With .runnerPrices(1) Back2 = .bestPricesToBack(0).price End With With .runnerPrices(2) Back3 = .bestPricesToBack(0).price End With Print(.marketId & "µ" & Back1 & "µ" & Back2 & "µ" & Back3) End With End If End With End Sub
So far so good. Now I can build this application and it seemingly works without errors, but when I actually get all those 3-Way prices (for example) after some time (may be 3 or 5 or even 10 minutes) the application (while getting all those prices) crashes with this error-message:Code:Private Sub b3wprices_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles b3wprices.Click With AllMarkets For j = 0 To AllMarkets.marketData.Length - 1 If AllMarkets.marketData(j).marketName.Contains("Wettquoten") Or AllMarkets.marketData(j).marketName.Contains("Match Odds") Then iMarket = j ShowMprices3(BetFairUK.getMarketPrices(MpricesReq)) 'Get market prices End If Next End With End Sub
IndexOutOfRangeException was unhandled, with the following line of ShowMprices3 marked yellow:
Now this is the point where I don't get it. How can the Error-Code be ok, but the .runnerPrices(0) be out of the Range of the .marketPrices array? Even with he first element?!Code:With .runnerPrices(0)
Plus, this Sub works for a few minutes like I said. All this is very confusing to me.
Thanks for any help.
Leave a comment:
-
Camper,
it's as 223 suggested
Dim Tme=format(.eventdate, "HH:mm") ="03:10"
or
Dim Tme=format(.eventdate, "HH.mm") = "03.10"
Dim Dte=format(.eventdate,"yyyyMMdd") = "20110824"
or
dim Dte=format(.eventdate,"dd/MM/yyyy") = "24/08/2011"
or any valid combination
use Format the same as currency,decimal etc
hope this helps
Leave a comment:
-
I guess I founded it:
Today:
Yesterday:Code:.fromDate = Today.AddDays(-1) .toDate = Today.AddDays(1)
Tomorow:Code:.fromDate = Today.AddDays(-2) .toDate = Today.AddDays(-1)
Code:.fromDate = Today.AddDays(1) .toDate = Today.AddDays(2)
Leave a comment:
-
Thanks for the help.
Hour, min and time are strings so I can't format them using the method you said. I figured out, It was simple after all, I've just changed this:
The second problem I have I cant figure it out.Code:hour = Format(.eventDate.Hour, "00") min = Format(.eventDate.Minute, "00")
To select from today, tomorow, and yesterday wich values must have .fromDate and .toDate ?
Leave a comment:
-
Hi Camper, I may know nothing about .exe and .dll files, but I know a bit of VB.
For your date/time problem use the format function:
x=format(Now,"hh:nn")
so x="15:58"
And for your selection problem I think it's not returning anything because the fromDate is the same as the toDate. If you want today's events I think you might have to have the toDate as tomorrow.
Leave a comment:
-
I'm having two problems.
First I want to use a combobox to filter the markets by date.
I tried this with no luck:
Code:Private Sub Main_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load ComboBox1.Items.Add("Today") ComboBox1.Items.Add("Yesterday") ComboBox1.Items.Add("Tomorow") End SubIt's not working at all, I have no idea.Code:Private Sub bMarkets_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bMarkets.Click ListBox1.Items.Clear() [B]Dim tempo as Integer Select Case ComboBox1.SelectedIndex Case 0 tempo = 0 Case 1 tempo = 1 Case 2 tempo = 2 End Select[/B] Dim oMarketsReq As New BFUK.GetAllMarketsReq Dim oMarketsResp As BFUK.GetAllMarketsResp With oMarketsReq .header = oHeaderUK() ReDim .eventTypeIds(0) : .eventTypeIds(0) = 2 [B] If tempo = 0 Then .fromDate = Today.AddDays(0) .toDate = Today.AddDays(0) End If If tempo = 1 Then .fromDate = Today.AddDays(-1) .toDate = Today.AddDays(-1) End If If tempo = 2 Then .fromDate = Today.AddDays(1) .toDate = Today.AddDays(1) End If[/B] .locale = "en" End With oMarketsResp = BetFairUK.getAllMarkets(oMarketsReq) 'Call the UK API With oMarketsResp CheckHeader(.header) Print("ErrorCode = " & .errorCode.ToString) If .errorCode = BFUK.GetAllMarketsErrorEnum.OK Then Dim AllMarkets As New UnpackAllMarkets(.marketData) 'Create an object and unpack the string With AllMarkets For i = 0 To .marketData.Length - 1 With .marketData(i) If .marketStatus = "ACTIVE" Then If .marketName = "Match Odds" Or .marketName = "Probabilidades" Then Dim Items As String() = Split(.menuPath, "\") Dim time, hour, min As String hour = .eventDate.Hour min = .eventDate.Minute time = hour & ":" & min Dim Q As New Market Q.id = .marketId Q.path = Items(UBound(Items)) Q.hour = time ListBox1.Items.Add(Q) End If End If End With Next End With End If End With End Sub
The other problem I have is here:
It shows the time in a wrong way, lets say the match is at 16:00, it only shows 16:0, if the match it at 03:15 it only shows 3:15.Code:Dim time, hour, min As String hour = .eventDate.Hour min = .eventDate.Minute time = hour & ":" & min Dim Q As New Market Q.id = .marketId Q.path = Items(UBound(Items)) Q.hour = time ListBox1.Items.Add(Q)

Thanks in advance.
Leave a comment:
-
The BDPAPI6.dll doesn't seem to have all the API functionality. I specifically need to use the asynchronous placebets call, but the nearest call I can see in BDPAPI6.dll is placebetpage, which is not asynchronous. Anybody know if I can create a dll in VB2010 with just the login/logout/keepalive and placebetsasync calls?
Leave a comment:
-
Thanks Dave, now I need a tutorial on how to use the dll.
I'll have a go tomorrow. My brain is returning a "NO SESSION" error atm!
Leave a comment:


Leave a comment: