Using VB2008 to acccess the Betfair API: A tutorial

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts

  • JayBee
    replied
    Originally posted by Bonza Bud View Post
    Hi Rob, disd you ever get anywhere with this? Are you forced to use JSON or is there a way to still use your old VB.Net program on the new API-NG.

    Like you, I find the lack of information strange - surely there are many users that have VB.Net programs and expect them to continue working even if the API V6 (SOAP) is becoming unsupported in Nov 2014.

    Please respond

    Bonzabud
    There are two APIs currently running, API-6 using SOAP and the new API-NG using JSON. They are incompatible APIs.

    You can continue using your old code until Betfair stops broadcasting prices using the old API. Thereafter you will have to rewrite your code to process JSON. It really is much easier than SOAP. I've done so on my blog http://www.betfairprotrader.co.uk

    Leave a comment:


  • Bonza Bud
    replied
    Hi Rob, disd you ever get anywhere with this? Are you forced to use JSON or is there a way to still use your old VB.Net program on the new API-NG.

    Like you, I find the lack of information strange - surely there are many users that have VB.Net programs and expect them to continue working even if the API V6 (SOAP) is becoming unsupported in Nov 2014.

    Please respond

    Bonzabud

    Leave a comment:


  • Bonza Bud
    replied
    How can VB.Net use API-NG

    Hi Mumbles,

    I can see that you have entered a really useful post and spent a lot of time using VB.Net, I wrote my own program using VB.Net some years ago and then stopped using it.

    I am now returning to write a new program. I am confused by the new API-NG using JSON and the comment that API V6 SOAP/XML is being retired in Nov 2014. Does this mean that we are forced to used JSON or can we still use VB.Net? Do you know what endpoints to use with the new API-NG and VB.Net?

    Thanks

    Bonzabud

    Leave a comment:


  • mizar1
    replied
    hello
    I'm trying to understand if there is a command that tells me the time elapsed since a market and 'joined live.
    I created the function through the .delay for a market that I follow but if I open a market that 'already started and is not' party now communicated to exactly how I can do
    thanks

    Leave a comment:


  • JayBee
    replied
    Is everyone still able to login using the code given by Mumbles?

    I use the exact login code that he gave us in this tutorial.

    However, I get "API_ERROR" whenever I try to login and my programs no longer work.

    Leave a comment:


  • leb
    replied
    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?

    Leave a comment:


  • api 2011
    replied
    Place SP bet

    First of all, congratulations for this post.

    I wanna know how make the code for SP bets.

    Thanks from Portugal,

    Leave a comment:


  • Let it Ride
    replied
    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!

    Leave a comment:


  • monkeymagix
    replied
    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

    Leave a comment:


  • jota
    replied
    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

    Leave a comment:


  • naeem
    replied
    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

    Leave a comment:


  • pedromiranda
    replied
    This forum is awesome! thanks Mumbles0

    Leave a comment:


  • Walodja1987
    replied
    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?

    Leave a comment:


  • Drifter
    replied
    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.

    Leave a comment:


  • jota
    replied
    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

    Leave a comment:

Working...
X