INVALID_BET_SIZE error driving me mad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jsbf
    Junior Member
    • May 2015
    • 7

    #1

    INVALID_BET_SIZE error driving me mad

    Can someone please help me with this?

    I've been trying to place a bet, but I always get an error with INVALID_BET_SIZE, regardless of the size of the bet. This doesn't happen with back bets, I can place those, no problem.

    request body:
    Code:
    "{
    \"marketId\":\"1.118993080\",
    \"instructions\":[{
       \"orderType\":\"LIMIT_ON_CLOSE\",
       \"selectionId\":8543681,
       \"side\":\"LAY\",
       \"limitOnCloseOrder\":{
          \"liability\":2.0,
          \"price\":4.4
          }
       }]
    }"]

    response body:
    Code:
    "{
       \"status\":\"FAILURE\",
       \"errorCode\":\"BET_ACTION_ERROR\",
       \"marketId\":\"1.118993080\",
       \"instructionReports\"[{
       \"status\":\"FAILURE\",
       \"errorCode\":\"INVALID_BET_SIZE\",
       \"instruction\":{
          \"selectionId\":8543681,
          \"limitOnCloseOrder\":{
             \"liability\":2.0,\
             "price\":4.4
             },
             \"orderType\":\"LIMIT_ON_CLOSE\",
             \"side\":\"LAY\"
          }
       }]
    }"
    Just to make it clear, it's not placing the bet at all. I seem to recall a thread where the bet was being placed but the error code would say otherwise, this is not the case. The bet isn't being placed at all.

    I can't begin to figure out what is going on here. Has anybody had this type of problem while placing lay bets? How did you worked around it?
  • dashee
    Junior Member
    • May 2015
    • 6

    #2
    I'm still relatively new to this stuff (this is my first post) and I've never tried LIMIT_ON_CLOSE bets. But could the problem be your liability on the bet. Since the price is 4.4 and your liability is set at 2, this would require a bet below the min bet size? This could explain why this problem doesn't arise with Back bets.

    Comment

    • Franklin1
      Junior Member
      • Mar 2012
      • 91

      #3
      Have you the placing that bet using the website.

      It says here laying had minimum liability of GBP 10


      https://promo.betfair.com/betfairsp/FAQs_theBasics.html

      Comment

      • jsbf
        Junior Member
        • May 2015
        • 7

        #4
        Originally posted by dashee View Post
        I'm still relatively new to this stuff (this is my first post) and I've never tried LIMIT_ON_CLOSE bets. But could the problem be your liability on the bet. Since the price is 4.4 and your liability is set at 2, this would require a bet below the min bet size? This could explain why this problem doesn't arise with Back bets.
        Originally posted by Franklin1 View Post
        Have you the placing that bet using the website.

        It says here laying had minimum liability of GBP 10


        https://promo.betfair.com/betfairsp/FAQs_theBasics.html
        I've tried setting the liability to 11.00, but the error is still the same AARGH! No big luck here:

        Code:
        {
           "status"=>"FAILURE",
           "errorCode"=>"BET_ACTION_ERROR",
           "marketId"=>"1.119033132",
           "instructionReports"=>[{
              "status"=>"FAILURE",
              "errorCode"=>"INVALID_BET_SIZE",
              "instruction"=>{
                 "selectionId"=>7904838,
                 "limitOnCloseOrder"=>{
                    "liability"=>11.0,
                    "price"=>5.4
                 },
                 "orderType"=>"LIMIT_ON_CLOSE",
                 "side"=>"LAY"
              }
           }]
        }
        I forgot to say, the account is underfunded right now. So it doesn't have the funds to place these bets. But I think that's not relevant to the case, or could it be? :-|

        Comment

        • Franklin1
          Junior Member
          • Mar 2012
          • 91

          #5
          I tried some different scenarios in the visualizer with no luck (and now I have some uncancellable bets!)

          Scenario - insufficient funds and liabilty size too low
          Account Funds = 2
          Limit on close, Lay 2 @ 1.01
          Returns:
          PlaceExecutionReport.ErrorCode=BET_ACTION_ERROR
          PlaceExecutionReport.instructionReports[0].ErrorCode=INVALID_BET_SIZE

          Scenario - insufficient funds only
          Account Funds = 2
          Limit on close, Lay 10 @ 1.01
          Returns:
          PlaceExecutionReport.ErrorCode=INSUFFICIENT_FUNDS
          PlaceExecutionReport.instructionReports[0].ErrorCode=ERROR_IN_ORDER

          Scenario - sufficient funds only and legal liability size
          Account Funds = >10
          Limit on close, Lay 10 @ 1.01
          Returns:
          PlaceExecutionReport.ErrorCode= NULL
          PlaceExecutionReport.instructionReports[0].ErrorCode=NULL

          I tried a load of things and can't replicate your error. The things which looked suspicious to me are:
          1 - why are you escaping all your quotes?
          2 - would it be better / safer to quote your doubles?

          I thought this would be much easier to fix. Given the Back works OK I think that might be a clue.

          Can you reproduce the error in a market which is going to be open long enough for us to see if we can reproduce it?

          Comment

          • jsbf
            Junior Member
            • May 2015
            • 7

            #6
            Thanks Franklin1, for your tests. Hope the uncancelable bets didn't bring you significant losses! I appreciate your attention.

            By your tests, it looks like the the evaluation of the INVALID_BET_SIZE error takes precedence over INSUFFICIENT_FUNDS.

            The only use case missing is insufficient funds with a legal liability size, which would be my use case assuming 11.0 is a legal liability. In this case I would expect to receive an INSUFFICIENT_FUNDS error instead of INVALID_BET_SIZE, which is what I'm getting. What happens for you?

            Originally posted by Franklin1 View Post
            I tried a load of things and can't replicate your error. The things which looked suspicious to me are:
            1 - why are you escaping all your quotes?
            I'm using a Ruby gem that makes the requests (https://github.com/mikecmpbll/betfair). It could be the case that it's the source of the problem.

            Originally posted by Franklin1 View Post
            2 - would it be better / safer to quote your doubles?
            I suppose that could be an option, but in all of the documentation I see references as doubles. With the back bet being placed, I figured it was not only OK but also better not to use quotes. Am I wrong?

            Originally posted by Franklin1 View Post
            I thought this would be much easier to fix. Given the Back works OK I think that might be a clue.

            Can you reproduce the error in a market which is going to be open long enough for us to see if we can reproduce it?
            I hope this one will do:

            Code:
            {
               "status"=>"FAILURE",
               "errorCode"=>"BET_ACTION_ERROR",
               "marketId"=>"1.119038299",
               "instructionReports"=>[{
                  "status"=>"FAILURE",
                  "errorCode"=>"INVALID_BET_SIZE",
                  "instruction"=>{
                     "selectionId"=>8492631,
                     "limitOnCloseOrder"=>{
                        "liability"=>11.0,
                        "price"=>3.2
                     },
                     "orderType"=>"LIMIT_ON_CLOSE",
                     "side"=>"LAY"
                  }
               }]
            }

            Comment

            • Franklin1
              Junior Member
              • Mar 2012
              • 91

              #7
              Originally posted by jsbf View Post
              By your tests, it looks like the the evaluation of the INVALID_BET_SIZE error takes precedence over INSUFFICIENT_FUNDS.
              Agreed

              Originally posted by jsbf View Post
              The only use case missing is insufficient funds with a legal liability size, which would be my use case assuming 11.0 is a legal liability. In this case I would expect to receive an INSUFFICIENT_FUNDS error instead of INVALID_BET_SIZE, which is what I'm getting. What happens for you?
              I get INSUFFICIENT_FUNDS

              Originally posted by jsbf View Post
              I hope this one will do:
              That bet seems to work fine for me (I get INSUFFICIENT_FUNDS, not INVALID_BET_SIZE).

              Can you post your request JSON (as opposed to response)?

              Comment

              • jsbf
                Junior Member
                • May 2015
                • 7

                #8
                Originally posted by Franklin1 View Post
                Can you post your request JSON (as opposed to response)?
                Sure can. Here you go:

                Code:
                {\"marketId\":\"1.119038299\",\"instructions\":[{\"orderType\":\"LIMIT_ON_CLOSE\",\"selectionId\":8492631,\"side\":\"LAY\",\"limitOnCloseOrder\":{\"liability\":11.0,\"price\":3.3}}]}

                Comment

                • Franklin1
                  Junior Member
                  • Mar 2012
                  • 91

                  #9
                  ok, well...

                  If I just remove the escapes and post this I get INSUFFICIENT_FUNDS (so it seems to be working for me).

                  I'm baffled really. At what stage do get the JSON you are posting? Can you do a grap from Wireshark or Fiddler or something so we can see exactly what is in the request (I don't believe you actually sending the escapes since when I try to I get BAD_REQUEST)?

                  Comment

                  • jsbf
                    Junior Member
                    • May 2015
                    • 7

                    #10
                    Also I get the same result, either using a float or formatting a string. Here's an example request with liability and price enclosed in quotes with two decimal places (which looks a bit more civilised), still the same INVALID_BET_SIZE as response.

                    Code:
                    "{\"marketId\":\"1.119038299\",\"instructions\":[{\"orderType\":\"LIMIT_ON_CLOSE\",\"selectionId\":8492631,\"side\":\"LAY\",\"limitOnCloseOrder\":{\"liability\":\"11.00\",\"price\":\"3.30\"}}]}"

                    Comment

                    • betdynamics
                      Junior Member
                      • Sep 2010
                      • 534

                      #11
                      Are you in the UK?

                      If not, perhaps the liability on the bet needs to be higher (the limit is different for different countries)

                      Comment

                      • Franklin1
                        Junior Member
                        • Mar 2012
                        • 91

                        #12
                        Originally posted by betdynamics View Post
                        Are you in the UK?

                        If not, perhaps the liability on the bet needs to be higher (the limit is different for different countries)
                        that sounds like a solution to me.

                        Have been able to place these bets through the website from the same machine?

                        Comment

                        • jsbf
                          Junior Member
                          • May 2015
                          • 7

                          #13
                          I've tcpdumped the request but couldn't make anything out of the output, very little is readable. I'd guess it's compressed.

                          Frankiln1, I can't be scientific about it but debugging though the code I'd guess at this moment the http client library is responsible for the quote escaping. I've tried several times to change the contents of the request right up to when it's sent to the client library, to no avail. Same results.

                          Suggestions by betdynamics can be a new direction, I was kinda leaving the packet sniffing alone when I've decided to try the visualiser and see what results I'd get.

                          Check out the attachments, and in the first you'll see a bet exactly as you'd described, Franklin1, with the difference that I get the INVALID_BET_SIZE all the same. A-HA!

                          In the second shot, I've increased the liability to 20.0 and voila! I get the INSUFFICIENT_FUNDS I was expecting, and that had already been observed in this thread.

                          I was between the first and the second screenshot when I saw the suggestion that I could be outside the UK, thus subject to a different minimum liability. And everything points to being exactly that (I do am outside the UK).

                          The minimum liability would thus be €20.

                          Guys, I've been banging my head around this, thank you so much 'cause I believe this will be enough to get it solved! I appreciate it!

                          With regards to that minimum liability, what happens if I want to lay €5 at 2.5, I can't do it? I'd expect I could use smaller stakes, but this liability thing got me confused now :-|
                          Attached Files

                          Comment

                          • betdynamics
                            Junior Member
                            • Sep 2010
                            • 534

                            #14
                            You are placing a LIMIT_ON_CLOSE (i.e. BSP bet) and therefore there is a minimum liability limit.

                            The limits are outlined in https://api.developer.betfair.com/se...ncy+Parameters

                            This liability limit does not apply to normal bets. However, the minimum stake limit does apply.

                            Comment

                            • Franklin1
                              Junior Member
                              • Mar 2012
                              • 91

                              #15
                              nice work betdynamics.

                              I'm going to post this here so I don't lose it.

                              I think all questions posted should try to include:
                              1 - (If appropriate) has the user successfully performed the operation through the website from the same machine?
                              2 - Has the user successfully performed the operation through the visualiser from the same machine?
                              2 - What country is the operation being performed from?
                              3 - The HTTP request / response (headers exc. appkey and session and JSON) that is being sent / received - if using the visualiser this illustates a pretty good way to get them http://stackoverflow.com/questions/1...ring-in-chrome
                              Last edited by Franklin1; 03-06-2015, 10:14 AM. Reason: .

                              Comment

                              Working...
                              X