[R-SIG-Finance] ibrokers
Stephen Choularton
stephen at organicfoodmarkets.com.au
Sun Nov 28 06:57:25 CET 2010
I'm having a lot of trouble geting to grips with this. Nothing unusual
but ...
I am trying the five main functions from Jeffrey's paper (IBrokers-
Interactive Brokers and R)
> library(IBrokers)
Loading required package: xts
Loading required package: zoo
> tws <- twsConnect()
> tws
<twsConnection,1 @ 20101128 16:07:16 Eastern Standard Time (New South
Wales), nextId=1>
> reqMktData(tws, twsEquity("CBA", exch='ASX'))
TWS Message: 2 -1 2104 Market data farm connection is OK:cashfarm
TWS Message: 2 -1 2104 Market data farm connection is OK:aufarm
TWS Message: 2 -1 2104 Market data farm connection is OK:usfarm
<20101128 16:09:56.557000> id=1 symbol=CBA highPrice: 0
<20101128 16:09:56.620000> id=1 symbol=CBA lowPrice: 0
<20101128 16:09:57.073000> id=1 symbol=CBA bidPrice: -1.0 bidSize: 0
<20101128 16:09:57.073000> id=1 symbol=CBA askPrice: -1.0 askSize: 0
<20101128 16:09:57.088000> id=1 symbol=CBA bidSize: 0
<20101128 16:09:57.088000> id=1 symbol=CBA askSize: 0
<20101128 16:09:57.088000> id=1 symbol=CBA lastPrice: 47.58
<20101128 16:09:57.088000> id=1 symbol=CBA lastSize: 1403
<20101128 16:09:57.088000> id=1 symbol=CBA lastTimestamp: 1290748224
<20101128 16:09:57.088000> id=1 symbol=CBA highPrice: 0
<20101128 16:09:57.088000> id=1 symbol=CBA lowPrice: 0
<20101128 16:09:57.088000> id=1 symbol=CBA closePrice: 47.58
<20101128 16:09:57.088000> id=1 symbol=CBA openPrice: 0
<20101128 16:09:57.432000> id=1 symbol=CBA optionCallVolume: 1463
<20101128 16:09:57.432000> id=1 symbol=CBA optionPutVolume: 2118
<20101128 16:09:57.448000> id=1 symbol=CBA optionCallOpenInterest: 18531
<20101128 16:09:57.448000> id=1 symbol=CBA optionPutOpenInterest: 35375
<20101128 16:09:57.448000> id=1 symbol=CBA optionHistoricalVol:
0.18530948012748838 NA
<20101128 16:09:57.448000> id=1 symbol=CBA averageVolume: 5097538
<20101128 16:09:57.448000> id=1 symbol=CBA 13-week High: 54.15000153
<20101128 16:09:57.448000> id=1 symbol=CBA 13-week Low: 47.75999832
<20101128 16:09:57.448000> id=1 symbol=CBA 26-week High: 54.15000153
<20101128 16:09:57.448000> id=1 symbol=CBA 26-week Low: 44.62139893
<20101128 16:09:57.448000> id=1 symbol=CBA 52-week High: 57.57139969
<20101128 16:09:57.448000> id=1 symbol=CBA 52-week Low: 44.62139893
<20101128 16:10:22.698000> id=1 symbol=CBA openPrice: 0
<20101128 16:10:22.698000> id=1 symbol=CBA highPrice: 0
<20101128 16:10:22.698000> id=1 symbol=CBA lowPrice: 0
<20101128 16:10:22.698000> id=1 symbol=CBA closePrice: 47.58
> reqHistoricalData(tws, twsEquity("CBA", exch='ASX'))
waiting for TWS reply .....
Error: Unable to complete historical data request
In addition: Warning message:
In errorHandler(con, verbose, OK = c(165, 300, 366, 2104, 2106, :
No security definition has been found for the request.
> reqContractsDetails(tws, twsEquity("CBA", exch='ASX'))
Error: could not find function "reqContractsDetails"
> reqContractDetails(tws, twsEquity("CBA", exch='ASX'))
list()
Warning message:
In reqContractDetails(tws, twsEquity("CBA", exch = "ASX")) :
error in contract details
> reqMktDepth(tws, twsEquity("CBA", exch='ASX'))
TWS Message: 2 1 200 No security definition has been found for the request
> reqRealTimeBars(tws, twsEquity("CBA", exch='ASX'))
TWS Message: 2 1 310 Can't find the subscribed market depth with tickerId:1
TWS Message: 2 1 200 No security definition has been found for the request
reqMktData worked but none of the others did. It could be something as
simple as the market being closed, but maybe someone with more
experience than I can advise me.
Incidentally, can anyone point me to code examples and/or tutorials.
I've read Real Time Market Data and Trade Execution with R by Jeffrey
(and his reference card) but the example 2.5 is missing. I've read Kyle
Matoba's work as well but I would love to find more.
Any help/comments most appreciated.
--
Stephen Choularton Ph.D., FIoD
More information about the R-SIG-Finance
mailing list