[Quantproject-developers] QuantProject/b4_Business/a2_Strategies AccountManager.cs, 1.4, 1.5
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2008-02-06 20:42:16
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv28657/a2_Strategies Modified Files: AccountManager.cs Log Message: Added a new Overloaded method for OpenPositions: it is now possible to add cash. Index: AccountManager.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/AccountManager.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AccountManager.cs 14 Jan 2008 23:23:05 -0000 1.4 --- AccountManager.cs 6 Feb 2008 20:42:12 -0000 1.5 *************** *** 83,103 **** } /// <summary> ! /// Modifies the state for the given account, ! /// opening positions provided by the given weightedPositions ! /// </summary> ! static public void OpenPositions(WeightedPositions weightedPositions, ! Account account) ! { if(account.CashAmount == 0.0 && account.Transactions.Count == 0) ! account.AddCash(15000); if(weightedPositions == null || account == null) throw new Exception("Both parameters have to be set to valid objects!"); orders.Clear(); double valueToInvestInPositions = account.CashAmount; ! foreach(WeightedPosition weightedPosition in weightedPositions.Values) ! addWeightedPositionToOrderList( weightedPosition, account, valueToInvestInPositions ); ! foreach(object item in orders) ! account.AddOrder( (Order)item ); ! } #endregion --- 83,113 ---- } /// <summary> ! /// Modifies the state for the given account, ! /// opening positions provided by the given weightedPositions ! /// </summary> ! static public void OpenPositions(WeightedPositions weightedPositions, ! Account account, double cashToAdd) ! { if(account.CashAmount == 0.0 && account.Transactions.Count == 0) ! account.AddCash(cashToAdd); if(weightedPositions == null || account == null) throw new Exception("Both parameters have to be set to valid objects!"); orders.Clear(); double valueToInvestInPositions = account.CashAmount; ! foreach(WeightedPosition weightedPosition in weightedPositions.Values) ! addWeightedPositionToOrderList( weightedPosition, account, valueToInvestInPositions ); ! foreach(object item in orders) ! account.AddOrder( (Order)item ); ! } ! ! /// <summary> ! /// Modifies the state for the given account, ! /// opening positions provided by the given weightedPositions ! /// </summary> ! static public void OpenPositions(WeightedPositions weightedPositions, ! Account account) ! { ! OpenPositions(weightedPositions, account, 15000); ! } #endregion |