public void ProcessTransaction(OrderTransaction trans)
        {
            string comment;

            if (trans.OrderId == 8)
            {
                comment = "";
            }
            IPositionInventory openPosition = OpenPositions.FirstOrDefault(p => p.GetSymbol() == trans.Symbol);

            if (openPosition == null)
            {
                openPosition = OpenPosition(trans, PositionInventoryMethod.Lifo);

                OpenPositions.Add(openPosition);
            }
            else
            {
                OrderTransaction transaction = ResolvePosition(openPosition, trans);
                if (openPosition.BuysCount() == 0 && openPosition.SellsCount() == 0)
                {
                    OpenPositions.Remove(openPosition);
                }
            }
        }
 public bool IsShort(Symbol symbol)
 {
     if (OpenPositions.Count > 0)
     {
         var position = OpenPositions.FirstOrDefault(b => b.Symbol == symbol);
         if (position != null && position.SellsCount() > 0)
         {
             return(true);
         }
     }
     return(false);
 }
        internal int GetPosition(Symbol symbol)
        {
            var openPosition = OpenPositions.FirstOrDefault();

            if (openPosition != null && openPosition.GetBuysQuantity(symbol) > 0)
            {
                return(openPosition.GetBuysQuantity(symbol));
            }

            if (openPosition != null && openPosition.GetSellsQuantity(symbol) < 0)
            {
                return(openPosition.GetSellsQuantity(symbol));
            }

            return(0);
        }