Using VB2008 to acccess the Betfair API: A tutorial

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mumbles0
    Junior Member
    • Jan 2009
    • 240

    #286
    Aitor,

    You are not providing enough info about your problem.
    • Are you using an active .marketId in the request object ?
    • What is the response .errorCode ?
    • What do you expect instead of 0 0, 0 0, 0 0...... ?

    BetfairUK.getMarketPricesCompressedAsync works OK for me.

    Comment

    • runen
      Junior Member
      • May 2009
      • 6

      #287
      Hi there.

      I got this function inspired by you guys :-)... But when I use it, I get an api-error(19) - why? is it because of an unstable api or?

      The errorcodes are:

      errorCode = API_ERROR {19}
      og header.ErrorCode = INTERNAL_ERROR {1}


      Function PlaceLayBetv6(ByVal marketID As Integer, _
      ByVal selectionId As Integer, _
      ByVal price As Double, _
      ByVal stake As Double, _
      ByVal bKeepBetsInplay As Boolean) As BetfairWS.BF_UK.PlaceBetsResp

      Dim oPlaceBetsReq As New BetfairWS.BF_UK.PlaceBetsReq
      Dim oPlaceBetsResp As New BetfairWS.BF_UK.PlaceBetsResp
      Dim oBets As New BetfairWS.BF_UK.PlaceBets
      With oPlaceBetsReq
      .header = _bfReqHeader 'oHeaderUK()
      With oBets
      .asianLineId = 0
      .betCategoryType = BetfairWS.BF_UK.BetCategoryTypeEnum.E
      If bKeepBetsInplay Then
      .betPersistenceType = BetfairWS.BF_UK.BetPersistenceTypeEnum.IP
      Else
      .betPersistenceType = BetfairWS.BF_UK.BetPersistenceTypeEnum.NONE
      End If
      .betType = BetfairWS.BF_UK.BetTypeEnum.L
      .marketId = marketID
      .price = price
      .selectionId = selectionId
      .size = stake
      .bspLiability = 0
      End With
      ReDim .bets(0)
      .bets(0) = oBets
      End With
      oPlaceBetsResp = _bfUKExchangeServece.placeBets(oPlaceBetsReq)
      PlaceLayBetv6 = oPlaceBetsResp
      End Function

      Regards
      Rune

      Edit:
      Hmm I found out that I was able to bet in soccer over/under market without errors, but when I bet in the total goals market i always got this error:
      errorCode = API_ERROR {19}
      og header.ErrorCode = INTERNAL_ERROR {1}

      Why???


      Edit again :-) problem solved.

      Why is PlaceBets returning API_ERROR when placing a bet on a Total Goals market?
      You must include the 'asianlineIineid' which is required for Total Goal markets (these are set up as Asian Handicap markets).
      This can be obtained via GetMarket, and should be included in each placeBet request.
      Last edited by runen; 04-02-2010, 10:18 PM.

      Comment

      • Mumbles0
        Junior Member
        • Jan 2009
        • 240

        #288
        You've solved the problem!

        Read this and this.

        Total Goals markets are set up as Asian handicaps. You must include the asianLineId parameter in the placeBets request. This value is in the runners array returned by the getMarket call that you make to get the selectionIDs.

        Comment

        • gogcam
          Junior Member
          • Aug 2009
          • 2

          #289
          Hey Mumbles0

          Have you got any code to unpack the GetMarketPricesCompressed-String?

          I just don't get it

          Thank you very much

          Comment

          • Mumbles0
            Junior Member
            • Jan 2009
            • 240

            #290
            See Step 14 of this tutorial.

            Comment

            • runen
              Junior Member
              • May 2009
              • 6

              #291
              Anyone knows why the AsianLineID dosen't exists in the GetMarketPricesCompressed string?

              Comment

              • waldjunge
                Junior Member
                • Apr 2009
                • 12

                #292
                VisualBasic .dll

                I made an .inc file from the BDPAPI6.dll. At the moment I am able to login to Betfair and get SessionString. Does anyone know about a documentation of those Interfaces to make next steps like getting Markets?
                thanks.

                Here is a part of the .inc file:

                Code:
                $PROGID_BDPAPI6AccountFunds             = "BDPAPI6.AccountFunds"
                $PROGID_BDPAPI6AcctStmt                 = "BDPAPI6.AcctStmt"
                $PROGID_BDPAPI6AcctStmtItems            = "BDPAPI6.AcctStmtItems"
                $PROGID_BDPAPI6Bet                      = "BDPAPI6.Bet"
                $PROGID_BDPAPI6BetCancellationResult    = "BDPAPI6.BetCancellationResult"
                $PROGID_BDPAPI6BetCancellationResults   = "BDPAPI6.BetCancellationResults"
                $PROGID_BDPAPI6BetEvent                 = "BDPAPI6.BetEvent"
                $PROGID_BDPAPI6BetEventItems            = "BDPAPI6.BetEventItems"
                $PROGID_BDPAPI6BetItems                 = "BDPAPI6.BetItems"
                $PROGID_BDPAPI6BetPlacementResult       = "BDPAPI6.BetPlacementResult"
                $PROGID_BDPAPI6BetPlacementResults      = "BDPAPI6.BetPlacementResults"
                $PROGID_BDPAPI6BetResult                = "BDPAPI6.BetResult"
                $PROGID_BDPAPI6BetResults               = "BDPAPI6.BetResults"
                $PROGID_BDPAPI6BetUpdateResult          = "BDPAPI6.BetUpdateResult"
                $PROGID_BDPAPI6BetUpdateResults         = "BDPAPI6.BetUpdateResults"
                $PROGID_BDPAPI6clsBDPGlobal             = "BDPAPI6.clsBDPGlobal"
                $PROGID_BDPAPI6clsCal                   = "BDPAPI6.clsCal"
                $PROGID_BDPAPI6clsEndPoint              = "BDPAPI6.clsEndPoint"
                $PROGID_BDPAPI6clsMarketList            = "BDPAPI6.clsMarketList"
                $PROGID_BDPAPI6clsMarketResult          = "BDPAPI6.clsMarketResult"
                $PROGID_BDPAPI6clsProfile               = "BDPAPI6.clsProfile"
                $PROGID_BDPAPI6clsVSAdd                 = "BDPAPI6.clsVSAdd"
                $PROGID_BDPAPI6ConvertCurrency          = "BDPAPI6.ConvertCurrency"
                $PROGID_BDPAPI6FundsTransfer            = "BDPAPI6.FundsTransfer"
                $PROGID_BDPAPI6Header                   = "BDPAPI6.Header"
                $PROGID_BDPAPI6KeepAlive                = "BDPAPI6.KeepAlive"
                $PROGID_BDPAPI6Logout                   = "BDPAPI6.Logout"
                $PROGID_BDPAPI6Market                   = "BDPAPI6.Market"
                $PROGID_BDPAPI6Runner                   = "BDPAPI6.Runner"
                $PROGID_BDPAPI6RunnerItems              = "BDPAPI6.RunnerItems"
                $PROGID_BDPAPI6RunnerPnL                = "BDPAPI6.RunnerPnL"
                $PROGID_BDPAPI6RunnerPrice              = "BDPAPI6.RunnerPrice"
                $PROGID_BDPAPI6RunnerPrices             = "BDPAPI6.RunnerPrices"
                $PROGID_BDPAPI6ServiceProxy             = "BDPAPI6.ServiceProxy"
                $PROGID_BDPAPI6Sport                    = "BDPAPI6.Sport"
                $PROGID_BDPAPI6SportItems               = "BDPAPI6.SportItems"
                $PROGID_BDPAPI6zclsGlobal               = "BDPAPI6.zclsGlobal"
                
                
                'Enumeration BDP_Errors
                MACRO enumBDPAPI6BDP_Errors = LONG
                %ERR_BDP_NOT_LOGGED_IN                                  = &H000004B9
                %ERR_BET_FAILED                                         = &H000003FC
                
                'Enumeration enmAccountFundsReturnValues
                MACRO enumBDPAPI6enmAccountFundsReturnValues = LONG
                %ok                                                     = &H00000000
                %InternalError                                          = &HFFFFFFFF
                
                'Enumeration enmAcctStmtReturnValues
                MACRO enumBDPAPI6enmAcctStmtReturnValues = LONG
                %ok                                                     = &H00000000
                %InternalError                                          = &HFFFFFFFF
                
                'Enumeration enmBEReturnValues
                MACRO enumBDPAPI6enmBEReturnValues = LONG
                %ok                                                     = &H00000000
                %InternalError                                          = &HFFFFFFFF
                
                'Enumeration enmBetReturnValues
                MACRO enumBDPAPI6enmBetReturnValues = LONG
                %ok                                                     = &H00000000
                %InternalError                                          = &HFFFFFFFF
                
                'Enumeration enmMktReturnValues
                MACRO enumBDPAPI6enmMktReturnValues = LONG
                %ok                                                     = &H00000000
                %InternalError                                          = &HFFFFFFFF
                
                'Enumeration enmReturnValues
                MACRO enumBDPAPI6enmReturnValues = LONG
                %ok                                                     = &H00000000
                %InternalError                                          = &HFFFFFFFF
                
                'Enumeration enmRunnReturnValues
                MACRO enumBDPAPI6enmRunnReturnValues = LONG
                %ok                                                     = &H00000000
                %InternalError                                          = &HFFFFFFFF
                
                'Enumeration epts
                MACRO enumBDPAPI6epts = LONG
                %ep_ixGlobal                                            = &H00000000
                %ep_ixUK                                                = &H00000001
                %ep_ixAUS                                               = &H00000002
                %ep_ixVS                                                = &H00000003
                
                INTERFACE DISPATCH BDPAPI6RunnerPnL
                    MEMBER CALL CompareDynamicData<&H6003000B>(IN oPnL AS BDPAPI6RunnerPnL<&H00000000>) AS LONG
                    MEMBER CALL CopyObj<&H6003000C>(IN oPnL AS BDPAPI6RunnerPnL<&H00000000>) AS LONG
                    MEMBER CALL Serialize<&H6003000E>() AS STRING
                    MEMBER CALL Deserialize<&H6003000F>(IN strXML AS STRING<&H00000000>) AS enumBDPAPI6enmRunnReturnValues
                    MEMBER GET XMLValidationReason<&H6803000A>() AS STRING
                    MEMBER GET XMLValidationElement<&H68030009>() AS STRING
                    MEMBER GET SelectionId<&H68030008>() AS LONG
                    MEMBER GET sSelectionId<&H68030007>() AS STRING
                    MEMBER GET sIfWin<&H68030006>() AS STRING
                    MEMBER GET sIfLoss<&H68030005>() AS STRING
                    MEMBER CALL WriteElement<&H60030010>(IN ElementName AS STRING<&H00000000>, IN ElementValue AS STRING<&H00000001>, INOUT cnth AS DWORD<&H00000002>, INOUT atrs AS DWORD<&H00000003>)
                    MEMBER SET ParentRdr<&H68030003>()   'Parameter Type As BDPAPI6IVBSAXXMLReader
                    MEMBER SET ParentCnth<&H68030002>()   'Parameter Type As BDPAPI6IVBSAXContentHandler
                    MEMBER LET QuitElement<&H68030001>()   'Parameter Type As String
                    MEMBER LET ParentElement<&H68030000>()   'Parameter Type As String
                END INTERFACE
                
                INTERFACE DISPATCH BDPAPI6RunnerPrice
                    MEMBER CALL CompareDynamicData<&H6003000B>(IN oPriceParm AS BDPAPI6RunnerPrice<&H00000000>) AS LONG
                    MEMBER CALL CopyObj<&H6003000C>(IN oPriceParm AS BDPAPI6RunnerPrice<&H00000000>) AS LONG
                    MEMBER CALL Serialize<&H6003000D>() AS STRING
                    MEMBER GET sBetType<&H6803000A>() AS STRING
                    MEMBER LET sBetType<&H6803000A>()   'Parameter Type As String
                    MEMBER GET sDepth<&H68030009>() AS STRING
                    MEMBER LET sDepth<&H68030009>()   'Parameter Type As String
                    MEMBER GET sPrice<&H68030008>() AS STRING
                    MEMBER LET sPrice<&H68030008>()   'Parameter Type As String
                    MEMBER GET sAmount<&H68030007>() AS STRING
                    MEMBER LET sAmount<&H68030007>()   'Parameter Type As String
                    MEMBER CALL Deserialize<&H6003000E>(IN strXML AS STRING<&H00000000>) AS enumBDPAPI6enmRunnReturnValues
                    MEMBER GET XMLValidationReason<&H68030006>() AS STRING
                    MEMBER GET XMLValidationElement<&H68030005>() AS STRING
                    MEMBER CALL WriteElement<&H6003000F>(IN ElementName AS STRING<&H00000000>, IN ElementValue AS STRING<&H00000001>, INOUT cnth AS DWORD<&H00000002>, INOUT atrs AS DWORD<&H00000003>)
                    MEMBER SET ParentRdr<&H68030003>()   'Parameter Type As BDPAPI6IVBSAXXMLReader
                    MEMBER SET ParentCnth<&H68030002>()   'Parameter Type As BDPAPI6IVBSAXContentHandler
                    MEMBER LET QuitElement<&H68030001>()   'Parameter Type As String
                    MEMBER LET ParentElement<&H68030000>()   'Parameter Type As String
                END INTERFACE
                
                INTERFACE DISPATCH BDPAPI6RunnerPrices
                    MEMBER CALL CompareDynamicData<&H60030031>(IN oPricesParm AS BDPAPI6RunnerPrices<&H00000000>) AS LONG
                    MEMBER CALL CopyObj<&H60030032>(IN oPricesParm AS BDPAPI6RunnerPrices<&H00000000>) AS LONG
                    MEMBER CALL Add<&H60030033>() AS BDPAPI6RunnerPrice
                    MEMBER CALL AddBack<&H60030034>() AS BDPAPI6RunnerPrice
                    MEMBER CALL AddLay<&H60030035>() AS BDPAPI6RunnerPrice
                    MEMBER GET Back<&H68030030>(INOUT index AS INTEGER<&H00000000>) AS BDPAPI6RunnerPrice
                    MEMBER GET Lay<&H6803002F>(INOUT index AS INTEGER<&H00000000>) AS BDPAPI6RunnerPrice
                    MEMBER GET CountBack<&H6803002E>() AS LONG
                    MEMBER GET CountLay<&H6803002D>() AS LONG
                    MEMBER CALL RemoveBack<&H60030036>(INOUT index AS INTEGER<&H00000000>)
                    MEMBER CALL RemoveLay<&H60030037>(INOUT index AS INTEGER<&H00000000>)
                    MEMBER CALL Serialize<&H6003003A>() AS STRING
                    MEMBER CALL Deserialize<&H6003003B>(IN strXML AS STRING<&H00000000>) AS enumBDPAPI6enmRunnReturnValues
                    MEMBER GET XMLValidationReason<&H6803002C>() AS STRING
                    MEMBER GET XMLValidationElement<&H6803002B>() AS STRING
                    MEMBER GET sAsianLineID<&H6803002A>() AS STRING
                    MEMBER LET sAsianLineID<&H6803002A>()   'Parameter Type As String
                    MEMBER GET sHandicap<&H68030029>() AS STRING
                    MEMBER LET sHandicap<&H68030029>()   'Parameter Type As String
                    MEMBER GET sName<&H68030028>() AS STRING
                    MEMBER LET sName<&H68030028>()   'Parameter Type As String
                    MEMBER GET sSelectionId<&H68030027>() AS STRING
                    MEMBER LET sSelectionId<&H68030027>()   'Parameter Type As String
                    MEMBER GET SelectionId<&H68030026>() AS LONG
                    MEMBER GET sLastPriceMatched<&H68030025>() AS STRING
                    MEMBER LET sLastPriceMatched<&H68030025>()   'Parameter Type As String
                    MEMBER GET bVacant<&H68030024>() AS LONG
                    MEMBER LET bVacant<&H68030024>()   'Parameter Type As Long
                    MEMBER GET sTotalAmountMatched<&H68030023>() AS STRING
                    MEMBER LET sTotalAmountMatched<&H68030023>()   'Parameter Type As String
                    MEMBER GET MarketID<&H68030022>() AS LONG
                    MEMBER GET BackOdds1<&H68030021>() AS DOUBLE
                    MEMBER GET BackOdds2<&H68030020>() AS DOUBLE
                    MEMBER GET BackOdds3<&H6803001F>() AS DOUBLE
                    MEMBER GET BackStake1<&H6803001E>() AS CURRENCY
                    MEMBER GET BackStake2<&H6803001D>() AS CURRENCY
                    MEMBER GET BackStake3<&H6803001C>() AS CURRENCY
                    MEMBER GET LayOdds1<&H6803001B>() AS DOUBLE
                    MEMBER GET LayOdds2<&H6803001A>() AS DOUBLE
                    MEMBER GET LayOdds3<&H68030019>() AS DOUBLE
                    MEMBER GET LayStake1<&H68030018>() AS CURRENCY
                    MEMBER GET LayStake2<&H68030017>() AS CURRENCY
                    MEMBER GET LayStake3<&H68030016>() AS CURRENCY
                    MEMBER GET Warning1<&H68030015>() AS STRING
                    MEMBER GET Warning2<&H68030014>() AS LONG
                    MEMBER GET SuperEventID<&H68030013>() AS LONG
                    MEMBER GET HandiCap<&H68030012>() AS DOUBLE
                    MEMBER GET MarketTimestamp<&H68030011>() AS DOUBLE
                    MEMBER GET timestamp<&H68030010>() AS DOUBLE
                    MEMBER GET ProfitLoss<&H6803000F>(OPTIONAL IN dblCommRate AS DOUBLE<&H00000000>) AS CURRENCY
                    MEMBER GET PlaceLoss<&H6803000E>(OPTIONAL IN dblCommRate AS DOUBLE<&H00000000>) AS CURRENCY
                    MEMBER GET LastPriceTraded<&H6803000D>() AS DOUBLE
                    MEMBER GET TotalAmountMatched<&H6803000C>() AS CURRENCY
                    MEMBER GET UMPlaceLoss<&H6803000B>(OPTIONAL IN dblCommRate AS DOUBLE<&H00000000>) AS CURRENCY
                    MEMBER GET UnmatchedPosition<&H6803000A>(OPTIONAL IN dblCommRate AS DOUBLE<&H00000000>) AS CURRENCY
                    MEMBER GET FuturePosition<&H68030009>(OPTIONAL IN dblCommRate AS DOUBLE<&H00000000>) AS CURRENCY
                    MEMBER LET MarketID<&H68030022>()   'Parameter Type As Long
                    MEMBER LET BackOdds1<&H68030021>()   'Parameter Type As Double
                    MEMBER LET BackOdds2<&H68030020>()   'Parameter Type As Double
                    MEMBER LET BackOdds3<&H6803001F>()   'Parameter Type As Double
                    MEMBER LET BackStake1<&H6803001E>()   'Parameter Type As Currency
                    MEMBER LET BackStake2<&H6803001D>()   'Parameter Type As Currency
                    MEMBER LET BackStake3<&H6803001C>()   'Parameter Type As Currency
                    MEMBER LET LayOdds1<&H6803001B>()   'Parameter Type As Double
                    MEMBER LET LayOdds2<&H6803001A>()   'Parameter Type As Double
                    MEMBER LET LayOdds3<&H68030019>()   'Parameter Type As Double
                    MEMBER LET LayStake1<&H68030018>()   'Parameter Type As Currency
                    MEMBER LET LayStake2<&H68030017>()   'Parameter Type As Currency
                    MEMBER LET LayStake3<&H68030016>()   'Parameter Type As Currency
                    MEMBER LET Warning1<&H68030015>()   'Parameter Type As String
                    MEMBER LET Warning2<&H68030014>()   'Parameter Type As Long
                    MEMBER LET SuperEventID<&H68030013>()   'Parameter Type As Long
                    MEMBER LET HandiCap<&H68030012>()   'Parameter Type As Double
                    MEMBER LET MarketTimestamp<&H68030011>()   'Parameter Type As Double
                    MEMBER LET timestamp<&H68030010>()   'Parameter Type As Double
                    MEMBER LET LastPriceTraded<&H6803000D>()   'Parameter Type As Double
                    MEMBER LET TotalAmountMatched<&H6803000C>()   'Parameter Type As Currency
                    MEMBER LET ProfitLoss<&H6803000F>(OPTIONAL IN dblCommRate AS DOUBLE<&H00000000>)
                    MEMBER LET PlaceLoss<&H6803000E>(OPTIONAL IN dblCommRate AS DOUBLE<&H00000000>)
                    MEMBER LET UMPlaceLoss<&H6803000B>(OPTIONAL IN dblCommRate AS DOUBLE<&H00000000>)
                    MEMBER LET UnmatchedPosition<&H6803000A>(OPTIONAL IN dblCommRate AS DOUBLE<&H00000000>)
                    MEMBER GET sReductionFactor<&H68030008>() AS STRING
                    MEMBER LET sReductionFactor<&H68030008>()   'Parameter Type As String
                    MEMBER GET ReductionFactor<&H68030007>() AS DOUBLE
                    MEMBER LET sOrderIndex<&H68030006>()   'Parameter Type As String
                    MEMBER GET sOrderIndex<&H68030006>() AS STRING
                    MEMBER GET OrderIndex<&H68030005>() AS LONG
                    MEMBER CALL WriteElement<&H6003003C>(IN ElementName AS STRING<&H00000000>, IN ElementValue AS STRING<&H00000001>, INOUT cnth AS DWORD<&H00000002>, INOUT atrs AS DWORD<&H00000003>)
                    MEMBER SET ParentRdr<&H68030003>()   'Parameter Type As BDPAPI6IVBSAXXMLReader
                    MEMBER SET ParentCnth<&H68030002>()   'Parameter Type As BDPAPI6IVBSAXContentHandler
                    MEMBER LET QuitElement<&H68030001>()   'Parameter Type As String
                    MEMBER LET ParentElement<&H68030000>()   'Parameter Type As String
                END INTERFACE
                
                INTERFACE DISPATCH BDPAPI6ServiceProxy
                    MEMBER GET isTestBed<&H68030002>() AS LONG
                    MEMBER CALL Login<&H60030003>(IN sUserName AS STRING<&H00000000>, IN sPassWord AS STRING<&H00000001>, IN iProductID AS INTEGER<&H00000002>, OPTIONAL IN bTestBed AS LONG<&H00000003>, OPTIONAL IN iVendorID AS INTEGER<&H00000004>) AS LONG
                    MEMBER GET HeaderData<&H68030001>() AS BDPAPI6Header
                    MEMBER CALL GetSports<&H60030006>() AS BDPAPI6SportItems
                    MEMBER CALL KeepAlive<&H60030007>() AS LONG
                    MEMBER CALL Logout<&H60030008>() AS LONG
                    MEMBER CALL GetAccountFunds<&H6003000F>(IN iexch AS INTEGER<&H00000000>) AS BDPAPI6AccountFunds
                    MEMBER CALL GetEvents<&H60030010>(INOUT oBetEventItems AS DWORD<&H00000000>)
                    MEMBER CALL PlaceBetPage<&H60030011>(INOUT oBetItems AS DWORD<&H00000000>) AS LONG
                    MEMBER CALL UpdateBetPage<&H60030012>(INOUT oBetItems AS DWORD<&H00000000>) AS LONG
                    MEMBER CALL CancelBetPage<&H60030013>(INOUT oBetItems AS DWORD<&H00000000>) AS LONG
                    MEMBER CALL CancelBetsByMarket<&H60030014>(INOUT oMarketList AS DWORD<&H00000000>) AS LONG
                    MEMBER CALL GetMarket<&H60030015>(INOUT oMarket AS DWORD<&H00000000>) AS LONG
                    MEMBER CALL GetMarketPrices<&H60030016>(INOUT oMarket AS DWORD<&H00000000>) AS LONG
                    MEMBER CALL GetMarketPricesCompressed<&H60030017>(INOUT oMarket AS DWORD<&H00000000>) AS LONG
                    MEMBER CALL GetMarketPnL<&H60030018>(INOUT oMarket AS DWORD<&H00000000>, OPTIONAL INOUT bIncludeSettledBets AS LONG<&H00000001>, OPTIONAL INOUT bNetOfCommission AS LONG<&H00000002>) AS LONG
                    MEMBER CALL TransferFunds<&H60030019>(IN AmountParm AS DOUBLE<&H00000000>, IN iSourceParm AS INTEGER<&H00000001>, OPTIONAL IN iDestParm AS INTEGER<&H00000002>) AS LONG
                    MEMBER CALL GetRunnerTradedVolume<&H6003001A>(INOUT oMarket AS DWORD<&H00000000>, INOUT oRunner AS DWORD<&H00000001>) AS LONG
                    MEMBER CALL GetAllCurrentBets<&H6003001B>(OPTIONAL INOUT oMarket AS DWORD<&H00000000>, OPTIONAL INOUT sBetStatus AS STRING<&H00000001>, OPTIONAL INOUT sOrderBy AS STRING<&H00000002>, OPTIONAL INOUT pageSize AS INTEGER<&H00000003>, _
                        OPTIONAL IN iexch AS enumBDPAPI6epts<&H00000004>) AS BDPAPI6BetItems
                    MEMBER CALL CalcAvgs<&H6003001C>(INOUT oMarket AS DWORD<&H00000000>) AS VARIANT
                    MEMBER CALL GetCurrentBets<&H6003001D>(OPTIONAL INOUT oMarket AS DWORD<&H00000000>, OPTIONAL INOUT sBetStatus AS STRING<&H00000001>, OPTIONAL INOUT sOrderBy AS STRING<&H00000002>, OPTIONAL INOUT recordCount AS INTEGER<&H00000003>, _
                        OPTIONAL INOUT StartRecord AS INTEGER<&H00000004>, OPTIONAL IN iExchParm AS enumBDPAPI6epts<&H00000005>) AS BDPAPI6BetItems
                    MEMBER CALL GetMUBetsPage<&H6003001E>(OPTIONAL INOUT oMarket AS DWORD<&H00000000>, OPTIONAL INOUT sBetStatus AS STRING<&H00000001>, OPTIONAL INOUT sOrderBy AS STRING<&H00000002>, OPTIONAL INOUT sAscDesc AS VARIANT<&H00000003>, _
                        OPTIONAL INOUT recordCount AS INTEGER<&H00000004>, OPTIONAL INOUT StartRecord AS INTEGER<&H00000005>) AS BDPAPI6BetItems
                    MEMBER CALL GetBet<&H6003001F>(IN sBetId AS STRING<&H00000000>, IN iexch AS INTEGER<&H00000001>) AS BDPAPI6Bet
                    MEMBER CALL GetAcctStmt<&H60030020>(IN sInclude AS STRING<&H00000000>, IN ixEP AS enumBDPAPI6epts<&H00000001>, OPTIONAL IN startDate AS VARIANT<&H00000002>, OPTIONAL IN endDate AS VARIANT<&H00000003>) AS BDPAPI6AcctStmtItems
                    MEMBER CALL ConvertCurrency<&H60030022>(IN CurrencyCodeFromParm AS STRING<&H00000000>, IN CurrencyCodeToParm AS STRING<&H00000001>, IN AmountParm AS DOUBLE<&H00000002>) AS DOUBLE
                    MEMBER CALL GetProfile<&H60030023>() AS BDPAPI6clsProfile
                    MEMBER CALL AddVendorSubscription<&H60030024>(IN sUserNameParm AS STRING<&H00000000>, OPTIONAL IN dExpiryDateParm AS DOUBLE<&H00000001>) AS BDPAPI6clsVSAdd
                    MEMBER CALL isLoggedOn<&H60030025>() AS LONG
                    MEMBER LET iVendorID<&H68030000>()   'Parameter Type As Long
                    MEMBER GET iVendorID<&H68030000>() AS LONG
                END INTERFACE
                
                
                INTERFACE DISPATCH BDPAPI6SportItems
                    MEMBER CALL Add<&H6003000B>() AS BDPAPI6Sport
                    MEMBER GET Item<&H6803000A>(INOUT index AS INTEGER<&H00000000>) AS BDPAPI6Sport
                    MEMBER GET Count<&H68030009>() AS LONG
                    MEMBER CALL Remove<&H6003000C>(INOUT index AS INTEGER<&H00000000>)
                    MEMBER GET NewEnum<&HFFFFFFFC>() AS BDPAPI6IUnknown
                    MEMBER CALL Serialize<&H6003000F>(INOUT nsPrefix AS STRING<&H00000000>) AS STRING
                    MEMBER CALL Deserialize<&H60030010>(IN strXML AS STRING<&H00000000>) AS enumBDPAPI6enmReturnValues
                    MEMBER GET XMLValidationReason<&H68030008>() AS STRING
                    MEMBER GET XMLValidationElement<&H68030007>() AS STRING
                    MEMBER LET errorCode<&H68030006>()   'Parameter Type As String
                    MEMBER GET errorCode<&H68030006>() AS STRING
                    MEMBER GET timestamp<&H68030005>() AS DOUBLE
                    MEMBER LET timestamp<&H68030005>()   'Parameter Type As Double
                    MEMBER CALL WriteElement<&H60030011>(IN ElementName AS STRING<&H00000000>, IN ElementValue AS STRING<&H00000001>, INOUT cnth AS DWORD<&H00000002>, INOUT atrs AS DWORD<&H00000003>)
                    MEMBER SET ParentRdr<&H68030003>()   'Parameter Type As BDPAPI6IVBSAXXMLReader
                    MEMBER SET ParentCnth<&H68030002>()   'Parameter Type As BDPAPI6IVBSAXContentHandler
                    MEMBER LET QuitElement<&H68030001>()   'Parameter Type As String
                    MEMBER LET ParentElement<&H68030000>()   'Parameter Type As String
                END INTERFACE

                Comment

                • Aitor
                  Junior Member
                  • Nov 2009
                  • 8

                  #293
                  Hello!the problem about the program its that, if i want to kwon the first player who score a gol in a football match i recived that:
                  HeaderCode = OK
                  ErrorCode = OK
                  MarketId = 101124175
                  Name = Goleadores
                  Status = ACTIVE
                  2330639 Roberto Soldado
                  2702485 Manu Del Moral
                  4150518 Miku
                  2524567 Juan Albin
                  2770201 Pedro Leon
                  2425009 Javier Casquero
                  3245044 Daniel Parejo
                  4178460 Derek Boateng
                  4178494 Pedro Rios
                  2812962 Mane
                  431467 Luis Fabiano
                  2307223 Frederic Kanoute
                  2324906 Diego Capel
                  2307229 Jesus Navas
                  3718558 Diego Perotti
                  3594093 Romaric
                  867337 Renato
                  2399821 Aldo Duscher
                  2346123 Didier Zokora
                  2342022 Julien Escude
                  HeaderCode = OK
                  ErrorCode = OK
                  101124175 20 runners
                  0 2330639 10,01 2,62
                  1 2702485 0 0
                  2 4150518 8,01 3,4
                  3 2524567 0 0
                  4 2770201 9,99 4,3
                  5 2425009 0 0
                  6 3245044 0 0
                  7 4178460 0 0
                  8 4178494 0 0
                  9 2812962 0 0
                  10 431467 4 2,62
                  11 2307223 0 0
                  12 2324906 0 0
                  13 2307229 4 5
                  14 3718558 0 0
                  15 3594093 0 0
                  16 867337 0 0
                  17 2399821 0 0
                  18 2346123 0 0
                  19 2342022 0 0
                  and i use this function and then i print it in a text label,

                  Private Function Buscador(ByVal f1 As Date, ByVal f2 As Date, ByVal equipo As String, ByVal cod As Long, ByVal pais As String) As List(Of MarketDataType)
                  Print("*** Buscador ***")
                  Dim Names As String(), Equipos As New List(Of MarketDataType)
                  Dim oMarketsReq As New BFUK.GetAllMarketsReq
                  Dim oMarketsResp As BFUK.GetAllMarketsResp
                  With oMarketsReq
                  .header = oHeaderUK()
                  ReDim .eventTypeIds(0) : .eventTypeIds(0) = cod
                  ReDim .countries(0) : .countries(0) = pais
                  .fromDate = f1
                  .toDate = f2
                  End With
                  oMarketsResp = BetFairUK.getAllMarkets(oMarketsReq)
                  With BetFairUK.getAllMarkets(oMarketsReq) 'llamada a getAllMarkets
                  CheckHeader(.header)
                  Print("ErrorCode = " & .errorCode.ToString)

                  If .errorCode = BFUK.GetAllMarketsErrorEnum.OK Then
                  Dim AllMarkets As New UnpackAllMarkets(.marketData)
                  With AllMarkets
                  For i = 0 To .marketData.Length - 1
                  If .marketData(i).menuPath.Contains(equipo) Then
                  Names = .marketData(i).menuPath.Split("\") 'Lo filtramos segun su /
                  Equipos.Add(.marketData(i)) 'Añadir un mercado a la lista
                  End If
                  Next
                  End With
                  Equipos.Sort(New CompareMarketTimes) 'Ordenamos los mercados por fecha
                  End If
                  End With
                  Return (Equipos)
                  End Function


                  why is happening that????

                  Comment

                  • Mumbles0
                    Junior Member
                    • Jan 2009
                    • 240

                    #294
                    Aitor,

                    You have called getMarket for marketId 101124175 which was the “To Score” (Goleadores) market. Perhaps you should have used 101124158 which was the “First goalscorer” (Prima goleador) market.

                    Your program has printed a list of selectionIds and runner names for the market. I guess what follows is list of data from a getMarketPricesCompressed call (.sortOrder, .selectionId and some other values).

                    What’s wrong with that ?

                    Your program only does what you tell it to do. This is not always what you would like it to do.

                    __________________________________________________ ___________


                    Function Buscador seems OK. It returns a list of MarketDataType objects only for markets which have the team name equipo contained in the menuPath.

                    There is one problem: getAllMarkets is being called twice with these 2 lines:

                    Code:
                    oMarketsResp = BetfairUK.getAllMarkets(oMarketsReq)                 ‘<<< not required
                    With BetfairUK.getAllMarkets(oMarketsReq)    'llamada a getAllMarkets
                    The first line is not required. You should remove it.

                    Comment

                    • Mumbles0
                      Junior Member
                      • Jan 2009
                      • 240

                      #295
                      Reply to waldjunge (re: BDPAPI6.dll)

                      VB2008 (VB.NET) does not use BDPAPI6.dll. It is for VB6 and VBA.

                      You might get a response if you ask your question in the VB6 and Excel forum.

                      Comment

                      • John Moore
                        Junior Member
                        • Feb 2009
                        • 3

                        #296
                        Hi Mumbles,
                        I`ve written a VB2008 program and it has been working fine up until this week. I now get this error when trying to log on.

                        The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

                        Have you any ideas why and how to solve it?

                        Kind regards,
                        John Moore

                        Comment

                        • Monairda
                          Junior Member
                          • Jan 2009
                          • 32

                          #297
                          I would like to know the matching money for each price.Is it possible?

                          Hi Mumbles,

                          Is there a method in the free API that we return the values listed in this direction?

                          http://uk.site.sports.betfair.com/be...r&currency=EUR

                          Can it be done with the Step 24. Calling getMarketTradedVolumeCompressed?

                          I would like to know the matching money for each price.Is it possible?

                          Many thanks for your help

                          Comment

                          • Mumbles0
                            Junior Member
                            • Jan 2009
                            • 240

                            #298
                            Re: getMarketTradedVolumeCompressed

                            Yes.

                            getMarketTradedVolumeCompressed returns the values shown in the Traded column for the runner.

                            You can use the code of Step 24 to unpack the data. The traded (i.e. matched) amounts at each price are the .totalMatchedAmount values in the tradedVolume array. The .odds values are the prices.

                            The values shown in the To back and To lay columns can be obtained by calling getCompleteMarketPricesCompressed (see Step 10).
                            Last edited by Mumbles0; 03-03-2010, 09:31 PM. Reason: Call getCompleteMarketPricesCompressed for back & lay amounts.

                            Comment

                            • Monairda
                              Junior Member
                              • Jan 2009
                              • 32

                              #299
                              Mumbles,

                              Thank you very much for your help!

                              I would like to make the following table:

                              Marketid | SelectionId | totalAmountMatched | lastPriceMatched | bestPricesToBack(0).price | bestPricesToBack(0).amountAvailable | Sum(tradedVolume(j).totalMatchedAmount) = sum up lastpricedMatched | Sum(tradedVolume(j).totalMatchedAmount)= sum from lastpricedMatched

                              Example:

                              Selectionid Odds totalMatchedAmount
                              3031054 2.38 2.31
                              3031054 2.44 4.29
                              3031054 2.5 4.4
                              3031054 2.7 6.65
                              3031054 2.72 4.38
                              3031054 2.76 12.84
                              3031054 2.9 4.38
                              3031054 3.65 5.5
                              3031054 4.6 6.6
                              3031054 4.7 0.04
                              3031054 4.8 4.38
                              3031054 4.9 4.38

                              LastpricedMatched=2,9
                              Sum(tradedVolume(j).totalMatchedAmount) = sum up lastpricedMatched = 39.25
                              Sum(tradedVolume(j).totalMatchedAmount) = sum from lastpricedMatched = 20.9


                              I would have to perform the following steps.

                              Step 1.
                              Call getMarketPricesCompressed

                              Step 2.
                              Call getMarketTradeVolumeCompressed

                              Step 3.
                              Through the data in step 1 and find the selectionId in step 2

                              But I have a question, how can I do to get back a DataTable with the call to getMarketPricesCompressed or with the call to getMarketTradeVolumeCompressed?

                              If I have two datatable I could cross the information from two tables and create one

                              Thanks
                              Last edited by Monairda; 03-03-2010, 09:43 AM.

                              Comment

                              • Mumbles0
                                Junior Member
                                • Jan 2009
                                • 240

                                #300
                                Monairda,

                                My previous post was not correct (it is now). You call getCompleteMarketPricesCompressed to get the complete list of To back & To lay prices and amounts. getMarketPricesCompressed returns only the top 3 back and lay values.

                                Comment

                                Working...
                                X