Profile Picture

IBarDataStorage.LoadBars() clarification

Posted By Zora 7 Years Ago
Message
Posted Thursday January 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 Friday January 29 2010
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 Friday January 29 2010
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 Saturday January 30 2010
Thank you, this helps a lot.


Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems