[R-SIG-Finance] IBrokers - functions: eWrapper and CALLBACKS

Stephen Choularton stephen at organicfoodmarkets.com.au
Tue Apr 5 01:42:28 CEST 2016


Hi Robert

Thanks for the reply.  I was assuming that the package was OK as my 
experience with programming nearly always turns out to demonstrate its 
my fault ;-(

My problem is I don't really understand how eWrapper and CALLBACKS work 
together.  I find if I can work on existing code like that I found for 
trading based on on it I can get somewhere. I found something and ended 
up with this call:

reqMktData(con, list(twsEquity(symbol=sym1, exch='ASX', 
currency='AUD'),twsEquity(symbol=sym2, exch='ASX', currency='AUD')),  
eventWrapper=eWrapper.data(2), CALLBACK=CO_INT_N_REV)

and managed to put everything I wanted inside the callback.  I'd love to 
find something similar on reqMktDepth as at the moment I can only manage 
these sorts of calls:

reqMktDepth(tws, contract, 
file="C:\\Users\\Stephen\\Documents\\R\\current working market 
depth\\ticks.txt")
reqMktDepth(tws, contract, 
eventWrapper=eWrapper.MktDepth.CSV(),file="C:\\Users\\Stephen\\Documents\\R\\current 
working market depth\\ticks1.txt")


and I would love to be able to write a callback.

In addition I am desperate to find something on 'has the order been 
closed?' just like you.

Maybe someone can point us to some code that we can work with.

Stephen


----------------------------------------------------------------------------------------------------------------------------------- 

Stephen Choularton PhD, FIoD



On 4/04/2016 11:47 PM, Robert Schien wrote:
> On Fri, Apr 01, 2016 at 03:06:27PM +1100, Stephen Choularton wrote:
>> Hi
>>
>> I am trying to program various algorithms using such calls as reqMktData
>> - where I have working code with a loop that appears to be working - but
>> when I try and use something like reqOpenOrders I can get a result to
>> the screen but I am having great difficulty getting at that information
>> and using it.
>>
>> I wondered if someone could point me to anything like Jeff Ryan's pdf
>> Real Time Trading in R which concentrates on how the callback works
>> using the eWrapper and processMsg.
>>
>> Hope someone can point me to something useful.
>>
>> Stephen Choularton PhD, FIoD
> Hi Stephen,
>
> I think there are bugs in the IBrokers package and/or not all
> functions alre corrrectly or fully implemented.
> I have the same problem: I want to check the order status (order filled
> and fill price) but am out of luck.
>
> Therefore it's not possible to automatically trade and check orders.
>
> Unless someone fixes these problems you have to switch to other
> platforms (Java, Python, C++) etc.
>
> It is quite sad, because R is such a nice and elegant platform
> otherwise.
>
> Greetings
> Robert
>
> _______________________________________________
> 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.
>



More information about the R-SIG-Finance mailing list