C# API6 Example Aplication (Async)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • dlinder
    Junior Member
    • Feb 2009
    • 2

    #16
    Discovered a bug btw:
    if (runnerPrices.bestPricesToLay != null && runnerPrices.bestPricesToLay.Length > 2)
    {
    layPrice3 = runnerPrices.bestPricesToLay[2].price;
    layAmountAvailable2 = runnerPrices.bestPricesToLay[2].amountAvailable;
    }
    Code from frmMain.cs, and the layAmountAvailable2 should be changed to layAmountAvailable3. As it is, the second lay level uses third level amounts, and third level is zeroed.

    Hope this helps someone

    Comment

    • Puru
      Junior Member
      • Jul 2009
      • 1

      #17
      Having similiar problems as dlinder with the sample app and my freshly installed visual c# 2008 (express edition), but with slightly different error message (see attached picture).

      Also solved by unchecking "use compressed prices" in the login dialog, but would like to understand the reason for the behaviour...
      Attached Files

      Comment

      • nYury
        Junior Member
        • Apr 2009
        • 2

        #18
        Error

        Why the program displays an error message CSharpAPI6.betfair.api.global.APIErrorEnum.PRODUCT _REQUIRES_FUNDED_ACCOUNT? I there is money.

        Comment

        • TheBotanist
          Junior Member
          • Aug 2009
          • 1

          #19
          Originally posted by KilburnKen View Post
          Fix for displaying getMarketPricesCompressed



          In the following procedure

          private void DisplayGetMarketPricesCompressed


          zeroise the prices and amounts outside of the loop


          int count = 0;

          while (count <= 5)
          {
          Price[count] = 0;
          Size[count] = 0;

          count++;
          }

          count = 0;





          Within the loop
          Put available to back in 0,1, and 2
          Put available to lay in 3,4 and 5


          foreach
          (Betfair.DataTypes.Sports.MarketPricesInfoDemo.Sel ectionPricesInfo.OddsAvailablePriceInfo odds in runnerPrices.PriceInfo.Values)
          {


          if (odds.LayAmountAvailable > 0)
          {
          if (count < 3)
          {
          count = 3;
          }
          }

          Price[count] = odds.Odds;

          // Size[count] = 0;







          Just after exiting from the loop
          Check the available to backs
          And move the prices and amounts up if less than 3 columns

          count++;
          }






          if (Price[2] == 0)
          {
          Price[2] = Price[1];
          Size[2] = Size[1];
          Price[1] = Price[0];
          Size[1] = Size[0];
          Price[0] = 0;
          Size[0] = 0;
          }


          if (Price[2] == 0)
          {
          Price[2] = Price[1];
          Size[2] = Size[1];
          Price[1] = 0;
          Size[1] = 0;
          }




          In the procedure private void timer1_Tick(

          The following code

          if (simpleAPIWrapper.marketResp.market.marketId > 0)
          {
          if (this.simpleAPIWrapper.useCompressedPrices)
          {
          GetMarketPricesCompressedAsyncRequest();
          }
          else
          GetMarketPricesAsyncRequest();

          Could do to be wrapped within a try/catch block
          Hi
          Exactly what does this fix? Was it always wrong or is it a fix to keep track with a change in the betfair system?

          Comment

          • Gartner
            Junior Member
            • Sep 2009
            • 4

            #20
            Hello,

            I'm testing this app on VS2008 (no SP1 upgrade) but when i try to login, i've got always a system.security.authentification error, certificate not valid.
            My username and pass are correct.

            Im unable to solve it and not sure where to search!
            Tried to close firewall with no result.
            Could someone help me or point me to the right direction coz im quite a noob using web service under dotnet.

            Thx
            Last edited by Gartner; 29-09-2009, 03:29 AM.

            Comment

            • Drifter
              Junior Member
              • Mar 2009
              • 30

              #21
              I can't help with the specific error, but I think in some ways you answer your own question - get the SP1 applied, and also any .NET upgrades then try again. I can't see any obvious reason to not apply the updates.

              I get lots of certificate errors on my ISP login (basically they re-direct to a login page using an illegal certificate which then causes Firefox (3.5.3) and IE8 to complain about phishing attacks) but once I'm past that, my login to BF goes pretty smoothly. If you have VS2008 correctly up-to-date, it might identify better where these issues could be coming from, if not from VS itself.

              Comment

              • Gartner
                Junior Member
                • Sep 2009
                • 4

                #22
                You got it!

                Simply upgrade to SP1 solved my login problem.

                Thank you.

                Comment

                • Gartner
                  Junior Member
                  • Sep 2009
                  • 4

                  #23
                  Originally posted by Puru View Post
                  Having similiar problems as dlinder with the sample app and my freshly installed visual c# 2008 (express edition), but with slightly different error message (see attached picture).

                  Also solved by unchecking "use compressed prices" in the login dialog, but would like to understand the reason for the behaviour...
                  I've got same problem, i've got windows in french.

                  The reason of this problem is on System.Globalization.CultureInfo, certainly decimal format or maybe date.

                  To solve it for test i just change culture info in my windows config:


                  1. Open the Regional and Language Options applet from the Control Panel.
                  2. Note the Current Format.
                  3. Change the Current Format to English (UK)

                  Be sure to close VS before changing culture info or it will have no effect until next VS restart.

                  This is quite tricky and im searching for changing the culture info directly in the source code without to have to change all the windows globalization settings.
                  Coz im sure it will affect some of my others software and can cause bugs.

                  If someone could help, it will be really appreciated, thx.

                  PS: this is the line in frmMain.cs thats returning me an error:

                  Betfair.DataTypes.Sports.MarketPricesInfoDemo MarketPricesInfo = new Betfair.DataTypes.Sports.MarketPricesInfoDemo(resp );

                  Comment

                  • Mumbles0
                    Junior Member
                    • Jan 2009
                    • 240

                    #24
                    Re: Decimal number culture.

                    Gartner...

                    I think you might be having a problem with the decimal separator when unpacking decimal numbers in compressed strings. Some cultures expect "," but Betfair uses "."

                    Try changing the code line suggested by tagorac in this post.

                    Comment

                    • Gartner
                      Junior Member
                      • Sep 2009
                      • 4

                      #25
                      Thank you Mumbles, i appreciate.

                      Comment

                      • MuxoHIvanov.
                        Junior Member
                        • Dec 2009
                        • 3

                        #26
                        Error List correct format

                        Hello.
                        Code:
                        public string strfloatparse(string str)
                                    {
                                        return str.Replace('.', ',');
                                    }
                        And in each method where it is necessary to receive from a line type double or float simply to substitute a method call.

                        It is possible to make more universally even more, it is direct in a separate method all to receive and catch with the help try and cath and to return already ready necessary type.
                        Last edited by MuxoHIvanov.; 17-12-2009, 06:26 PM.

                        Comment

                        • MuxoHIvanov.
                          Junior Member
                          • Dec 2009
                          • 3

                          #27
                          Code of rate

                          To clean the reason odds 1.01 in a rate window it is possible a following way!
                          Code:
                          public string strfloatparse(string str)
                                  {
                                      return str.Replace('.', ',');
                                  }
                          
                          private void btnBack_Click(object sender, System.EventArgs e)
                          		{
                          			Button pressedButton = (Button)sender;
                          			
                                      int marketId=0;
                          			int runnerId=0;
                          			int asianLineId=0;
                                      int exchangeId = 0;
                          
                                      string MyPrice = "";
                                      for (int i = 0; i < pressedButton.Text.ToString().IndexOf("\n", 0); i++)
                                      {
                                          MyPrice = MyPrice + pressedButton.Text.ToString()[i].ToString();
                                      }
                          			double backPrice= 1.01;
                          			try
                          			{
                                          backPrice = Convert.ToDouble(MyPrice);
                          			}
                          			catch
                          			{
                                          backPrice = Convert.ToDouble(strfloatparse(MyPrice));
                                      }
                          
                          			marketId	= m_market.marketId;
                          			runnerId	= m_runner.selectionId;
                          			asianLineId = m_runner.asianLineId;
                                      exchangeId = m_market.licenceId;
                          			
                          
                          			using (frmPlacebet sbm = new frmPlacebet(marketId, runnerId, asianLineId,"B", backPrice, m_simpleAPIWrapper))
                          			{
                          				sbm.ShowDialog();
                          				sbm.Dispose();
                          			}
                          		}
                          It is possible to use already created method public static string NextField(string compressed_prices, char delimiter, ref int iterator) instead of
                          Code:
                          string MyPrice = "";
                                      for (int i = 0; i < pressedButton.Text.ToString().IndexOf("\n", 0); i++)
                                      {
                                          MyPrice = MyPrice + pressedButton.Text.ToString()[i].ToString();
                                      }
                          Last edited by MuxoHIvanov.; 17-12-2009, 06:27 PM.

                          Comment

                          • MuxoHIvanov.
                            Junior Member
                            • Dec 2009
                            • 3

                            #28
                            Help please!

                            How to learn the bank rest? Lay out please a code.

                            Comment

                            • stels
                              Junior Member
                              • Jan 2010
                              • 2

                              #29
                              Originally posted by Mumbles0 View Post
                              Gartner...

                              I think you might be having a problem with the decimal separator when unpacking decimal numbers in compressed strings. Some cultures expect "," but Betfair uses "."

                              Try changing the code line suggested by tagorac in this post.
                              It does not help. But the option is specified Gartner works well.

                              Excellent application! Great job! I'm not a programmer but would like something to help society.... but what?

                              Comment

                              • stels
                                Junior Member
                                • Jan 2010
                                • 2

                                #30
                                Вuring debugging sometimes fails (screenshot). What is bred? How to solve it? help me please!
                                Attached Files

                                Comment

                                Working...
                                X