[R-SIG-Finance] IBrokers - reqMktData - snapshot

diego peroni d|egoperon|1971 @end|ng |rom gm@||@com
Mon Dec 14 08:32:54 CET 2020


Hi Josh,

Thanks for you answer… :-)

I’ve an IB account for NYMEX futures and snapshot requests works for all instruments:

ex.
fut = twsFUT(symbol="NQ", exch="GLOBEX", expiry="202012")
snapshot = reqMktData_modified(tws, fut, snapshot=TRUE)

If I select others markets or instruments (where I don’t have real time data):

reqMktDataType(tws, 3)
fut = twsFUT("KC", exch="NYBOT", expiry="202103")
snapshot = reqMktData_modified(tws, fut, snapshot=TRUE)

But I have to change ticker mapping:
Delayed Bid	66	Delayed bid price. See Market Data Types <https://interactivebrokers.github.io/tws-api/market_data_type.html>.	IBApi.EWrapper.tickPrice <https://interactivebrokers.github.io/tws-api/interfaceIBApi_1_1EWrapper.html#ae851ec3a1e0fa2d0964c7779b0c89718>	-
Delayed Ask	67	Delayed ask price. See Market Data Types <https://interactivebrokers.github.io/tws-api/market_data_type.html>.	IBApi.EWrapper.tickPrice <https://interactivebrokers.github.io/tws-api/interfaceIBApi_1_1EWrapper.html#ae851ec3a1e0fa2d0964c7779b0c89718>	-
Delayed Last	68	Delayed last traded price. See Market Data Types <https://interactivebrokers.github.io/tws-api/market_data_type.html>.	IBApi.EWrapper.tickPrice <https://interactivebrokers.github.io/tws-api/interfaceIBApi_1_1EWrapper.html#ae851ec3a1e0fa2d0964c7779b0c89718>	-
Delayed Bid Size	69	Delayed bid size. See Market Data Types <https://interactivebrokers.github.io/tws-api/market_data_type.html>.	IBApi.EWrapper.tickSize <https://interactivebrokers.github.io/tws-api/interfaceIBApi_1_1EWrapper.html#a1844eb442fb657c0f2cc0a63e4e74eba>	-
Delayed Ask Size	70	Delayed ask size. See Market Data Types <https://interactivebrokers.github.io/tws-api/market_data_type.html>.	IBApi.EWrapper.tickSize <https://interactivebrokers.github.io/tws-api/interfaceIBApi_1_1EWrapper.html#a1844eb442fb657c0f2cc0a63e4e74eba>	-
Delayed Last Size	71	Delayed last size. See Market Data Types <https://interactivebrokers.github.io/tws-api/market_data_type.html>.	IBApi.EWrapper.tickSize <https://interactivebrokers.github.io/tws-api/interfaceIBApi_1_1EWrapper.html#a1844eb442fb657c0f2cc0a63e4e74eba>	-
Delayed High Price	72	Delayed highest price of the day. See Market Data Types <https://interactivebrokers.github.io/tws-api/market_data_type.html>.	IBApi.EWrapper.tickPrice <https://interactivebrokers.github.io/tws-api/interfaceIBApi_1_1EWrapper.html#ae851ec3a1e0fa2d0964c7779b0c89718>	-
Delayed Low Price	73	Delayed lowest price of the day. See Market Data Types <https://interactivebrokers.github.io/tws-api/market_data_type.html>	IBApi.EWrapper.tickPrice <https://interactivebrokers.github.io/tws-api/interfaceIBApi_1_1EWrapper.html#ae851ec3a1e0fa2d0964c7779b0c89718>	-
Delayed Volume	74	Delayed traded volume of the day. See Market Data Types <https://interactivebrokers.github.io/tws-api/market_data_type.html>

I know that real IB "Snapshot Market Data" service (0.03 cents per request) works just for the following instruments (does not exists for ICE/NYBOT):

https://ibkr.info/article/2830 <https://ibkr.info/article/2830>

——————————

I’ve found that updatePortfolio doesn’t work with my TWS and I’ve remapped the following tickers:

    portfolioValue = list()
    portfolioValue$position = as.numeric(msg[13])
    portfolioValue$marketPrice = as.numeric(msg[14])
    portfolioValue$marketValue = as.numeric(msg[15])
    portfolioValue$averageCost = as.numeric(msg[16])
    portfolioValue$unrealizedPNL = as.numeric(msg[17])
    portfolioValue$realizedPNL = as.numeric(msg[18])
    portfolioValue$accountName = msg[19]

I’m not sure that’s the right way to fix the problem or not…
Let me know if I’m wrong.

Thanks for your help!

Regards

Diego





> On 13 Dec 2020, at 17:35, Joshua Ulrich <josh.m.ulrich using gmail.com> wrote:
> 
> Hi Diego,
> 
> Can you give me an example of a snapshot request that works for you
> when you remove the stop()?
> 
> Thanks,
> Josh
> 
> On Fri, Dec 11, 2020 at 5:26 AM diego peroni <diegoperoni1971 using gmail.com> wrote:
>> 
>> Hi all,
>> I’m using IBrokers package from GITHUB ("joshuaulrich/IBrokers")
>> 
>> I’ve found in the code this line that BLOCKs every snapshot data request.
>> 
>> ——————————————————————————
>> if(snapshot == "1") {
>>   stop("Snapshot not working (?)”)
>> ——————————————————————————
>> 
>> Is there a reason for that?
>> 
>> Removing this line the snapshot requests works for me….
>> 
>> Thanks for your help.
>> 
>> Diego
>>        [[alternative HTML version deleted]]
>> 
>> _______________________________________________
>> R-SIG-Finance using r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>> -- Subscriber-posting only. If you want to post, subscribe first.
>> -- Also note that this is not the r-help list where general R questions should go.
> 
> 
> 
> -- 
> Joshua Ulrich  |  about.me/joshuaulrich
> FOSS Trading  |  www.fosstrading.com


	[[alternative HTML version deleted]]



More information about the R-SIG-Finance mailing list