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

Stephen Choularton stephen at organicfoodmarkets.com.au
Thu Feb 3 04:44:53 CET 2011


OK, I have had the opportunity to do some testing and it appears that 
Ibrokers will only pick up reqMktData (at least on ASX stocks) when they 
are also being monitored in the TWS.  I had already established that 
transaction ids are difficult to come by unless you commence a new 
process (at least in windows) so the take home from that, until I or 
someone else has the time to look into it, is that you should always 
start a new command prompt to run R at if you want to deal and also you 
should have any stocks you want to get the prices of into R being 
monitored in the TWS on your computer.  Hope that helps anyone trying to 
set up on a windows machine maybe its the same on other os's.

Stephen Choularton Ph.D., FIoD


On 01/02/2011 12:23 PM, Joshua Ulrich wrote:
> Stephen,
>
> You're asking others to do an awful lot of work for you for free and
> in their spare time.  You're asking others to help debug ~800 lines of
> your code (not just R, but Perl as well!).  I would be surprised if
> anyone helps you with this (unless the issue is obvious to them).
>
> I don't say this to chide, but to help you ask questions that are more
> likely to be answered.  Someone will be much more likely to help you
> if you create a minimal example (without Perl) that replicates this
> issue with your callback code.
>
> Best,
> --
> Joshua Ulrich  |  FOSS Trading: www.fosstrading.com
>
>
>
> On Mon, Jan 31, 2011 at 5:14 PM, Stephen Choularton
> <stephen at organicfoodmarkets.com.au>  wrote:
>> 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
>>
>>
>>
>> _______________________________________________
>> R-SIG-Finance at 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.
>>
>
>
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 10.0.1204 / Virus Database: 1435/3414 - Release Date: 01/31/11
>
>
>



More information about the R-SIG-Finance mailing list