[R-SIG-Finance] IBrokers - problems getting prices with reqMktData

Stephen Choularton stephen at organicfoodmarkets.com.au
Tue Feb 1 00:14:14 CET 2011


Hi

I am running on windows using an IB workstation with R talking to it.

It all seems to work, but I find that when running my own callback (code 
attached):

   1. I have to make sure I start a clean (new) command windows or
      something goes wrong with the allocation of a transaction id via
      reqIds (Ok I just work around by opening a new command prompt and
   2. (big problem) I don't always get the prices back so the algorithms
      don't always work.  For example this is the output of that code:

[1] "Existing Position: JBH " "18.51"
[3] "MYR "                    "3.65"
[5] "Spread "                 "14.86"
2 -1 2103 Market data farm connection is broken:aufarm
[1] "I HAVE TRADED AT AVERAGE CLOSING SHORT. SELL"
[2] "52"
[3] "JBH. BUY"
[4] "280"
[5] "MYR"
[1] "Time"                    "2011-01-31 15:34:02.373"
[1] "LEI "                                NA
[3] "WOR "                                NA
[5] "Spread "                             NA
[7] "The boundaries are 4.46697721920205" "lower 2.44602278079795"
[9] " mean is 3.4565"
[1] "QBE "                                NA
[3] "AMP "                                NA
[5] "Spread "                             NA
[7] "The boundaries are 13.3779288310757" "lower 12.2030711689243"
[9] " mean is 12.7905"
[1] "QBE "                                NA
[3] "AXA "                                NA
[5] "Spread "                             NA
[7] "The boundaries are 12.1631661762672" "lower 11.1048338237328"
[9] " mean is 11.634"

I'm getting the prices for JBH and MYR but not for the other stocks.  
The boundary/mean figures are hard coded in my function but were 
obtained in a previous IB call but that was a different call 
reqHistoricalData where as this is reqMktData.  My perl code to manage 
that part of the exercise is attached.

One thing I have noticed is that if I get my trader work station to show 
the price and stop and restart my trading.R code I do get a price.  Does 
anyone else have experience of reqMktData not showing prices if they are 
not live on the TWS?
-- 
Stephen Choularton Ph.D., FIoD


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: trading.R
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20110201/48e63050/attachment.pl>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: make.pl
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20110201/48e63050/attachment-0001.pl>


More information about the R-SIG-Finance mailing list