/// <summary> /// An overload of the <see cref="M:B4F.TotalGiro.Accounts.AccountTypeInternal.OpenOrderAmount">OpenOrderAmount</see> method. /// With this method it is possible to return either the total nett or total gross open order amount. /// And it is possible to filter on either buy, sell or both orders. /// </summary> /// <param name="retVal">Value determines if either the gross or nett value is returned</param> /// <param name="sideFilter">Value determines which orders are included depending on the <see cref="T:B4F.TotalGiro.Orders.Side">side</see> of the order</param> /// <returns>The amount in base currency</returns> public virtual Money OpenOrderAmount(OpenOrderAmountReturnValue retVal, OrderSideFilter sideFilter) { ICurrency baseCur = AccountOwner.StichtingDetails.BaseCurrency; Money amount = new Money(0, baseCur); foreach (IOrder order in this.OpenOrdersForAccount) { if (sideFilter == OrderSideFilter.All || (sideFilter == OrderSideFilter.Buy && order.Side == Side.Buy) || (sideFilter == OrderSideFilter.Sell && order.Side == Side.Sell)) { amount += order.OpenAmount.CurrentBaseAmount; if (order.Commission != null && order.Commission.IsNotZero && order.Side == Side.Buy && retVal == OpenOrderAmountReturnValue.Gross) amount -= order.Commission.CurrentBaseAmount; } } return amount; }
/// <summary> /// An overload of the <see cref="M:B4F.TotalGiro.Accounts.AccountTypeInternal.OpenOrderAmount">OpenOrderAmount</see> method. /// With this method it is possible to return either the total nett or total gross open order amount. /// </summary> /// <param name="retVal">Value determines if either the gross or nett value is returned</param> /// <returns>The amount in base currency</returns> public virtual Money OpenOrderAmount(OpenOrderAmountReturnValue retVal) { return OpenOrderAmount(retVal, OrderSideFilter.All); }