Ib controller $ amount orders

Hello,

I have looked high and low but can't find an answer to this question:

Is there a way I can send a $ amount order through IB Controller instead of specifying the number of shares?

I know IBKR accepts them, but not sure if it can be done via the API and I don't have the technical knowledge to be able to check.

Example:
BUY $10,000 QQQ MOO ?

Thanks a lot!
A-

You could simply use some math (inside AFL):

Quantity = Value / Price; 
// If you would like, you can round down the result using the floor() function.
Quantity = floor(Quantity);

where Price is current (Last) price - i.e. LastValue( Close ) or GetRTValue( "Last")

Thanks for responding @Tomasz

Yes, I am currently using this formula but this transmits to IBKR a number of shares to buy however my question was if we can transmit a $ amount instead.

Is there a way I can send a $ amount order through IB Controller instead of specifying the number of shares?

IKBR App, Web and TWS all allow for that... but I don't know if it allows it through API and don't know how to check either :man_shrugging:

I have some digging and found that the API has a thing called CashQty but I have no clue if it applies to this or not... way over my head here :slight_smile:

The practical relevance is as follows:

Let's say I have a retirement account with $1000 (or just a cash account) and want to buy XYZ with 100% of equity available at the open... so I enter the day prior a GTC MKT order to buy 10 shares because the LastClose is $100... if XYZ gaps up say 5% my order will be rejected...

So we have two go-arounds possible here:

1- Use GetRTValue( "Last") as specified above but it means that I need to be on my PC at the open which is not always possible.

2- Send a Cash Quantity order and let IBKR do the position sizing at the Open...

For margin accounts it makes no difference, so this is just for cash accounts like most retirement accounts in the US.

Just dropping this here in case someone needs it: at this point is not possible to do that.

As I said - it is POSSIBLE to do that (i.e. specify order size in terms of dollars) - just do simple division:

In fact that is what IB would do anyway if you used "cash quantity", simply because you don't buy value, you buy shares.

Maybe I am missing something… practically speaking how would I do the following:

It is now 8pm on a Monday and the market is closed. I want to transmit an order right now to buy next open on QQQ with $10,000 in my IRA.

The IB controller is intended and designed to place orders in real-time, not off-line.

Noted… I missed that in the documentation.

So, it’s currently not possible to transmit an order with $ quantity… the only way to achieve what I described is to position size in real time at the open… maybe in the future :man_shrugging:

Did you check the web:

This: https://stackoverflow.com/questions/65907690/interactive-brokers-tws-api-error-cash-quantity-cannot-be-used-for-this-order

and this: twsapi@groups.io | Placing an order with Cash Qty instead of # Shares

apparently cashQty field in Order structure is for FOREX only and IB doesn't allow using cash quantity for stocks via TWS API (even though TWS UI would handle that by calculating shares = Value/Price )

1 Like

Noted, thanks.

It's a shame they don't allow this through the API because it's possible on the web platform and TWS. It's very practical for cash and retirement accounts.