DSC-0018 code 32602 Error during bet placement: name 'betfair_api' is not defined

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TigerRoy
    Junior Member
    • Jul 2025
    • 3

    #1

    DSC-0018 code 32602 Error during bet placement: name 'betfair_api' is not defined

    I'm getting the following errors logged when trying to submit a LAY bet on the favourite. PYTHON script.

    2025-07-05 22:00:13,023 ERROR: API Error during bet placement: SportsAPING/v1.0/placeOrders
    Params: {'marketId': '1.245357366', 'instructions': [{'orderType': 'LIMIT', 'selectionId': 81280945, 'side': 'LAY', 'limitOnCloseOrder': {'size': 1.52, 'price': 1.01}, 'persistenceType': 'LAPSE', 'customerRef': 'bsp_lay_1.245357366_81280945'}], 'marketVersion': {'version': 6727062778}}
    Exception: None
    Error: {'code': -32602, 'message': 'DSC-0018'}
    Full Response: {'jsonrpc': '2.0', 'error': {'code': -32602, 'message': 'DSC-0018'}, 'id': 1}
    2025-07-05 22:00:13,024 ERROR: Full Betfair API Response: {
    "jsonrpc": "2.0",
    "error": {
    "code": -32602,
    "message": "DSC-0018"
    },
    "id": 1
    }
    2025-07-05 22:00:13,024 ERROR: Error during bet placement: name 'betfair_api' is not defined

    It's a solid error, I get it every time I attempt a submission.

    Here's my submission bit of the code:

    # Try placing the bet
    latest_book = client.betting.list_market_book([market_id])[0]
    market_version = {'version': latest_book.version}

    place_resp = client.betting.place_orders(
    market_id=market_id,
    instructions=[{
    'orderType':"LIMIT",
    'selectionId':fav_id,
    'side':"LAY",
    'limitOnCloseOrder': {
    'size':stake,
    'price':1.01 #comment
    },
    'persistenceType':"LAPSE", # LAPSE, IOC, etc.
    'customerRef': f'bsp_lay_{market_id}_{fav_id}'
    }],
    market_version=market_version
    )

    It's lost its indentation in translation, but hopefully this gives the gereral idea. I've been trying all sorts of combinations of parameters etc but it has successfully submittted two LAY bets on one iteration, but unfortunately that was early in my testing process and I didn't realise how significant it was and over wrote it before securing the details.

    I was a total newbie to this last week, now its taken over my life. So bear with me if its something obvious.
  • TigerRoy
    Junior Member
    • Jul 2025
    • 3

    #2
    Just a quick update in case someone else comes across this. I've managed to get both back and lay bets submitted automatically now without a problem by simply amending the parameter values. Only thing I can't do is get it to accept a bet at SP, where I get the same DSC-0018 error listed above. I can work around this, but it's a bit annoying.

    Comment

    • jabe
      Senior Member
      • Dec 2014
      • 705

      #3
      Hi TigerRoy
      Just a quick and slightly off-topic note. If you use the Advanced version of the editor (press the blue A icon top right of the message area), there is an option (click on the hash, #) to highlight code and wrap it in tags (or just type the tags) that will denote that it is code and therefore will retain the indents, etc.

      Like this:

      Code:
      do while Tuesday
         print "It's Tuesday"
      end do

      Comment

      Working...
      X