[Quantproject-developers] QuantProject/b1_ADT/Histories History.cs,1.3,1.4
Brought to you by:
glauco_1
|
From: <mi...@us...> - 2003-12-17 19:34:59
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Histories
In directory sc8-pr-cvs1:/tmp/cvs-serv24844/b1_ADT/Histories
Modified Files:
History.cs
Log Message:
Removed file Stat.cs. The same functions are now in the new file BasicFunctions.cs under the Statistics folder. Added new method to Instrument class and to the History class. Fixed some bugs
Index: History.cs
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Histories/History.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** History.cs 17 Dec 2003 14:17:59 -0000 1.3
--- History.cs 17 Dec 2003 19:34:55 -0000 1.4
***************
*** 25,28 ****
--- 25,29 ----
using System.Data;
using QuantProject.ADT;
+ using QuantProject.ADT.Statistics;
***************
*** 89,92 ****
--- 90,103 ----
return (DateTime) this.GetKey( this.IndexOfKeyOrPrevious( dateTime ) + 1 );
}
+ //millo
+ public DateTime GetDay( DateTime initialDateTime, int numberOfDaysAhead )
+ {
+ if ( this.IndexOfKey( initialDateTime ) >= ( this.Count - numberOfDaysAhead ) )
+ // return the last dateTime in the history
+ return (DateTime) this.GetKey(this.Count -1);
+ else
+ return (DateTime) this.GetKey( this.IndexOfKeyOrPrevious( initialDateTime ) + numberOfDaysAhead );
+ }
+ //millo
#region "Millo_1 - SimpleAverage and StandardDeviation"
***************
*** 109,112 ****
--- 120,124 ----
data[i] = Convert.ToDouble(this.GetByIndex(index));
i++;
+ index++;
//simpleAverage.Add(this.GetKey( index ), null);
}
***************
*** 114,120 ****
{
i = 0;
! simpleAverage.Add( dateTime , Stat.SimpleAverage(data) );
}
- index++;
checkValue = Math.Floor(index/onEachPeriodOf);//update checkValue
}
--- 126,131 ----
{
i = 0;
! simpleAverage.Add( dateTime , BasicFunctions.SimpleAverage(data) );
}
checkValue = Math.Floor(index/onEachPeriodOf);//update checkValue
}
***************
*** 140,143 ****
--- 151,155 ----
data[i] = Convert.ToDouble(this.GetByIndex(index));
i++;
+ index++;
//stdDev.Add(this.GetKey( index ), null);
}
***************
*** 145,151 ****
{
i = 0;
! stdDev.Add( dateTime , Stat.StdDev (data) );
}
- index++;
checkValue = Math.Floor(index/onEachPeriodOf);//update checkValue
}
--- 157,162 ----
{
i = 0;
! stdDev.Add( dateTime , BasicFunctions.StdDev (data) );
}
checkValue = Math.Floor(index/onEachPeriodOf);//update checkValue
}
|