dis
-Interested User-
Posts: 24
Joined: Apr 16, 2007
|
Posted: Apr 16, 2007 08:08 AM
Msg. 1 of 3
Hello Support,
I have a few problems requesting N minute/intraday bars. As I can use only the RequestMinuteHistory(..) method, I need to calculate the number of days containing a required number of bars. I need price data for different periodicities (1min, 3min, 6 min and so on). I'm setting the constant value BarsInDay, for now its value is 50. Then I'm calculating NumberOfDays by the following formula: NumberOfDays = NumberOfBars / BarsInDay * Periodicity. However, it’s look like a bad solution as I'm getting some more or less bars now and then. Is there a better way for requesting N intraday/minute bars of different periodicity?
Your help in this regard would be appreciated
|
DTN_Steve_S
-DTN Guru-
Posts: 2093
Joined: Nov 21, 2005
|
Posted: Apr 16, 2007 08:56 AM
Msg. 2 of 3
The servers only send you data bars for intervals that trade so there is no way of knowing how many data bars the servers are going to send unless you know this information previously.
If you are wanting to give your users an option of "show MSFT broken into 50 intraday bars per day", the only way I can think to do this accurately would be request tick data and build your own bars. Unfortunately this could lead to a tremendous amount of data and processing.
Every other option (that I can think of) would lead to inaccurate data.
|
JDonovan
-Interested User-
Posts: 24
Joined: Feb 11, 2007
|
Posted: Apr 17, 2007 08:07 AM
Msg. 3 of 3
Try this:
int NumDays=NumberOfBars /(int)(((double)MinutesInTradingDay/(double)Periodicity)); NumDays+=1;
Where MinutesInTradingDay = 390 (normal trading hours) and NumberOfBars is the max (or total) number of bars you want returned.
I think that's what you're looking for but not 100% certain based on the way the question was worded....
- Jeff Edited by JDonovan on Apr 17, 2007 at 08:18 AM
|