Need some pointers with IB API

rca420

Newbie
Messages
5
Likes
0
Hi all,

I'm in the process of coding up my trading platform using IB's API in java. My strategy looks at the previous 10 (5 minutes bar) to determine entry. I just can't figure out a way to aggregate the info from reqRealTimeBars (5 seconds interval) to a 5 minute info. I understand I need to collect 60 instances of RealTimeBars callback which I have absolutely no problem in doing, but the problem is... How the heck should I approach in storing until the 5 minute mark hits and make it into one 5 minute "bar"? Much thanks and I hope i did a good job explaining it.
 
whats the respond for the reqRealTimeBars? i dont know what datatype is IB API returning to you, but in general i would store it into some array. Something like this:

1. making my own datatype as a class, for example RealTimeBar
2. making collection of RealTimeBars, like RTBCollection (extended by java.util.array)
3. initializing something like timeBars5Min = new RTBCollection(); and also unfinished5MinTB = new RTBCollection(60);
4. and coding something like this

realTimeBar = new RealTimeBar ();
realTimeBar = reqRealTimeBars();
if (!unfinished5MinTB.isFull())
{unfinished5MinTB.add(realTimeBar);}
else
{timeBars5Min.add(unfinished5MinTB);
unfinished5MinTB = new RTBCollection();
unfinished5MinTB.add(realTimeBar);}
 
Last edited:
Top