[R-SIG-Finance] variable scope with ewrapper in IBrokers

Jeff Ryan jeff.a.ryan at gmail.com
Mon Jul 18 20:23:25 CEST 2011


Hi Noah,

I'll provide a complete example when I am back at my desk, but the eWrapper itself contains all you need to do this. 

Take a look t eWrapper.data for now. In effect you need to rbind incoming values to an object stored in the .Data variable. Again I'll provide more detail to this when I get back, but simply put it is trivial to accomplish once you see how it is done. 

Best,
Jeff

Jeffrey Ryan    |    Founder    |    jeffrey.ryan at lemnica.com

www.lemnica.com

On Jul 18, 2011, at 12:43 PM, "Brian G. Peterson" <brian at braverock.com> wrote:

> On Mon, 2011-07-18 at 10:36 -0700, Noah Silverman wrote:
>> The documentation has a nice example about copying and then modifying
>> the ewrapper function to handle incoming data.  This works nicely.
>> 
>> My challenge is that I want to store some persistant values (update
>> moving averages, etc.)
>> 
>> Since ewrapper()  is called for every tick by reqMktData(), I can't
>> figure out the best way to keep some persistent variables.
>> 
>> How have other people handled this? 
> 
> One 'R-like' method for dealing with this would be to create an
> environment to store these things in and update a variable in that
> environment.
> 
> Regards,
> 
>   - Brian
> 
> -- 
> Brian G. Peterson
> http://braverock.com/brian/
> Ph: 773-459-4973
> IM: bgpbraverock
> 
> _______________________________________________
> 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