RightEdge Forums
Main     Home          Members     Calendar     Who's On

Welcome Guest
        



IBarDataStorage.LoadBars() clarification Expand / Collapse
Message
Posted 1/28/2010 15:01:20 Post #10623
 

Forum GuruForum GuruForum GuruForum GuruForum GuruForum GuruForum GuruForum Guru
Guys, could you please post either a sample implementation of LoadBars() for RE ed.2 or an explanation of how it works for different values of arguments, such as loadFromEnd, maxLoadBars. The current API doc doesn't really go into a lot of detail. I'm fixing my data storage plugin and want to make sure that I get it right. Specifically, in what order and how many bars should be loaded when we call:

LoadBars(symbolFreq, valid archive date, 12/31/9999, 5000, false);
LoadBars(symbolFreq, 1/01/0001, 12/31/9999, 1, true);
LoadBars(symbolFreq, valid archive date, 12/31/9999, 0, true);

and any other combinations used within RE. Thank you!
Posted 1/29/2010 10:11:12 Post #10629
 

Lead DeveloperLead DeveloperLead DeveloperLead DeveloperLead DeveloperLead DeveloperLead DeveloperLead Developer
The first case would load 5000 bars from the start date, assuming there are at least 5000, otherwise, all it can give you.
Second case loads the last bar.
Third case loads all of the bars from the most current date to the start date.

Zora (1/28/2010)
Guys, could you please post either a sample implementation of LoadBars() for RE ed.2 or an explanation of how it works for different values of arguments, such as loadFromEnd, maxLoadBars. The current API doc doesn't really go into a lot of detail. I'm fixing my data storage plugin and want to make sure that I get it right. Specifically, in what order and how many bars should be loaded when we call:

LoadBars(symbolFreq, valid archive date, 12/31/9999, 5000, false);
LoadBars(symbolFreq, 1/01/0001, 12/31/9999, 1, true);
LoadBars(symbolFreq, valid archive date, 12/31/9999, 0, true);

and any other combinations used within RE. Thank you!
Posted 1/29/2010 10:12:24 Post #10630
 

Lead DeveloperLead DeveloperLead DeveloperLead DeveloperLead DeveloperLead DeveloperLead DeveloperLead Developer
Also, here is how the Binary data store handles the logic in Load.  Obviously this wouldn't compile for you, but I think you can follow the same logic path.

long seekStart;

long seekLength;

SeekDates(br, start, end, out seekStart, out seekLength);

 

if (seekLength <= 0)

{

       // This seems to happen if we don't find a start date

       // So basically, we have no data.

       return itemCollection;

}

 

//     Check if there is a maximum number of bars we should load

if (maxItems > 0)

{

       long itemsFound = (seekLength / _itemSize);

       if (itemsFound > maxItems)

       {

              if (loadFromEnd)

              {

                     long skipItems = itemsFound - maxItems;

                     seekStart += skipItems * _itemSize;

                     seekLength = maxItems * _itemSize;

              }

              else

              {

                     seekLength = maxItems * _itemSize;

              }

       }

}

Posted 1/30/2010 21:19:10 Post #10651
 

Forum GuruForum GuruForum GuruForum GuruForum GuruForum GuruForum GuruForum Guru
Thank you, this helps a lot.
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: billb, dplaisted

Permissions Expand / Collapse

All times are GMT -5:00, Time now is 6:02pm

2005-2007 © RightEdge Systems