Example #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LayeringEquitySubscriber"/> class.
 /// </summary>
 /// <param name="equityRuleLayeringFactory">
 /// The equity rule layering factory.
 /// </param>
 /// <param name="ruleParameterMapper">
 /// The rule parameter mapper.
 /// </param>
 /// <param name="universeFilterFactory">
 /// The universe filter factory.
 /// </param>
 /// <param name="brokerServiceFactory">
 /// The broker service factory.
 /// </param>
 /// <param name="decoratorFilterFactory">
 /// The decorator filter factory.
 /// </param>
 /// <param name="logger">
 /// The logger.
 /// </param>
 public LayeringEquitySubscriber(
     IEquityRuleLayeringFactory equityRuleLayeringFactory,
     IRuleParameterToRulesMapperDecorator ruleParameterMapper,
     IUniverseFilterFactory universeFilterFactory,
     IOrganisationalFactorBrokerServiceFactory brokerServiceFactory,
     IHighVolumeVenueDecoratorFilterFactory decoratorFilterFactory,
     ILogger <LayeringEquitySubscriber> logger)
 {
     this.equityRuleLayeringFactory = equityRuleLayeringFactory
                                      ?? throw new ArgumentNullException(nameof(equityRuleLayeringFactory));
     this.ruleParameterMapper =
         ruleParameterMapper ?? throw new ArgumentNullException(nameof(ruleParameterMapper));
     this.universeFilterFactory =
         universeFilterFactory ?? throw new ArgumentNullException(nameof(universeFilterFactory));
     this.brokerServiceFactory =
         brokerServiceFactory ?? throw new ArgumentNullException(nameof(brokerServiceFactory));
     this.decoratorFilterFactory =
         decoratorFilterFactory ?? throw new ArgumentNullException(nameof(decoratorFilterFactory));
     this.logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Example #2
0
        public LayeringSteps(ScenarioContext scenarioContext, UniverseSelectionState universeSelectionState)
        {
            this._scenarioContext        = scenarioContext ?? throw new ArgumentNullException(nameof(scenarioContext));
            this._universeSelectionState =
                universeSelectionState ?? throw new ArgumentNullException(nameof(universeSelectionState));
            this._orderAnalysisService = new OrderAnalysisService();
            this._ruleCtx     = A.Fake <ISystemProcessOperationRunRuleContext>();
            this._alertStream = A.Fake <IUniverseAlertStream>();

            var equityMarketCacheFactory = new UniverseEquityMarketCacheFactory(
                new StubRuleRunDataRequestRepository(),
                new StubRuleRunDataRequestRepository(),
                new NullLogger <UniverseEquityMarketCacheFactory>());

            var fixedIncomeMarketCacheFactory = new UniverseFixedIncomeMarketCacheFactory(
                new StubRuleRunDataRequestRepository(),
                new StubRuleRunDataRequestRepository(),
                new NullLogger <UniverseFixedIncomeMarketCacheFactory>());

            var repository = A.Fake <IMarketOpenCloseApiCachingDecorator>();

            A.CallTo(() => repository.GetAsync()).Returns(
                new[]
            {
                new ExchangeDto
                {
                    Code              = "XLON",
                    MarketOpenTime    = TimeSpan.FromHours(8),
                    MarketCloseTime   = TimeSpan.FromHours(16),
                    IsOpenOnMonday    = true,
                    IsOpenOnTuesday   = true,
                    IsOpenOnWednesday = true,
                    IsOpenOnThursday  = true,
                    IsOpenOnFriday    = true,
                    IsOpenOnSaturday  = true,
                    IsOpenOnSunday    = true
                },
                new ExchangeDto
                {
                    Code              = "NASDAQ",
                    MarketOpenTime    = TimeSpan.FromHours(15),
                    MarketCloseTime   = TimeSpan.FromHours(23),
                    IsOpenOnMonday    = true,
                    IsOpenOnTuesday   = true,
                    IsOpenOnWednesday = true,
                    IsOpenOnThursday  = true,
                    IsOpenOnFriday    = true,
                    IsOpenOnSaturday  = true,
                    IsOpenOnSunday    = true
                }
            });

            this._tradingHoursService = new MarketTradingHoursService(
                repository,
                new NullLogger <MarketTradingHoursService>());

            this._equityRuleLayeringFactory = new EquityRuleLayeringFactory(
                new UniverseEquityOrderFilterService(new NullLogger <UniverseEquityOrderFilterService>()),
                _tradingHoursService,
                equityMarketCacheFactory,
                fixedIncomeMarketCacheFactory,
                new NullLogger <EquityRuleLayeringFactory>(),
                new NullLogger <TradingHistoryStack>());
        }