Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/TickersRelationships
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv1509/a2_Strategies/TickersRelationships
Modified Files:
CloseToCloseCorrelationProvider.cs CorrelationProvider.cs
Log Message:
Fixed minor bug in CorrelationProvider objects
Index: CloseToCloseCorrelationProvider.cs
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/TickersRelationships/CloseToCloseCorrelationProvider.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** CloseToCloseCorrelationProvider.cs 14 Jan 2008 23:02:30 -0000 1.1
--- CloseToCloseCorrelationProvider.cs 12 Mar 2008 21:56:07 -0000 1.2
***************
*** 62,66 ****
string benchmark) :
base(tickersToAnalyze,
! startDate, endDate,
minimumAbsoluteReturnValue, maximumAbsoluteReturnValue,
benchmark)
--- 62,66 ----
string benchmark) :
base(tickersToAnalyze,
! startDate, endDate, closeToCloseIntervalLength,
minimumAbsoluteReturnValue, maximumAbsoluteReturnValue,
benchmark)
Index: CorrelationProvider.cs
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/TickersRelationships/CorrelationProvider.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** CorrelationProvider.cs 30 Jan 2008 23:11:32 -0000 1.2
--- CorrelationProvider.cs 12 Mar 2008 21:56:08 -0000 1.3
***************
*** 49,54 ****
--- 49,67 ----
protected EndOfDayDateTime firstEndOfDayDateTime;
protected EndOfDayDateTime lastEndOfDayDateTime;
+ protected int returnIntervalLength;
protected string benchmark;
+
+ private void correlationProvider_commonInitialization(string[] tickersToAnalyze,
+ float minimumAbsoluteReturnValue, float maximumAbsoluteReturnValue)
+ {
+ this.tickers = tickersToAnalyze;
+ this.minimumAbsoluteReturnValue = minimumAbsoluteReturnValue;
+ this.maximumAbsoluteReturnValue = maximumAbsoluteReturnValue;
+ this.numOfCombinationTwoByTwo =
+ (int)((Math.Pow(this.tickers.Length, 2) - this.tickers.Length ) / 2);
+ }
+
+
/// <summary>
/// Creates the correlation provider
***************
*** 65,83 ****
/// of returns</param>
public CorrelationProvider(string[] tickersToAnalyze,
! DateTime startDate, DateTime endDate,
float minimumAbsoluteReturnValue, float maximumAbsoluteReturnValue,
string benchmark)
{
! this.tickers = tickersToAnalyze;
! this.setEndOfDayDatesTime(startDate, endDate);
! this.minimumAbsoluteReturnValue = minimumAbsoluteReturnValue;
! this.maximumAbsoluteReturnValue = maximumAbsoluteReturnValue;
this.benchmark = benchmark;
-
- this.numOfCombinationTwoByTwo =
- (int)((Math.Pow(this.tickers.Length, 2) - this.tickers.Length ) / 2);
- this.setReturnsManager();
}
/// <summary>
/// Creates the correlation provider
--- 78,104 ----
/// of returns</param>
public CorrelationProvider(string[] tickersToAnalyze,
! DateTime startDate, DateTime endDate, int returnIntervalLength,
float minimumAbsoluteReturnValue, float maximumAbsoluteReturnValue,
string benchmark)
{
! this.correlationProvider_commonInitialization(tickersToAnalyze,
! minimumAbsoluteReturnValue, maximumAbsoluteReturnValue);
! this.setEndOfDayDatesTime(startDate,endDate);
! this.returnIntervalLength = returnIntervalLength;
this.benchmark = benchmark;
}
+ public CorrelationProvider(string[] tickersToAnalyze,
+ DateTime startDate, DateTime endDate,
+ float minimumAbsoluteReturnValue, float maximumAbsoluteReturnValue,
+ string benchmark)
+ {
+ this.correlationProvider_commonInitialization(tickersToAnalyze,
+ minimumAbsoluteReturnValue, maximumAbsoluteReturnValue);
+ this.setEndOfDayDatesTime(startDate,endDate);
+ this.returnIntervalLength = 1;
+ this.benchmark = benchmark;
+ }
+
/// <summary>
/// Creates the correlation provider
***************
*** 94,106 ****
float minimumAbsoluteReturnValue, float maximumAbsoluteReturnValue )
{
! this.tickers = tickersToAnalyze;
this.returnsManager = returnsManager;
- this.minimumAbsoluteReturnValue = minimumAbsoluteReturnValue;
- this.maximumAbsoluteReturnValue = maximumAbsoluteReturnValue;
-
- this.numOfCombinationTwoByTwo =
- (int)((Math.Pow(this.tickers.Length, 2) - this.tickers.Length ) / 2);
}
!
protected abstract void setEndOfDayDatesTime(DateTime startDate, DateTime endDate);
protected abstract void setReturnsManager();
--- 115,125 ----
float minimumAbsoluteReturnValue, float maximumAbsoluteReturnValue )
{
! this.correlationProvider_commonInitialization(tickersToAnalyze,
! minimumAbsoluteReturnValue, maximumAbsoluteReturnValue);
this.returnsManager = returnsManager;
}
!
!
!
protected abstract void setEndOfDayDatesTime(DateTime startDate, DateTime endDate);
protected abstract void setReturnsManager();
***************
*** 154,157 ****
--- 173,178 ----
protected void getOrderedTickersPearsonCorrelations_setCorrelations()
{
+ if(this.returnsManager == null)
+ this.setReturnsManager();
this.pearsonCorrelations =
new TickersPearsonCorrelation[ this.numOfCombinationTwoByTwo ];
|