Example #1
0
        /// <summary>
        /// The filter.
        /// </summary>
        /// <param name="order">
        /// The order.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public bool Filter(Order order)
        {
            if (order == null)
            {
                this.logger.LogError(
                    "encountered an unexpected type for the underlying value of a trade event. Not filtering.");

                return(false);
            }

            var cfi = order.Instrument.Cfi;

            if (string.IsNullOrWhiteSpace(cfi))
            {
                this.logger.LogError(
                    $"tried to process a cfi that was either null or empty for {order.Instrument.Identifiers}. Filtered out unidentifiable instrument.");

                return(true);
            }

            var cfiWrap = new Cfi(cfi);
            var filter  = cfiWrap.CfiCategory != CfiCategory.Equities;

            if (filter)
            {
                this.logger.LogInformation($"filtering out cfi of {cfi} as it did not have a leading character of e");

                return(true);
            }

            return(false);
        }
        /// <summary>
        /// The filter.
        /// </summary>
        /// <param name="order">
        /// The order.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public bool Filter(Order order)
        {
            if (order == null)
            {
                return(true);
            }

            var cfi = order.Instrument.Cfi;

            if (string.IsNullOrWhiteSpace(cfi))
            {
                this.logger.LogError(
                    $"tried to process a cfi that was either null or empty for {order.Instrument.Identifiers}. Filtered out unidentifiable instrument.");
                return(true);
            }

            var cfiWrap = new Cfi(cfi);
            var filter  = cfiWrap.CfiCategory != CfiCategory.DebtInstrument;

            if (filter)
            {
                this.logger.LogInformation($"filtering out cfi of {cfi} as it did not have a leading character of d");
                return(true);
            }

            return(false);
        }
        public void Cfi_Correct_Result(string cfi, CfiCategory category, CfiGroup group)
        {
            var cfiItem = new Cfi(cfi);

            Assert.AreEqual(cfiItem.Value, cfi);
            Assert.AreEqual(cfiItem.CfiCategory, category);
            Assert.AreEqual(cfiItem.CfiGroup, group);
        }
Example #4
0
        public bool ValidAssetType(MarketDataRequest request)
        {
            if (request == null)
            {
                return(false);
            }

            var cfi = new Cfi(request.Cfi);

            return(cfi.CfiCategory == CfiCategory.Equities);
        }