[Quantproject-developers] QuantProject/b7_Scripts/TickerSelectionTesting CandidateProperties.cs,NONE
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2005-07-25 22:24:18
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19073/b7_Scripts/TickerSelectionTesting Added Files: CandidateProperties.cs Log Message: Added CandidateProperties class, where to store information on tickers used by the GenomeManagerForEfficientPortfolio. --- NEW FILE: CandidateProperties.cs --- /* QuantProject - Quantitative Finance Library CandidateProperties.cs Copyright (C) 2003 Marco Milletti This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Collections; namespace QuantProject.Scripts.TickerSelectionTesting.EfficientPortfolios { /// <summary> /// This is the class containing basic information /// for each candidate to be evaluated in order /// to discover the efficient frontier /// </summary> [Serializable] public class CandidateProperties { private string ticker; private float[] arrayOfRatesOfReturn; private float[] oppositeArrayOfRatesOfReturn; private bool longRatesOfReturn; public CandidateProperties(string ticker, float[] arrayOfRatesOfReturn) { this.ticker = ticker; this.longRatesOfReturn = true; this.arrayOfRatesOfReturn = arrayOfRatesOfReturn; } private float[] arrayOfRatesOfReturn_getOppositeArrayOfRatesOfReturn() { if(this.oppositeArrayOfRatesOfReturn == null) //opposite array of rates of returns not set yet { this.oppositeArrayOfRatesOfReturn = new float[this.arrayOfRatesOfReturn.Length]; for(int i = 0; i<this.arrayOfRatesOfReturn.Length; i++) oppositeArrayOfRatesOfReturn[i] = -this.arrayOfRatesOfReturn[i]; } return this.oppositeArrayOfRatesOfReturn; } public float[] ArrayOfRatesOfReturn { get { float[] returnValue = this.arrayOfRatesOfReturn; if(!this.longRatesOfReturn) returnValue = this.arrayOfRatesOfReturn_getOppositeArrayOfRatesOfReturn(); return returnValue; } } public bool LongRatesOfReturn { set{this.longRatesOfReturn = value;} get{return this.longRatesOfReturn;} } public string Ticker { get{return this.ticker;} } } } |