Why does Mkt. Price (and by implication Mkt. Value and Unrealized PNL) data

I would like to extend the functionality of IB Controller, and make use of Mkt. Price. However, it does not update in real time, and only seems to update very infrequently.

Is there any way to access real-time market price for a currently opne position?
image

I think that this question might have been answered some time ago, but I can't find the answer.

Paul

Many thanks,
Paul

Hi @polomora

Mkt. Price is an information sent infrequently by IB servers to TWS so clients such as IB Controller can't receive it in real time. As mentioned in TWS API doc here unless there is a position change this information is updated at a fixed interval of three minutes.. If you need it more frequently, simply use the last price provided by your data stream.

Regards.

Many thanks for the reply.
Yes, now I remember, I had forgotten about the infrequent updates. But this applies to the

Blockquote
This information is the exact same as the one displayed within the TWS' Account Window. Note this function receives a specific account along with a flag indicating whether to start or stop the subscription. In a single account structure, the account number is not necessary. Just as with the TWS' Account Window, unless there is a position change this information is updated at a fixed interval of three minutes.

I would like to customise IBController and make use of Mkt. Price. But this is useless if it is only updated every 3 minutes. However, On the TWS screen, the position "Last" price is updated in real-time. Is this data not imported by IBController?

I know that if I use IB as the data source by using the IB plugin, then real-time data is provided to AB, so I assume this means that the real-time data is made available by IB.
Does this mean that this real-time data is not made available to IBController?

If the last traded price is not what you want @polomora - you can also just retrieve the current bid/ask price using AFL Function Reference - GETRTDATA.

You want to be getting the price information for the product from the datafeed, not IBController.

Don't forget though that the counterparty could potentially pull those orders by the time that your order reaches the market and you will get filled at a worse price with a MKT order.

Not as much of an issue in a liquid market but something to think about in a more thinly traded product.

Thanks vmonkey.

Yes I know the AFL function GetRTData(), and I understand that for AFL scripts, using GetRTData is much better than using the IBC function GetPositionInfo() with "Mkt. Price" as parameter.

However, I talking about the C++-based IBController. Is there a way to retrieve the real-time price data for an open position inside IBController?

I know that if I use IB as the data source by using the IB plugin, then real-time data is provided to AB, so I assume this means that the real-time data is made available by IB.
Does this mean that this real-time data is not made available to IBController?

TWS Account window gives you the ability to subscribe to a real-time data feed to update Mkt. Price in real-time so this info overrides the one provided by regular acoount updates. IB Controller does not give this option as it's unnecessary (see above). Anyway, if you would like to personalize it, simply subscribe automatically to receive streaming quotes for every new symbols put in Portfolio (and cancel it when it's removed/position 0). Use API for Top Watchlist/Market Data tick id for last price is 4 see generic ticks list. If you go this way you will quickly realize that it's probably not worth your time.

Good luck

1 Like

Many thanks alligator.
I'll look at this when I have time