Sending orders using HTTP api to IB - "no account specified for order"

I have a pretty low-frequency program I am trying to trade on IB. It seems that the HTTP api is well suited for this and it minimizes deployment and dependency management issues. I get market data from a couple of third parties also via REST so this is nice on paper.

I am able to query my account balance at IB via the HTTP api, my QR installation seems to be up and running. When I enter the command to list my IB accounts, both accounts are listed.

I have some code which attempts to send some orders and it attaches the account, but I get an error 400 and a message that say no account specified, despite the account being send in "account":"UXXX" tag.

The documentation doesnt speak to this directly, but I am new to quant rocket and am having a hard time finding out how to do things.

thanks
George Coles

I think I had some case sensitivity issues. I am trying to relate IB Algo order documentation to quant rocket documentation to send Adaptive orders but I am flying blind. Here is an example order: {'Account': 'U4296736', 'Action': 'BUY', 'Sid': 'FIBBG014HVF3N5', 'OrderRef': 'volopening', 'OrderType': 'MKT', 'AlgoStrategy': 'Adaptive', 'TotalQuantity': 5126, 'Tif': 'Day', 'Exchange': 'SMART', 'AlgoParams': {'AdaptivePriority': 'Urgent'}}

now I get return code 200 but and error back from ib which is just 6001:1. I cant find a reference to this error code on their web site.

thx

6001:1 is not an error code, it's the order ID. Here's what the docs say about order IDs:

When you place orders, the blotter generates and returns unique order IDs for each order. The structure of order IDs varies by broker. Orders IDs are used internally by the blotter and can be used to check order statuses or cancel orders. You can also check order statuses or cancel orders based on other lookups such as the order ref, account, or sid, so it is typically not necessary to hold on to the order IDs.

IBKR execution algo are discussed here. You structured the algo params correctly.

You're correct that field names are case sensitive.

ok thank you very much for the feedback. these orders are failing with no apparent error message from IB in the response object. And the orders dont show up in TWS at all.

When placing an order, only the order ID will be returned. To see why the order might have failed, use the order ID (or sid or account or order ref) to query the order status. With the CLI:

quantrocket blotter status --order-ids 6001:1

Also make sure to keep QuantRocket connected to IB Gateway while the order is active so it can receive order status updates. Hopefully you've set up and can use a separate login to open TWS.

1 Like