예제 #1
0
        public HighMarketCapFilter(
            IUniverseEquityMarketCacheFactory factory,
            RuleRunMode ruleRunMode,
            DecimalRangeRuleFilter marketCap,
            IMarketTradingHoursService tradingHoursService,
            ISystemProcessOperationRunRuleContext operationRunRuleContext,
            IUniverseDataRequestsSubscriber universeDataRequestsSubscriber,
            ICurrencyConverterService currencyConverterService,
            string ruleName,
            ILogger <HighMarketCapFilter> logger
            )
        {
            _universeEquityInterdayCache =
                factory?.BuildInterday(ruleRunMode)
                ?? throw new ArgumentNullException(nameof(factory));

            _ruleRunMode     = ruleRunMode;
            _marketCapFilter = marketCap ?? DecimalRangeRuleFilter.None();

            _tradingHoursService            = tradingHoursService ?? throw new ArgumentNullException(nameof(tradingHoursService));
            _operationRunRuleContext        = operationRunRuleContext ?? throw new ArgumentNullException(nameof(operationRunRuleContext));
            _universeDataRequestsSubscriber = universeDataRequestsSubscriber;
            this.currencyConverterService   = currencyConverterService ?? throw new ArgumentNullException(nameof(currencyConverterService));
            _name   = ruleName;
            _logger = logger ?? throw new ArgumentNullException(nameof(logger));
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BaseUniverseRule"/> class.
        /// </summary>
        /// <param name="tradeBackwardWindowSize">
        /// The trade backward window size.
        /// </param>
        /// <param name="marketBackwardWindowSize">
        /// The market backward window size.
        /// </param>
        /// <param name="forwardWindowSize">
        /// The forward window size.
        /// </param>
        /// <param name="rules">
        /// The rules.
        /// </param>
        /// <param name="version">
        /// The version.
        /// </param>
        /// <param name="name">
        /// The name.
        /// </param>
        /// <param name="ruleContext">
        /// The rule context.
        /// </param>
        /// <param name="equityFactory">
        /// The equity factory.
        /// </param>
        /// <param name="fixedIncomeFactory">
        /// The fixed income factory.
        /// </param>
        /// <param name="runMode">
        /// The run mode.
        /// </param>
        /// <param name="logger">
        /// The logger.
        /// </param>
        /// <param name="tradingStackLogger">
        /// The trading stack logger.
        /// </param>
        protected BaseUniverseRule(
            TimeSpan tradeBackwardWindowSize,
            TimeSpan marketBackwardWindowSize,
            TimeSpan forwardWindowSize,
            Rules rules,
            string version,
            string name,
            ISystemProcessOperationRunRuleContext ruleContext,
            IUniverseEquityMarketCacheFactory equityFactory,
            IUniverseFixedIncomeMarketCacheFactory fixedIncomeFactory,
            RuleRunMode runMode,
            ILogger logger,
            ILogger <TradingHistoryStack> tradingStackLogger)
        {
            this.TradeBackwardWindowSize = tradeBackwardWindowSize;
            this.ForwardWindowSize       = forwardWindowSize;

            this.Rule    = rules;
            this.Version = version ?? string.Empty;

            this.UniverseEquityIntradayCache =
                equityFactory?.BuildIntraday(marketBackwardWindowSize, runMode)
                ?? throw new ArgumentNullException(nameof(equityFactory));

            this.FutureUniverseEquityIntradayCache =
                equityFactory?.BuildIntraday(forwardWindowSize, runMode)
                ?? throw new ArgumentNullException(nameof(equityFactory));

            this.UniverseEquityInterdayCache =
                equityFactory?.BuildInterday(runMode)
                ?? throw new ArgumentNullException(nameof(equityFactory));

            this.UniverseFixedIncomeIntradayCache =
                fixedIncomeFactory?.BuildIntraday(marketBackwardWindowSize, runMode)
                ?? throw new ArgumentNullException(nameof(fixedIncomeFactory));

            this.FutureUniverseFixedIncomeIntradayCache =
                fixedIncomeFactory?.BuildIntraday(forwardWindowSize, runMode)
                ?? throw new ArgumentNullException(nameof(fixedIncomeFactory));

            this.UniverseFixedIncomeInterdayCache =
                fixedIncomeFactory?.BuildInterday(runMode)
                ?? throw new ArgumentNullException(nameof(fixedIncomeFactory));

            this.TradingHistory        = new ConcurrentDictionary <InstrumentIdentifiers, ITradingHistoryStack>();
            this.TradingFillsHistory   = new ConcurrentDictionary <InstrumentIdentifiers, ITradingHistoryStack>();
            this.TradingInitialHistory = new ConcurrentDictionary <InstrumentIdentifiers, ITradingHistoryStack>();

            this.DelayedTradingHistory        = new ConcurrentDictionary <InstrumentIdentifiers, ITradingHistoryStack>();
            this.DelayedTradingFillsHistory   = new ConcurrentDictionary <InstrumentIdentifiers, ITradingHistoryStack>();
            this.DelayedTradingInitialHistory = new ConcurrentDictionary <InstrumentIdentifiers, ITradingHistoryStack>();

            this.RuleCtx            = ruleContext ?? throw new ArgumentNullException(nameof(ruleContext));
            this.name               = name ?? "Unnamed rule";
            this.RunMode            = runMode;
            this.logger             = logger ?? throw new ArgumentNullException(nameof(logger));
            this.tradingStackLogger = tradingStackLogger ?? throw new ArgumentNullException(nameof(tradingStackLogger));
        }
예제 #3
0
        public void SetUp()
        {
            this.currencyConverterService   = A.Fake <ICurrencyConverterService>();
            _universeMarketCacheFactory     = A.Fake <IUniverseEquityMarketCacheFactory>();
            _universeEquityInterDayCache    = A.Fake <IUniverseEquityInterDayCache>();
            _universeDataRequestsSubscriber = A.Fake <IUniverseDataRequestsSubscriber>();

            A.CallTo(() => _universeMarketCacheFactory.BuildInterday(Engine.Rules.Rules.RuleRunMode.ValidationRun))
            .Returns(_universeEquityInterDayCache);

            _tradingHoursService     = A.Fake <IMarketTradingHoursService>();
            _operationRunRuleContext = A.Fake <ISystemProcessOperationRunRuleContext>();
            _logger = A.Fake <ILogger <HighMarketCapFilter> >();
        }