Announcement

Collapse
No announcement yet.

Place back and lay bets at BSP returning price bet action error

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Place back and lay bets at BSP returning price bet action error

    I have a dataframe:

    selectionId size Indicator
    21734643 32.75 BACK
    21339485 14.65 BACK
    22453168 40.00 BACK
    23682824 81.55 BACK
    21416382 71.71 BACK
    23682827 67.07 BACK
    23682829 45.91 LAY
    23682831 35.53 LAY
    23682825 44.95 LAY
    23682830 43.31 LAY
    23682828 43.14 LAY
    22568854 42.09 LAY
    23682826 13.33 LAY


    I pass the column in the dataframe to place bets at BSP price as follows:

    size = df['size'].astype(str)
    selectionId = df['selectionId'].astype(str)
    BACKLAY = df['Indicator'].astype(str)

    for i, j, z in zip(size, selectionId, BACKLAY):

    ref = ''.join(random.choice('0123456789ABCDEF') for i in range(6))

    string = '{"jsonrpc": "2.0", "method": "SportsAPING/v1.0/placeOrders", "params": {"marketId":"' + marketId + '","instructions":[{"selectionId":"' + j + '","handicap":"0","side":"'+ z + '","orderType":"MARKET_ON_CLOSE","limitOrder":{ "si ze":"' + i + '","price":"1.1","persistenceType":"LAPSE"}}],"customerRef":"' + ref + '"},"id": 1}' test_list.append(string) for request in test_list: place_order_Response = callAping(request) place_order_load = json.loads(place_order_Response) print(place_order_load)


    I get the following error:

    {'jsonrpc': '2.0', 'result': {'customerRef': 'E04F14', 'status': 'FAILURE', 'errorCode': 'BET_ACTION_ERROR', 'marketId': '1.157315536', 'instructionReports': [{'status': 'FAILURE', 'errorCode': 'INVALID_BET_SIZE', 'instruction': {'selectionId': 21734643, 'handicap': 0.0, 'marketOnCloseOrder': {}, 'orderType': 'MARKET_ON_CLOSE', 'side': 'BACK'}}]}, 'id': 1}

    My bet size is greater than 2 so I am not sure why I get this error. I have been able to place back bets with "orderType":"LIMIT" and "side":"BACK" successful. So I am not sure why my lay bet at BSP price is not working.
    Last edited by Sandy; 09-04-2019, 08:38 PM.

    #2
    My formatting got messed up when I posted so I've re-written it here.

    I have a dataframe:

    selectionId size Indicator
    21734643 32.75 BACK
    21339485 14.65 BACK
    22453168 40.00 BACK
    23682824 81.55 BACK
    21416382 71.71 BACK
    23682827 67.07 BACK
    23682829 45.91 LAY
    23682831 35.53 LAY
    23682825 44.95 LAY
    23682830 43.31 LAY
    23682828 43.14 LAY
    22568854 42.09 LAY
    23682826 13.33 LAY


    I pass the column in the dataframe to place bets at BSP price as follows:

    size = df['size'].astype(str)
    selectionId = df['selectionId'].astype(str)
    BACKLAY = df['Indicator'].astype(str)

    for i, j, z in zip(size, selectionId, BACKLAY):

    ref = ''.join(random.choice('0123456789ABCDEF') for i in range(6))

    string = '{"jsonrpc": "2.0", "method": "SportsAPING/v1.0/placeOrders", "params": {"marketId":"' + marketId + '","instructions":[{"selectionId":"' + j + '","handicap":"0","side":"'+ z + '","orderType":"MARKET_ON_CLOSE","limitOrder":{ "si ze":"' + i + '","price":"1.1","persistenceType":"LAPSE"}}],"customerRef":"' + ref + '"},"id": 1}' test_list.append(string) for request in test_list: place_order_Response = callAping(request) place_order_load = json.loads(place_order_Response) print(place_order_load)


    I get the following error:

    {'jsonrpc': '2.0', 'result': {'customerRef': 'E04F14', 'status': 'FAILURE', 'errorCode': 'BET_ACTION_ERROR', 'marketId': '1.157315536', 'instructionReports': [{'status': 'FAILURE', 'errorCode': 'INVALID_BET_SIZE', 'instruction': {'selectionId': 21734643, 'handicap': 0.0, 'marketOnCloseOrder': {}, 'orderType': 'MARKET_ON_CLOSE', 'side': 'BACK'}}]}, 'id': 1}

    My bet size is greater than 2 so I am not sure why I get this error. I have been able to place back bets with "orderType":"LIMIT" and "side":"BACK" successful. So I am not sure why my lay bet at BSP price is not working.
    Last edited by Sandy; 09-04-2019, 08:38 PM.

    Comment


      #3
      Puzzling. Any chance you could get it to display the values of i, j, z in your loop, or possibly string?

      Comment


        #4
        i j z
        3.25 20936184 BACK
        24.78 4921671 BACK
        18.67 21142733 LAY
        1.5 21402619 LAY
        7.0 20377665 LAY
        6.09 23130689 LAY
        53.91 21307307 LAY
        52.91 9372950 LAY
        51.6 23210397 LAY
        15.46 20838052 BACK
        33.64 23510422 BACK
        34.12 23477597 BACK
        12.6 23682768 LAY
        4.6 23487323 LAY
        5.6 20712652 LAY
        6.09 21486895 LAY
        Last edited by Sandy; 09-04-2019, 08:29 PM.

        Comment


          #5
          It is something to do with the z which adds the BACK or LAY as when run with out the part it works fine.

          Comment


            #6
            Si ze? Note that min liability is different for BSP, check for the docs.

            Comment


              #7

              This is two example strings:

              20936184 33.47 BACK

              4921671 24.50 BACK

              {"jsonrpc": "2.0", "method": "SportsAPING/v1.0/placeOrders", "params": {"marketId":"1.157365924","instructions":[{"selectionId":"20936184","handicap":"0","side" :"B ACK","orderType":"MARKET_ON_CLOSE","limitOrder":{ " size":"33.47","price":"1.1","persistenceType":"LAP SE"}}],"customerRef":"85B5B2"},"id": 1}

              ​​​​​​​{"jsonrpc": "2.0", "method": "SportsAPING/v1.0/placeOrders", "params": {"marketId":"1.157365924","instructions":[{"selectionId":"4921671","handicap":"0","side": "BA CK","orderType":"MARKET_ON_CLOSE","limitOrder":{ "s ize":"24.5","price":"1.1","persistenceType":"LAPS E "}}],"customerRef":"344080"},"id": 1}

              Comment


                #8
                I've just looked at min BSP liability is £10. I have now adjusted my size column to:


                This is an example of the string:

                String1: {"jsonrpc": "2.0", "method": "SportsAPING/v1.0/placeOrders", "params": {"marketId":"1.157365924","instructions":[{"selectionId":"20936184","handicap":"0","side" :"B ACK","orderType":"MARKET_ON_CLOSE","limitOrder":{ " size":"42.14","price":"1.1","persistenceType":"LAP SE"}}],"customerRef":"916C66"},"id": 1}

                String2: {"jsonrpc": "2.0", "method": "SportsAPING/v1.0/placeOrders", "params": {"marketId":"1.157365924","instructions":[{"selectionId":"4921671","handicap":"0","side": "LA Y","orderType":"MARKET_ON_CLOSE","limitOrder":{ "si ze":"31.95","price":"1.1","persistenceType":"LAP SE "}}],"customerRef":"281D3D"},"id": 1}

                String3: {"jsonrpc": "2.0", "method": "SportsAPING/v1.0/placeOrders", "params": {"marketId":"1.157365924","instructions":[{"selectionId":"21142733","handicap":"0","side" :"L AY","orderType":"MARKET_ON_CLOSE","limitOrder":{ "s ize":"24.52","price":"1.1","persistenceType":"LAP S E"}}],"customerRef":"EE3523"},"id": 1}



                This is an example of output for corresponding strings:

                {'jsonrpc': '2.0', 'result': {'customerRef': '916C66', 'status': 'FAILURE', 'errorCode': 'BET_ACTION_ERROR', 'marketId': '1.157365924', 'instructionReports': [{'status': 'FAILURE', 'errorCode': 'INVALID_BET_SIZE', 'instruction': {'selectionId': 20936184, 'handicap': 0.0, 'marketOnCloseOrder': {}, 'orderType': 'MARKET_ON_CLOSE', 'side': 'BACK'}}]}, 'id': 1}

                {'jsonrpc': '2.0', 'result': {'customerRef': '281D3D', 'status': 'FAILURE', 'errorCode': 'BET_ACTION_ERROR', 'marketId': '1.157365924', 'instructionReports': [{'status': 'FAILURE', 'errorCode': 'INVALID_BET_SIZE', 'instruction': {'selectionId': 4921671, 'handicap': 0.0, 'marketOnCloseOrder': {}, 'orderType': 'MARKET_ON_CLOSE', 'side': 'LAY'}}]}, 'id': 1}

                {'jsonrpc': '2.0', 'result': {'customerRef': 'EE3523', 'status': 'FAILURE', 'errorCode': 'BET_ACTION_ERROR', 'marketId': '1.157365924', 'instructionReports': [{'status': 'FAILURE', 'errorCode': 'INVALID_BET_SIZE', 'instruction': {'selectionId': 21142733, 'handicap': 0.0, 'marketOnCloseOrder': {}, 'orderType': 'MARKET_ON_CLOSE', 'side': 'LAY'}}]}, 'id': 1}
                Last edited by Sandy; 09-04-2019, 09:14 PM.

                Comment


                  #9
                  This is from the documentation PDF. It's not a limitOrder, but a marketOnCloseOrder, and they take different parameters.

                  Placing a Betfair SP Bet

                  To place a bet on a selection at Betfair SP, you need to specify the parameters below in the placeOrders request. The below example would place a Betfair SP back bet on the required selection for a stake of £2.00.


                  placeOrders Request

                  [
                  {
                  "jsonrpc": "2.0",
                  "method": "SportsAPING/v1.0/placeOrders",
                  "params": {
                  "marketId": "1.111836557",
                  "instructions": [
                  {
                  "selectionId": "5404312",
                  "handicap": "0",
                  "side": "BACK",
                  "orderType": "MARKET_ON_CLOSE",
                  "marketOnCloseOrder": {
                  "liability": "2"
                  }
                  }
                  ]
                  },
                  "id": 1
                  }

                  So no need to mention price, because ultimately that will be decided for you, and instead of size you specify liability.
                  Last edited by jabe; 10-04-2019, 04:13 AM.

                  Comment


                    #10
                    Yep that's it jabe

                    Final string:

                    string = '{"jsonrpc": "2.0", "method": "SportsAPING/v1.0/placeOrders", "params": {"marketId":"' + marketId + '","instructions":[{"selectionId":"' + j + '","handicap":"0","side":"'+ z + '","orderType":"MARKET_ON_CLOSE","marketOnCloseOrd er":{"liability":"' + i + '","persistenceType":"LAPSE"}}],"customerRef":"' + ref + '"},"id": 1}'

                    Comment

                    Working...
                    X