C# API6 Example Aplication (Async)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • wee_mick05
    Junior Member
    • Jun 2009
    • 1

    #31
    Hi,

    I'm quite a beginner with C# - no educational background in programming but I am usually pretty quick to pick things up when I am making a little progress at a time.

    Anyway this example has been very good for me, I have now modified it significantly to perform very useful functions for me. One of the biggest remaining issues left for me is that when i try to place a bet in running the placebet method times out due to the 5-7 second delay.

    So a few seconds after it executes this

    "CSharpAPI6.betfair.api.exchange.PlaceBetsResp resp = m_simpleAPIWrapper.BFExchangeService.placeBets(req );"

    I get an error if there is a bet delay - I imagine this is because it hasn't received resp in the time expected.

    Any idea how to set an execution timeout time of about 10 secs on this?

    thanks,
    Mick

    Comment

    • jlsonic
      Junior Member
      • Mar 2010
      • 1

      #32
      Originally posted by wee_mick05 View Post
      Hi,

      Any idea how to set an execution timeout time of about 10 secs on this?
      Maybe, the class SimpleAPIWrapper, it has some TimeOut var (millisecond)
      Last edited by jlsonic; 25-03-2010, 12:05 PM.

      Comment

      • Werewolf
        Junior Member
        • Sep 2009
        • 2

        #33
        Different prices to webpage

        When i try to get prices for some markets i get different numbers from what i see on the webpage.
        I went through the code and it seems that incorrect prices are returned from api, so does it there is a bug or it is due to limited functionality of Free API?

        Thanks

        Comment

        • vossie
          BDP Team
          • Sep 2008
          • 40

          #34
          Originally posted by Werewolf View Post
          When i try to get prices for some markets i get different numbers from what i see on the webpage.
          I went through the code and it seems that incorrect prices are returned from api, so does it there is a bug or it is due to limited functionality of Free API?

          Thanks
          See http://bdp.betfair.com/index.php?opt...=242&Itemid=68
          and http://bdp.betfair.com/index.php?opt...=237&Itemid=62
          "Why don't you just fix your little problem and light this candle?" - Alan B. Shepard, Jr

          Comment

          • Werewolf
            Junior Member
            • Sep 2009
            • 2

            #35
            Decided to ask here as well, as spent a lot of time trying to understand this particular issue:
            when trying to add GetAccountStatement or GetBetHistory functions to my application i get NullReference Exception on
            Code:
            return simpleAPIWrapper.BFExchangeServiceByExchange(exchangeId).BegingetAccountStatement(request, GetAccountStatementAsyncCallback, myAsyncStateContainer);
            Full code of function is:
            Code:
                        string session = SessionTokenManager.GetSessionToken();
                        int exchangeId = 0;
            
                        // If no session, log in and get another one
                        if (session == null)
                        {
                            session = MakeSession();
                        }
            
                        GetAccountStatementReq request = new GetAccountStatementReq();
            
            
                        request.header = new BetFairMine.betfair.api.exchange.APIRequestHeader();
                        request.header.sessionToken = session;
                        request.startRecord = 0;
                        request.recordCount = 100;
                        request.startDate = DateTime.Parse("2010-03-01");
                        request.endDate = DateTime.Parse("2010-04-18");
                        request.itemsIncluded = AccountStatementIncludeEnum.ALL;
            
            
                        //  request.marketId = marketID;
            
                        var myAsyncStateContainer = new CustomAsyncStateContainer(exchangeId, this, new object[] { exchangeId }, DateTime.Now);
            and i have the following defined as well :
            Code:
               private delegate void GetAccountStatementAsyncCallbackDelegate(IAsyncResult result);
            
                    private void GetAccountStatementAsyncCallback(IAsyncResult result)
            Is there an example with correct calls for this functionality?

            Comment

            • hammad
              Junior Member
              • Apr 2010
              • 1

              #36
              if the price On bet fair is

              Blank Blank 2.1 - 2.2 2.3 2.4 ,

              using GetmarketepricesCompressed its getting

              2.1 2.2 2.3 - 2.4 Blank Blank

              any Idea how to get 0 instead of less items in list of prices of back and lay

              Comment

              • sn4k3
                Junior Member
                • Sep 2010
                • 1

                #37
                whats the difference between API6 example Login methods, delegates VS LoginAsync ?

                Thanks

                Comment

                • purtieus.
                  Junior Member
                  • Nov 2010
                  • 4

                  #38
                  vs2010 async problem

                  Hi,

                  Just writing a c# async app within visual studio 2010, actually for the windows phone 7.

                  When I call loginasync I get a "not found" error, code is :-

                  //Logon To BetFair Account
                  BetFairGlobal.LoginReq LoginRequest = new BetFairGlobal.LoginReq();

                  //Setup Header Info
                  LoginRequest.productId = 82;
                  LoginRequest.locationId = 0;
                  LoginRequest.username = "xxx";
                  LoginRequest.password = "xxx";
                  LoginRequest.vendorSoftwareId = 0;

                  //Create New Login Client
                  BetFairGlobal.BFGlobalServiceClient myclient = new BetFairGlobal.BFGlobalServiceClient();

                  //Define New Handler For LoginCompleted
                  myclient.loginCompleted += new EventHandler<BetFairGlobal.loginCompletedEventArgs >(client_login_loginCompleted);

                  //Async Call To Betfair - With Unique ID
                  myclient.loginAsync(LoginRequest, Guid.NewGuid().ToString());


                  If doesn't get to the callback, I just get an error :-

                  System.ServiceModel.EndpointNotFoundException was unhandled
                  Message=There was no endpoint listening at https://api.betfair.com/global/v3/BFGlobalService that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

                  Message=The remote server returned an error: NotFound.


                  Anyone any ideas where to look?

                  Thanks

                  Comment

                  • astravan
                    Junior Member
                    • May 2011
                    • 1

                    #39
                    Thanks for posting this fix - it saved me a lot of fiddling around.

                    For those that are unsure what this fixed: Previously, if there were less than 3 back prices the lay prices were being shifted over and shown as back prices.

                    Comment

                    • Lightforik
                      Junior Member
                      • Oct 2011
                      • 1

                      #40
                      Hi. I want to get specific information about the market: the graph of the changing prices of Matched bets for current Event( for winning Ivan Dodig on the image):


                      I didn't how to get it. In ideal case it will be array of matched bets.

                      And also one question on this subject: how to get array of prices - traded sum( column Traded in betfair site).

                      Comment

                      • qasimraza
                        Junior Member
                        • Jul 2011
                        • 1

                        #41
                        Product Requires Funded Account

                        Hi.
                        I Am Using This Application. And I have Select 82 Product ID that is free API.
                        I am logging in with my ID and Password. It Has 15 Euro in it.
                        And Application Returning Me Error That is
                        "Product Requires Funded Account"

                        Can Anyone Please Tell Me, Why This Is Or There is Limit To Have Amount in Account Mean Minimum Account Balance to use this API.

                        Your Support Will Be Appreciated.
                        Thanks

                        Comment

                        • kawafan
                          Junior Member
                          • May 2011
                          • 33

                          #42
                          Originally posted by qasimraza View Post
                          Hi.
                          I Am Using This Application. And I have Select 82 Product ID that is free API.
                          I am logging in with my ID and Password. It Has 15 Euro in it.
                          And Application Returning Me Error That is
                          "Product Requires Funded Account"

                          Can Anyone Please Tell Me, Why This Is Or There is Limit To Have Amount in Account Mean Minimum Account Balance to use this API.

                          Your Support Will Be Appreciated.
                          Thanks
                          i think you haven't placed any bet since 3 months

                          so try placing a bet from betfair website and try again

                          Comment

                          • huongung
                            Junior Member
                            • Nov 2011
                            • 1

                            #43
                            Missing Lay prices in football markets

                            I've noticed that when using API6 and the sample c# app, some of the lay prices are missing when you call GetMarketPrices and GetMarketPricesCompressed.

                            I examined the returned responses and the prices are not listed which means the API is not sending them.

                            I've attached example screenshots showing what prices were on the website vs those displayed in the app.

                            Is this an API bug?


                            Thanks
                            Attached Files

                            Comment

                            • kawafan
                              Junior Member
                              • May 2011
                              • 33

                              #44
                              Originally posted by huongung View Post
                              I've noticed that when using API6 and the sample c# app, some of the lay prices are missing when you call GetMarketPrices and GetMarketPricesCompressed.

                              I examined the returned responses and the prices are not listed which means the API is not sending them.

                              I've attached example screenshots showing what prices were on the website vs those displayed in the app.

                              Is this an API bug?


                              Thanks
                              Actually

                              Sometime there is no amount to lay or Back so betfair on website shows Blank Blocks on them

                              same here but its not sorted .

                              when you are converting from compressed prices you are ignoring blanks and just showing all prices from runner block 0

                              sorry for bad English

                              Comment

                              • litachugga
                                Junior Member
                                • Aug 2013
                                • 1

                                #45
                                CSharpAPI6 : getAllMarkets returns null.

                                Hello Everyone,

                                I am trying to write a bot that retrieves prices from several currently active markets (active horse-racing markets only). I have been modifying the CSharpAPI6 code which is excellent by the way. Now I am having the following problem:

                                The function mentioned below (GetAllRaceMarkets), works fine in the beginning for 20-30 calls, but then starts returning null response. I have made sure that I am not crossing the throttle limit (called once every 15 seconds max), but still I have the same issue. Can anyone please tell me what is going wrong?


                                Code:
                                private CSharpAPI6.betfair.api.exchange.GetAllMarketsResp GetAllRaceMarkets()
                                        {
                                            // Get session from session manager
                                            string session = SessionTokenManager.GetSessionToken();
                                
                                            // If no session, log in and get another one
                                            if (session == null)
                                            {
                                                session = this.mainForm.MakeSession();
                                            }
                                
                                            CSharpAPI6.betfair.api.exchange.GetAllMarketsReq request = new betfair.api.exchange.GetAllMarketsReq();
                                            request.header = new CSharpAPI6.betfair.api.exchange.APIRequestHeader();
                                            request.header.sessionToken = session;
                                
                                
                                            request.eventTypeIds = new int?[1] { 7 };
                                            request.countries = new string[2] { "GBR", "IRL" };
                                            request.fromDate = DateTime.Now;
                                            request.toDate = DateTime.Now.AddHours(12);// AddDays(1);
                                
                                            try
                                            {
                                                CSharpAPI6.betfair.api.exchange.GetAllMarketsResp resp = simpleAPIWrapper.BFExchangeServiceByExchange(GlobalDefs._UK_EXCHANGE_ID).getAllMarkets(request);
                                                if (resp != null && resp.header != null && resp.header.sessionToken != null)
                                                    SessionTokenManager.ReturnSessionToken(resp.header.sessionToken);
                                                return resp;
                                            }
                                            catch
                                            {
                                                return null;
                                            }
                                        }

                                Comment

                                Working...
                                X