[Python] IBKR Place Order Issue # 8089

Discussão em 'Python' iniciado por Stack, Junho 9, 2025.

  1. Stack

    Stack Membro Participativo

    When I try to place order using following payload and following error although payload is correct, is there something that I need to for placing order on IBKR btw I am using paper trading account


    here the payload used to place the order on limit

    Payload


    {
    "orders": [
    {
    "acctId": "DUM597952",
    "conid": 4815747,
    "conidex": "4815747@SMART",
    "manualIndicator": true,
    "extOperator": "test-operator",
    "secType": "STK",
    "cOID": "NVDA-LMT-BUY-1",
    "orderType": "LMT",
    "price": 195,
    "quantity": 2,
    "side": "BUY",
    "ticker": "NVDA",
    "tif": "DAY",
    "quantity": 1,
    "isSingleGroup": false,
    "outsideRTH": false,
    "isCcyConv": false,
    "listingExchange": "NASDAQ"
    }
    ]
    }


    here is the response when I try to place order

    Response


    {
    "error": "\"BUY 1 NVDA NASDAQ.NMS @ 195.00\"\nCan not contain field # 8089",
    "cqe": {
    "post_payload": {
    "snapshots": [
    {
    "balances": {
    "USD": "249795.2",
    "BASE": "249795.2"
    }
    }
    ],
    "side": "s",
    "rejections": [
    "Can not contain field # 8089"
    ],
    "account_id": "DUM597952",
    "order_currency": "USD",
    "sec_type": "STK",
    "conid": "4815747",
    "exchange": "ISLAND",
    "order_id": "0"
    },
    "request_method": "POST"
    },
    "action": "order_submit_issue"
    }


    here is code which I used to make request to ibkr

    @router.post("/{account_id}/new",)
    def place_order(account_id: str, order_data: OrderRequest):
    """
    Place a trade order on IBKR.
    """
    try:
    logger.info(f"Placing order for account: {account_id}")
    url = f"https://localhost:5000/v1/api/iserver/account/{account_id}/orders"
    response = requests.post(url, json=order_data.dict(), verify=False)
    logger.info(f"✅ Order response: {response.text}")

    # Place the order
    # response = SESSION.post(
    # f"{BASE_URL}/iserver/account/{account_id}/orders",
    # data=json.dumps([order_data.dict()]),
    # headers={"Content-Type": "application/json"}
    # )
    # logger.info("Equity Market Order Response:", response.json())

    if response.status_code == 200:
    return response.json()
    else:
    logger.error(f"Order placement failed: {response.status_code}")
    raise HTTPException(status_code=response.status_code, detail="Failed to place order")

    except requests.RequestException as e:
    logger.error(f"Exception placing order: {e}")
    raise HTTPException(status_code=503, detail="IB Gateway not reachable")



    can some one tell what the issue here ?

    Continue reading...

Compartilhe esta Página