[Quantproject-developers] QuantProject/b4_Business/a2_Strategies WeightedPosition.cs, 1.2, 1.3
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2008-01-14 23:24:51
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv15095/b4_Business/a2_Strategies Modified Files: WeightedPosition.cs Log Message: Added methods: - HasTheSameSignedTickerAs; - HasTheOppositeSignedTickerAs Index: WeightedPosition.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/WeightedPosition.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** WeightedPosition.cs 4 Nov 2007 18:55:39 -0000 1.2 --- WeightedPosition.cs 14 Jan 2008 23:24:48 -0000 1.3 *************** *** 120,126 **** public override string ToString() { ! string toString = this.Ticker + ";" + this.Weight; return toString; } } } --- 120,146 ---- public override string ToString() { ! string toString = this.Ticker + ";" + this.Weight.ToString(); return toString; } + + public bool HasTheSameSignedTickerAs(WeightedPosition weightedPosition) + { + if ( weightedPosition.Ticker == this.Ticker && + ( (weightedPosition.IsLong && this.IsLong) || + (weightedPosition.IsShort && this.IsShort) ) ) + return true; + else + return false; + } + + public bool HasTheOppositeSignedTickerAs(WeightedPosition weightedPosition) + { + if ( weightedPosition.Ticker == this.Ticker && + ( (weightedPosition.IsShort && this.IsLong) || + (weightedPosition.IsLong && this.IsShort) ) ) + return true; + else + return false; + } } } |