Re: [GT] days between start and end From: Chris Beggy - 2003-06-28 04:40 ```On 27 Jun 2003, Christopher Willmot wrote: > On Friday 27 June 2003 2:22 pm, Chris Beggy wrote: > > How can I calculate the number of days (or timeframe units) > > between a start and an end of a portfolio analysis period? My > > goal is to be able to generate some expected returns/yr or > > #trades/year over periods greater or less than one year. > > Doesn't Date::Calc do that? Date::Pcalc, too. We also have calendar math in GT which specifically accounts for different timeframes, so I'd like to stick with those functions, if possible. We also have another issue of trading days vs. calendar days, but for most purposes, calendar days are preferable. Chris ```

 Re: [GT] days between start and end From: Raphael Hertzog - 2003-06-27 18:03 ```Le Fri, Jun 27, 2003 at 10:22:14AM -0400, Chris Beggy écrivait: > How can I calculate the number of days (or timeframe units) > between a start and an end of a portfolio analysis period? My > goal is to be able to generate some expected returns/yr or > #trades/year over periods greater or less than one year. > > I've looked in Portfolio.pm, Calculator.pm, DB.pm and I can't seem > to find a function that does that. > > If this isn't available, what's a good perl module for doing > calendar math? I'm sure there's something that can do: > > YYYY-MM-DD - YYYY-MM-DD2 = days Something like that (cf backtest.pl or any script which accept a start and end date) : my \$date1 = \$calc->prices->find_nearest_following_date(\$start); \$first = \$calc->prices->date(\$date1); my \$date2 = \$calc->prices->find_nearest_preceding_date(\$end); \$last = \$calc->prices->date(\$date2); print "Length: " . (\$last - \$first); Cheers, -- Raphaël Hertzog -+- http://www.ouaza.com Formation Linux et logiciel libre : http://www.logidee.com Earn money with free software: http://www.geniustrader.org ```
 Re: [GT] days between start and end From: Christopher Willmot - 2003-06-27 23:49 ```On Friday 27 June 2003 2:22 pm, Chris Beggy wrote: > How can I calculate the number of days (or timeframe units) > between a start and an end of a portfolio analysis period? My > goal is to be able to generate some expected returns/yr or > #trades/year over periods greater or less than one year. Doesn't Date::Calc do that? ```
 Re: [GT] days between start and end From: Chris Beggy - 2003-06-28 04:40 ```On 27 Jun 2003, Christopher Willmot wrote: > On Friday 27 June 2003 2:22 pm, Chris Beggy wrote: > > How can I calculate the number of days (or timeframe units) > > between a start and an end of a portfolio analysis period? My > > goal is to be able to generate some expected returns/yr or > > #trades/year over periods greater or less than one year. > > Doesn't Date::Calc do that? Date::Pcalc, too. We also have calendar math in GT which specifically accounts for different timeframes, so I'd like to stick with those functions, if possible. We also have another issue of trading days vs. calendar days, but for most purposes, calendar days are preferable. Chris ```