cancelOrders why are all bets being cancelled?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Intrepid
    Junior Member
    • Sep 2012
    • 11

    #1

    cancelOrders why are all bets being cancelled?

    Dim postData As String = " [{""jsonrpc"": ""2.0"", ""method"": ""SportsAPING/v1.0/cancelOrders"", ""params"": {""betId"":" & cancelmybet & ", ""id"": 1}}]"



    If I have 3 bets on a market all 3 get cancelled using the above.

    but I only supply the id for one bet, what is needed to cancel only the one bet?
  • jim tollan
    Junior Member
    • Apr 2014
    • 5

    #2
    hi there, you also need to quote the MarketId when cancelling. So using the approach that you use, your json would look something like:

    " [{""jsonrpc"": ""2.0"", ""method"": ""SportsAPING/v1.0/cancelOrders"", ""params"": {""betId"":" & myBetId & ", ""MarketId"":" & betMarketId & ",""id"": 1}}]"

    Comment

    • Intrepid
      Junior Member
      • Sep 2012
      • 11

      #3
      brilliant, many thanks

      Comment

      • arteny1
        Junior Member
        • Jul 2014
        • 17

        #4
        Are all markets all bets are canceled?

        Docmuentation says:
        marketId
        String
        If not supplied all bets are cancelled

        My question is in this case (when marketId is not supplied) all bets from instructions are cancelled or every bet on all markets will be canceled (it looks too dangerous, necessary bets can be canceled)?

        Comment

        • BetfairDeveloperProgram
          Administrator
          • Oct 2008
          • 680

          #5
          Hi arteny1.

          Yes, submitting:

          Code:
          [{"jsonrpc": "2.0", "method": "SportsAPING/v1.0/cancelOrders", "params": {}, "id": 1}]
          Will cancel all unmatched bets on all markets.

          Kind Regards

          Neil

          Comment

          • arteny1
            Junior Member
            • Jul 2014
            • 17

            #6
            Originally posted by Betfair Developers Program View Post
            Hi arteny1.

            Yes, submitting:

            Code:
            [{"jsonrpc": "2.0", "method": "SportsAPING/v1.0/cancelOrders", "params": {}, "id": 1}]
            Will cancel all unmatched bets on all markets.

            Kind Regards

            Neil
            @Neil, sorry for misunderstanding, but I asked about a different case.
            In your case instuctions are empty, I am asking about case, when market id is not specified, but instructions is list of instructions with bet ids specified.
            So in this case all bets from all markets are canceled or only bets with specified id's in instructins will be canceled?

            Comment

            • arteny1
              Junior Member
              • Jul 2014
              • 17

              #7
              Please answer

              So, can anybody answer my question?
              If marketId is not supplied, but bet id's are supplied (for one market) - will those instruction be executed?

              Comment

              • betdynamics
                Junior Member
                • Sep 2010
                • 534

                #8
                I don't know the answer although I suspect that it will only cancel those bets whose betId has been specified.

                However, surely it is not difficult to test?

                Just pick a quiet time, put 3 or 4 bets on to the market at odds that won't be matched and then cancel some. Then see if all of the bets have been cancelled or just the ones that you specified.

                Comment

                • arteny1
                  Junior Member
                  • Jul 2014
                  • 17

                  #9
                  Originally posted by betdynamics View Post
                  I don't know the answer although I suspect that it will only cancel those bets whose betId has been specified.

                  However, surely it is not difficult to test?

                  Just pick a quiet time, put 3 or 4 bets on to the market at odds that won't be matched and then cancel some. Then see if all of the bets have been cancelled or just the ones that you specified.
                  I can't do this, because I can't allow to cancel all bets on all markets.

                  Comment

                  • betdynamics
                    Junior Member
                    • Sep 2010
                    • 534

                    #10
                    A quick play around with the visualiser SUGGESTS that as soon as you specify a betId, then you also have to specify a marketId in order for the call to be accepted.

                    So, that would suggest it is not possible to place a cancelOrder call with just betIds specified and no marketId.

                    However, that is NOT a definitive answer. To get that, I suggest that you email the BDP team then - bdp@betfair.com - and ask them directly.
                    Last edited by betdynamics; 04-11-2014, 04:28 PM.

                    Comment

                    • molnarlac
                      Junior Member
                      • Nov 2014
                      • 6

                      #11
                      Hello,

                      same problem
                      I wrote to my code (php)
                      $params = [
                      array(
                      "marketId" => $marketId , // $marketId is a string!
                      "betId" => $betId // $betId - string or long or string-array or long-array
                      )
                      ]
                      OR
                      $params=[
                      array(
                      "marketId" => $marketId ,
                      "instructions" => [ { "betId" => $betId ( string or long ) } , {} ]
                      )
                      ]
                      And I tried all in other possible combination.
                      The cancelOrders is cancelled all orders all in case.
                      What make I wrong?

                      Comment

                      • betdynamics
                        Junior Member
                        • Sep 2010
                        • 534

                        #12
                        Post the actual JSON request rather than the code - that will make it easier to spot the problem (hopefully)

                        Comment

                        • molnarlac
                          Junior Member
                          • Nov 2014
                          • 6

                          #13
                          Currently is the code:

                          $params = array(
                          "marketId" => $marketId ,
                          "betId" => array( $betId ) ,
                          "customerRef" => round( time() / 3 )
                          );

                          $cancelOrders = sportsApingRequest( $appKey , $sessionToken , 'cancelOrders' , json_encode( $params ) );


                          The sportsApingRequest function is cut and copy from betfair sample code.
                          I think that the error is with setting of marketId. I change the $betId to string or place into an instructions object, and single data or in array. Wrong-wrong-wrong.

                          Comment

                          • betdynamics
                            Junior Member
                            • Sep 2010
                            • 534

                            #14
                            Post the actual JSON string that is being sent to the server rather than the code used to generate it.

                            It will look something like:

                            Code:
                            {"jsonrpc":"2.0","method":"SportsAPING/v1.0/cancelOrders","params":{"marketId":"1.116526412","instructions":[{"betId":"43950294170","sizeReduction":2.0}],"customerRef":"1234"},"id":1}

                            Comment

                            • molnarlac
                              Junior Member
                              • Nov 2014
                              • 6

                              #15
                              Yes, I checked the my code, and I discovered the error.
                              I placed the json string of $params into the request object, not the $params object. And now ... works it.

                              Comment

                              Working...
                              X