Using VB2008 to acccess the Betfair API: A tutorial

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • john_baptiste_of_cheshire
    Junior Member
    • Apr 2012
    • 8

    #781
    thanks to mumbles

    thank you very much for posting this brilliant guide. i found it easy to follow and i am a complete novice to programming. it's been a great help.

    Comment

    • Strappa71
      Junior Member
      • Apr 2010
      • 3

      #782
      Originally posted by ahn View Post
      hi to all,

      i have a strange problem! using the market id, asian lite id and selection id i get the live prices for the total goals event. In case that the score in a match is 0-0 then my algorithm can succesfully place back/lay bets. The problem arises after at least a goal has been scored. Then every time i try to place a bet i receive a selection removed error from the server. Does enyone know why do i get this error and how can i overcome it!!! thanks
      I think your problem lies in the understanding of asian hcp works in-play.

      All bets on Asian hcp are calculated from the as if the score is 0-0 when the bet is made. Therefore a new market ID is assigned after every scored goal to what may seem be the "same market".

      If you read the rules for asian lines carefully you will understand what I try to explain.

      Comment

      • NatHunter
        Junior Member
        • May 2012
        • 8

        #783
        Loading the BF Global Service Crashes VB.net 2010

        Hi folks.

        Hopefully you can help.

        I am attempting to add the Betfair service to a VB.net 2010 application and have followed the 'mumbles way', but VB.net crashes once it has searched for the service. Any ideas why?

        I did manage to add the BF service on the same PC previously to another project (which has been deleted), but have been unable to add it since.

        Any help would be much appreciated!

        Regards

        Natty

        Comment

        • NatHunter
          Junior Member
          • May 2012
          • 8

          #784
          FYI - I updated VS 2010 to SP1 and my PC stopped crashing.

          Thanks for the guide, Mumbles, btw. I do program now and again in VB.NET and this is easy to follow and introducing me to new concepts along the way

          Cheers

          Natty

          Comment

          • I am the one and only223
            Junior Member
            • Sep 2009
            • 7

            #785
            OK I posted before about trying to use placeBetsAsync in the VBA Excel code, and I've come to the conclusion that the reason it doesn't work is that VBA is not able to handle the multithreading aspect. So going back to the drawing board I decided to create a VB2010 application that processes bets asynchronously that I can call from VBA. But I still can't get the dratted thing to work. To call the async version I construct the oPlaceBetsReq object and use this code:

            BetFairUK.placeBetsAsync(oPlaceBetsReq)

            But nothing happens. If I replace this with the normal:

            oPlaceBetsResp = BetFairUK.placeBets(oPlaceBetsReq)

            Then it works fine. The BetFairUK_placeBetsCompleted method doesn't return anything when I debug it. Is there some extra coding I need to do for placeBetsAsync that doesn't apply to other asynchronous methods?

            Comment

            • jota
              Junior Member
              • Jul 2012
              • 2

              #786
              Hi all,

              im young on this forum and i just use vb.net because i like try new thinks

              and i want make a app for me to correct scorre and after another markets bug for now i want correct score in futboll

              and my problem now is make a ladder, can u help me ?

              i have a gride and put the name but in 3 line the code put 3 times the last odd

              sorry for the bad englis im portuguese.

              thanks for all and for this tuto

              Comment

              • Drifter
                Junior Member
                • Mar 2009
                • 30

                #787
                Eu não sou português - usando apenas GoogleTranslate e alguns princípios que eu aprendi há muito tempo.

                Você pode começar a aprender seguindo o tutorial e analisar o XML para encontrar as seleções para 'Correct Scores'.

                Eu construí um bot para Correct Scores, e você deve ter cuidado com a organização da SelectionID.

                Basicamente, você pode obter tudo o que você precisa saber a partir deste tutorial, exceto a lógica para seu comércio. Se você tem dificuldade em traduzir as apostas na lógica os 'placebets', em seguida, pedir novamente quando chegámos a esse ponto.

                Se você já está nesse ponto, postagem de o código e screenshots vai ajudar, porque as pessoas não podem compreender facilmente o problema sem que isso.

                Boa sorte!
                Last edited by Drifter; 10-07-2012, 08:25 PM.

                Comment

                • Walodja1987
                  Junior Member
                  • Aug 2012
                  • 1

                  #788
                  Hi,

                  many thanks for this fantastic tutorial. But I have a little problem:

                  ShowMprices(e.Result) is underscored as a misstake. It says that the value of type "BetfairApplikation.BFUK.GetAllMarketsResp" cannot be converted to BetfairApplikation.BFUK.GetMarketPricesResp.

                  (BetfairApplikation is the name of my VB project)

                  What am I doing wrong?

                  Comment

                  • pedromiranda
                    Junior Member
                    • Sep 2012
                    • 1

                    #789
                    This forum is awesome! thanks Mumbles0

                    Comment

                    • naeem
                      Junior Member
                      • Nov 2012
                      • 1

                      #790
                      Betfair Live Markeet Software

                      sir i see your posts,which are very helpful for me.
                      and i am realy Appreciate what you are doing.
                      now i want your help to devolp my small software.
                      i m using your coding but my software requirments bit diffrent.
                      pic 1 (login)
                      my requirement is username and password which is showed in pic1
                      and i need when i loged on that windows my loged immediately goes online
                      database and check username and password.when user and password check ok,
                      then showed the next windows which is showed in pic2 (Horse):
                      now you see pic2,i want to develop it just like its corben copy
                      and the red circle marks are very necessary for me
                      And when i click on cricket tab in pic2, it will be showed just like in pic3 (Cricket)

                      i need this software as soon as possible sir plz help me
                      Attached Files

                      Comment

                      • jota
                        Junior Member
                        • Jul 2012
                        • 2

                        #791
                        hello,

                        once again thanks for the tutorial ...

                        this is the code:

                        Code:
                         Sub mostrarpreco(ByVal MpriceResp As BFUK.GetMarketPricesResp)
                        
                                'TALBA
                                tablaprecos.Columns.Clear()
                                tablaprecos.Rows.Clear()
                        
                                Dim oMarketReq As New BFUK.GetMarketReq       'Create the request object
                                Dim oMarketResp As BFUK.GetMarketResp     'Create a varaible for the response object
                                Dim rowprecos As DataRow
                        
                                Dim precoback As Decimal
                                Dim oddback As Decimal
                                Dim precolay As Decimal
                                Dim oddlay As Decimal
                                'Dim Lay, Back As String
                        
                                Dim selid As String = ""
                                Dim name As String = ""
                        
                                With tablaprecos.Columns     'Set up all columns
                                    .Add("SELECTION ID")
                                    .Add("NAME")
                                    .Add("ODD BACK")
                                    .Add("ODD BACK PREÇO")
                                    .Add("ODD LAY")
                                    .Add("ODD LAY PREÇO")
                                End With
                        
                                With oMarketReq
                                    .header = Me.oHeaderUK()
                                    .marketId = LBLteste.Text
                                End With
                                oMarketResp = Me.BetFairUK.getMarket(oMarketReq)    'Call the API (getMarket)
                                'FIM(TALBA)
                                With oMarketResp                      'Process the response
                                    Me.CheckHeader(.header)
                                    If .errorCode = BFUK.GetMarketErrorEnum.OK Then
                                        With .market
                                            For i = 0 To .runners.Length - 1
                                                With .runners(i)
                                                    selid = .selectionId
                                                    name = .name
                                                End With
                                            Next
                                        End With
                                    End If
                                End With
                        
                                With MpriceResp
                                    CheckHeader(.header)
                                    Print("ErrorCode = " & .errorCode.ToString)
                                    If .errorCode = BFUK.GetMarketPricesErrorEnum.OK Then
                                        With .marketPrices
                                            For i = 0 To .runnerPrices.Length - 1
                                                With .runnerPrices(i)
                                                    For j = 0 To .bestPricesToBack.Length - 1
                                                        With .bestPricesToBack(j)
                                                            precoback = .price
                                                            oddback = Int(.amountAvailable)
                                                        End With
                                                    Next
                                                    For j = 0 To .bestPricesToLay.Length - 1
                                                        With .bestPricesToLay(j)
                                                            precolay = .price
                                                            oddlay = Int(.amountAvailable)
                                                        End With
                                                    Next
                                                    rowprecos = tablaprecos.NewRow
                                                    rowprecos("SELECTION ID") = selid
                                                    rowprecos("NAME") = name
                                                    rowprecos("ODD BACK") = precoback
                                                    rowprecos("ODD BACK PREÇO") = oddback
                                                    rowprecos("ODD LAY") = precolay
                                                    rowprecos("ODD LAY PREÇO") = oddlay
                                                    tablaprecos.Rows.Add(rowprecos)
                                                End With
                                            Next
                                        End With
                                    End If
                                End With
                                GVPrecos.DataSource = tablaprecos   'Show the data
                                GVPrecos.Refresh()
                            End Sub

                        I was here to work a bit in the code, and after a few hours got part of what he wanted was to get everything on one datagride,

                        The drawback is that in this case, when writing the "selid" corresponding to ". selectionid"
                        and the "name" that corresponds to. "name"

                        it writes only the last result obtained, for example

                        1 Portugal
                        2 france
                        3 tie

                        he writes all lines where the "3 tie"

                        the rest is correct ...

                        already now, as I can put a reddish tint in the cells of green and lay back in?

                        respects

                        Comment

                        • monkeymagix
                          Junior Member
                          • Jul 2010
                          • 105

                          #792
                          When is your JSON Tutorial arriving

                          Hi Mumbles

                          I don't know if you've ever wished that you never started this tutorial on the VB.NET implementation of the SOAP interface or not....but as Betfair are now changing from SOAP to JSON are you planning on writing a new tutorial on converting all your VB.NET SOAP WSDL into JSON examples?

                          I have been hunting round for a guide to the new JSON interface so I can convert my own C# Betfair API code from SOAP into JSON but cannot seem to find one.

                          I don't know if that means I haven't been looking hard enough or that it hasn't been written yet.

                          However as I have seen articles from as far back as 2010 that talked about keeping the SOAP interface for only 18 months during the transition phase I am keen to get working on coding the BOT (I have finally got perfected and working) into JSON before they stop supporting it.

                          It always seems like I just finish a big piece of work and then it all goes and changes and I have to rewrite it all again.

                          Anyway if you know of any links or tutorials to swapping from SOAP to JSON in either VB.NET or C# then please let me know.

                          Thanks

                          Rob

                          Comment

                          • Let it Ride
                            Junior Member
                            • Jan 2012
                            • 6

                            #793
                            Step 31 but without the tabs

                            Many thanks for this fantastic tutorial, Mumbles.

                            I have what is probably a very simple question but I've exhausted my patience of trial and error and Google .....

                            For Step 31, you invoke the RunnerGrid on the tab by Tab.Controls.Add(New RunnerGrid(Resp.market.runners))

                            How do I amend this if I just want the RunnerGrid to build on the main form page?

                            I'm not actually using the BF runners resp for building the datagridview (I'm getting the data from a db) but that's is a different issue.

                            Thanks!

                            Comment

                            • api 2011
                              Junior Member
                              • Dec 2012
                              • 1

                              #794
                              Place SP bet

                              First of all, congratulations for this post.

                              I wanna know how make the code for SP bets.

                              Thanks from Portugal,

                              Comment

                              • leb
                                Junior Member
                                • May 2013
                                • 1

                                #795
                                oMarketsResp doesn't get all marketData

                                Hi all,

                                Thank you Mumbles0 for this great tutorial.

                                I have a problem when getting the marketData with oMarketsResp, I am sorry if this problem has been already discussed in this thread or somewhere else but I haven't been able to find anything regarding this it, the code

                                Code:
                                       Dim oMarketsReq As New BFUK.GetAllMarketsReq
                                        Dim oMarketsResp As New BFUK.GetAllMarketsResp
                                        With oMarketsReq
                                            .header = oHeaderUK()
                                            ReDim .eventTypeIds(0) : .eventTypeIds(0) = 4339  'For greyhound racing
                                            ReDim .countries(1) : .countries(0) = "GBR" : .countries(1) = "ZAF"
                                            .fromDate = Now
                                            .toDate = Now.AddDays(1)
                                        End With
                                
                                        Dim i As Integer = 0
                                        oMarketsResp = BetFairUK.getAllMarkets(oMarketsReq)  'Call the UK API
                                        With oMarketsResp
                                            CheckHeader(.header)
                                            Print("oMarketsResp errorCode = " & .errorCode.ToString)
                                            If .errorCode = BFUK.GetAllMarketsErrorEnum.OK Then
                                                Dim AllMarkets As New UnpackAllMarkets(.marketData)   'Create an object and unpack the string
                                                With AllMarkets
                                .
                                .
                                .
                                The problem is that this code on some cities doesn't return the last few races but only when the races are after 20:25 betfair api time (somewhere after this hour and minute, I haven't been able to pin point the exact minute). I have looked at marketData before unpacking (I thought maybe its not getting all races when unpacking) but the packed string missed those races so the problem must be with oMarketsReq - oMarketsResp. Anyone else got this problem?

                                Comment

                                Working...
                                X