How to placeorder

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • thebettrader
    Junior Member
    • Apr 2016
    • 35

    #1

    How to placeorder

    Hello,

    I have a question about how to place an order. This is the first time so I try to ask so I am more sure of what I am doing.
    I am trying to place a back order for moneyline.

    1. As moneyline doesn't have handicap, I have put handicap to null. I wonder if that is correct?
    2. I have also red somewhere, but can't find this in the documentation about "Fill and Kill" and "Fill or Kill".
    Initially, I would like to place a "Fill or Kill" order and wonder how to do this in the below data string?

    3. Does this place order string look correct?
    4. Is there a minimum size that betfair uses for orders?
    5. What does "LAPSE" mean for persistencetype?

    Thank you!
    Code:
                        String marketid = "1.12345";
                        String selectionid = "12345";
                        String ordertype = "LIMIT";
                        String size = "2";
                        String price = "1.85";
                        String handicap = "null";
                        String persistencetype = "LAPSE";
    
                        data = "{\"jsonrpc\": \"2.0\", \"method\": \"SportsAPING/v1.0/placeOrders\"," +
    
                         "{\"marketId\":\"" + marketid + "\"," +
                         "\"instructions\":[{\"selectionId\":" + selectionid + ",\"handicap\":\"" + handicap + "\",\"side\":\"BACK\",\"orderType\":\"" + ordertype + "\"," +
                                         "\"limitOrder\": {\"size\":\"" + size + "\",\"price\":\"" + price + "\"," +
                                         "\"persistenceType\":\"" + persistencetype + "\"}}}}";
    Last edited by thebettrader; 02-05-2016, 10:51 PM.
  • jabe
    Senior Member
    • Dec 2014
    • 705

    #2
    1. In the online documentation, there are Example Requests under the Getting Started section. One is a called Placing a Bet (pasted below).
    Use
    "handicap": 0.0,
    or
    "handicap": "0",

    2. I think you'll find "fill or kill" is a feature of some software products you've been reading about. If you're writing the program, you have to make it happen. On the plus side, you get to choose what it means.

    3. Your placeOrders string needs more.
    This is the example from the documentation:

    Code:
    {
            "jsonrpc": "2.0",
            "method": "SportsAPING/v1.0/placeOrders",
            "params": {
                "marketId": "1.109850906",
                "instructions": [
                    {
                        "selectionId": "237486",
                        "handicap": "0",
                        "side": "LAY",
                        "orderType": "LIMIT",
                        "limitOrder": {
                            "size": "2",
                            "price": "3",
                            "persistenceType": "LAPSE"
                        }
                    }
                ]
            },
            "id": 1
        }
    You need to add the "params" and the "id" parts. One of your brackets (the third, I think) after the persistenceType needs to be a closing square bracket to match the one that follows "instructions"=.

    4. The minimum stake (size) in the UK is £2. It may be different for other currencies. See here
    http://docs.developer.betfair.com/di...ncy+Parameters

    5. LAPSE means the order is cancelled when the event starts. As long as the best was placed before the start.
    http://docs.developer.betfair.com/di...ersistenceType


    Can I suggest that as a trial you try to place a back bet for odds of 1000? If you sign into Betfair at the same time, you can make sure it's there and it's unlikely to have been matched. You can delete it in Betfair.

    Comment

    • thebettrader
      Junior Member
      • Apr 2016
      • 35

      #3
      Originally posted by jabe View Post
      2. I think you'll find "fill or kill" is a feature of some software products you've been reading about. If you're writing the program, you have to make it happen. On the plus side, you get to choose what it means.

      You need to add the "params" and the "id" parts. One of your brackets (the third, I think) after the persistenceType needs to be a closing square bracket to match the one that follows "instructions"=.

      4. The minimum stake (size) in the UK is £2. It may be different for other currencies. See here
      http://docs.developer.betfair.com/di...ncy+Parameters

      5. LAPSE means the order is cancelled when the event starts. As long as the best was placed before the start.
      http://docs.developer.betfair.com/di...ersistenceType

      Can I suggest that as a trial you try to place a back bet for odds of 1000? If you sign into Betfair at the same time, you can make sure it's there and it's unlikely to have been matched. You can delete it in Betfair.
      Thank you, that was very helpful!
      Yes, I beleive I must have come accross that on google when finding any software that uses "fill or kill".
      So to mimic this function, I then send the order then check the status of the order and cancel the order after X time.

      Yes you are right, the params and id parts were needed also, so I added those as well.
      I looked up the minimum stake there and it is $4 which I use as currency.
      It was a good idéa to send a test order at 1000 so I managed to do this successfully, so the code does work well.

      If placing an order inside a liveevent or before a liveevent and wanting the order to not be cancelled when the event starts, I have changed "LAPSED" to "PERSIST". I beleive this could be right in that scenario if wanting to cancel the order myself?

      Comment

      • jabe
        Senior Member
        • Dec 2014
        • 705

        #4
        Originally posted by thebettrader View Post
        If placing an order inside a liveevent or before a liveevent and wanting the order to not be cancelled when the event starts, I have changed "LAPSED" to "PERSIST". I beleive this could be right in that scenario if wanting to cancel the order myself?
        Happy to help!

        Yes, you're right about "LAPSED" and "PERSIST" and your thoughts on your "fill or kill" action.
        Last edited by jabe; 05-05-2016, 04:01 PM.

        Comment

        • betdynamics
          Junior Member
          • Sep 2010
          • 534

          #5
          I'm pretty sure you can't place a bet with PERSIST if the market is already InPlay.

          I think the bet will fail with a persistence error.

          Comment

          • thebettrader
            Junior Member
            • Apr 2016
            • 35

            #6
            That was good to know so I built a fill or kill functionality that seems to work.

            I beleive I got a little bit confused about PERSIST and LAPSE with above answers. Let us say that the game is currently running In-Play.
            What order should be used in that scenario if wanting the order to try and go through for the entire game if we don't cancel the bet manually?

            I was looking at the URL:
            http://docs.developer.betfair.com/do...ersistenceType

            About "PERSIST" it says:
            "Persist the order to in-play. The bet will be place automatically into the in-play market at the start of the event."

            I am not sure if that gives an answer if it is okay to use "PERSIST" when the game is already In-Play?

            Comment

            • jabe
              Senior Member
              • Dec 2014
              • 705

              #7
              I believe that the only critical point with the persistenceType is the moment at which the event turns in-play, so if you place a bet afterwards, it doesn't matter which of the two you use.

              Comment

              • betdynamics
                Junior Member
                • Sep 2010
                • 534

                #8
                Jabe - I tested it and you are correct

                The persistence error is reported if you try to place a PERSIST bet on a market that is not marked to go InPlay, which makes sense really.

                Comment

                • jabe
                  Senior Member
                  • Dec 2014
                  • 705

                  #9
                  Originally posted by betdynamics View Post
                  Jabe - I tested it and you are correct

                  The persistence error is reported if you try to place a PERSIST bet on a market that is not marked to go InPlay, which makes sense really.
                  Splendid and thank you for letting me know.

                  Comment

                  • thebettrader
                    Junior Member
                    • Apr 2016
                    • 35

                    #10
                    JABE and BETDYNAMICS, thanks for the responses.
                    That was really good to know so I have then understood the differences also

                    Thank you!

                    Comment

                    Working...
                    X