Exemplo n.º 1
0
        public bool Filter(OrderFilter filter)
        {
            if (filter.HasEarliestTime &&
                !OnFilterEarliestTime(filter.EarliestTime))
            {
                return(false);
            }

            if (filter.HasLatestTime &&
                !OnFilterLatestTime(filter.LatestTime))
            {
                return(false);
            }

            if (filter.HasAllowedTypes &&
                !OnFilterType(filter.AllowedTypes))
            {
                return(false);
            }

            if (filter.HasAllowedLocations &&
                !OnFilterLocation(filter.AllowedLocations))
            {
                return(false);
            }

            if (filter.HasAllowedCurrencies &&
                !OnFilterCurrency(filter.AllowedCurrencies))
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 2
0
        //public List<T> Filter<T>(List<TradeOrder> trades, TradeFilter filter)
        //	where T : TradeOrder
        //{
        //	List<T> results = new List<T>();
        //	foreach (TradeOrder trade in trades)
        //	{
        //		if (trade.Filter(filter))
        //		{
        //			T castTrade = trade as T;
        //			if (castTrade != null)
        //			{ results.Add(castTrade); }
        //		}
        //	}
        //	return results;
        //}

        public OrderHistory <TBaseOrder> Filter(OrderFilter filter)
        {
            OrderHistory <TBaseOrder> results = new OrderHistory <TBaseOrder>();

            foreach (TBaseOrder trade in this)
            {
                if (trade.Filter(filter))
                {
                    results.Add(trade);
                }
            }
            return(results);
        }