Betting operations are there

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AlgoTrader
    Junior Member
    • Mar 2012
    • 243

    #1

    Betting operations are there

    Finally we got the betting operations there!

    It is very unusual to see that cancelOrders is used to reduce the bet size (portion cancel). replaceOrders is just bet price change and updateOrders is now a trivial bet persistence change.

    The new betting API is certainly much cleaner and removed many anomalies of the old API (we had very fun updateBets with lots of side effects and restrictions).

    The overall impression is positive, we have four simple calls each of them do just a single simple thing.
    Betfair Bots Made Easy
  • Dan-the-man
    Junior Member
    • May 2013
    • 5

    #2
    Looking forward to re writing all of my code

    Comment

    • bnl
      Junior Member
      • Nov 2012
      • 108

      #3
      I'm a bit confused.
      Does this mean that API-NG is released for the public,
      or just for beta testers?
      I see May 20th and July 3rd as release dates, but for what.
      Trying to use the api-ng-visualizer at https://api-ng.betstores.com/betting/
      I need an application key, it tells me. Where do I get hold of such thing?


      /Björn

      Comment

      • AlgoTrader
        Junior Member
        • Mar 2012
        • 243

        #4
        All the questions regarding AppKey please send to bdp at betafair.com. They are usually very friendly
        Betfair Bots Made Easy

        Comment

        • AlgoTrader
          Junior Member
          • Mar 2012
          • 243

          #5
          My first placeOrders via a new API. There is an example:

          Code:
          Request:{
            "jsonrpc": "2.0",
            "id": 2,
            "method": "SportsAPING/v1.0/placeOrders",
            "params": {
              "marketId": "1.109541416",
              "instructions": [
                {
                  "orderType": "LIMIT",
                  "selectionId": 2264531,
                  "side": "LAY",
                  "limitOrder": {
                    "price": 1.01,
                    "size": 5,
                    "persistenceType": "LAPSE"
                  }
                },
                {
                  "orderType": "LIMIT",
                  "selectionId": 2264531,
                  "side": "BACK",
                  "limitOrder": {
                    "price": 1000,
                    "size": 5,
                    "persistenceType": "LAPSE"
                  }
                }
              ],
              "customerRef": "MyFirstPlaceOrders"
            }
          }
          
          Response:{
            "jsonrpc": "2.0",
            "result": {
              "customerRef": "MyFirstPlaceOrders",
              "status": "SUCCESS",
              "marketId": "1.109541416",
              "instructionReports": [
                {
                  "status": "SUCCESS",
                  "instruction": {
                    "orderType": "LIMIT",
                    "selectionId": 2264531,
                    "side": "LAY",
                    "limitOrder": {
                      "size": 5,
                      "price": 1.01,
                      "persistenceType": "LAPSE"
                    }
                  },
                  "betId": "27274638053",
                  "placedDate": "2013-05-22T11:53:18.000Z",
                  "averagePriceMatched": 0,
                  "sizeMatched": 0
                },
                {
                  "status": "SUCCESS",
                  "instruction": {
                    "orderType": "LIMIT",
                    "selectionId": 2264531,
                    "side": "BACK",
                    "limitOrder": {
                      "size": 5,
                      "price": 1000,
                      "persistenceType": "LAPSE"
                    }
                  },
                  "betId": "27274638054",
                  "placedDate": "2013-05-22T11:53:18.000Z",
                  "averagePriceMatched": 0,
                  "sizeMatched": 0
                }
              ]
            },
            "id": 2
          }
          I am very impressed my first invocation was a successful one, with SOAP API I had lots of sex before my first successful invocation (it took hours if I remember correctly).

          Exellent API simplicity and cleanness!
          Betfair Bots Made Easy

          Comment

          • AlgoTrader
            Junior Member
            • Mar 2012
            • 243

            #6
            I added all betting operations to my Betfair lib https://github.com/AlgoTrader/betfair

            It took just a single day to do it.

            The only serious bug I found is placeOrders do not return BACK_LAY_COMBINATION but matchs bets from the same placeOrders. If I put BACK 5.00@2.00 and LAY 5.00@2.00 then both bets are GUARANTIED to be matched. I can match my own bets from the same placeOrders.

            replaceOrders output is a bit tricky, I did not like it. the idea of cancelInstructionReport and placeInstructionReport objects in response is cumbersome, the old API have more pleasant result

            updateOrders output is strange if persistence is the same. the call is reported as "FAILURE" and "BET_ACTION_ERROR" for API call and "NO_ACTION_REQUIRED" for every bet reported. I would prefer to have success.

            I can provide examples of all 4 betting invocations
            Betfair Bots Made Easy

            Comment

            • PT_PT
              Junior Member
              • Nov 2012
              • 17

              #7
              Originally posted by AlgoTrader View Post
              If I put BACK 5.00@2.00 and LAY 5.00@2.00 then both bets are GUARANTIED to be matched. I can match my own bets from the same placeOrders.
              I don't think you are right in this point.
              Imagine that there is already someone who placed a BACK x@2.00, then your LAY will be matched with the back from someone in the front of the queue, and your BACK will be unmatched.

              I can be wrong, and I would be happy if someone correct me in that case.
              I haven't tested this methods yet.

              Comment

              • AlgoTrader
                Junior Member
                • Mar 2012
                • 243

                #8
                You are right, I wrote incorrect phrase. I cannot understand why one of my bets can match another my bet from the same placeOrders. The old version just generates BACK_LAY_COMBINATION error that is better behaviour
                Betfair Bots Made Easy

                Comment

                Working...
                X