Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PlacingOrdersWithNoIntentToExecuteEquitySubscriber"/> class.
 /// </summary>
 /// <param name="equityRulePlacingOrdersFactory">
 /// The equity rule placing orders 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 PlacingOrdersWithNoIntentToExecuteEquitySubscriber(
     IEquityRulePlacingOrdersWithoutIntentToExecuteFactory equityRulePlacingOrdersFactory,
     IRuleParameterToRulesMapperDecorator ruleParameterMapper,
     IUniverseFilterFactory universeFilterFactory,
     IOrganisationalFactorBrokerServiceFactory brokerServiceFactory,
     IHighVolumeVenueDecoratorFilterFactory decoratorFilterFactory,
     ILogger <PlacingOrdersWithNoIntentToExecuteEquitySubscriber> logger)
 {
     this.equityRulePlacingOrdersFactory =
         equityRulePlacingOrdersFactory ?? throw new ArgumentNullException(nameof(equityRulePlacingOrdersFactory));
     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));
 }
Exemplo n.º 2
0
        public PlacingOrdersSteps(ScenarioContext scenarioContext, UniverseSelectionState universeSelectionState)
        {
            this._scenarioContext        = scenarioContext ?? throw new ArgumentNullException(nameof(scenarioContext));
            this._universeSelectionState =
                universeSelectionState ?? throw new ArgumentNullException(nameof(universeSelectionState));

            this._ruleCtx = A.Fake <ISystemProcessOperationRunRuleContext>();
            this._dataRequestSubscriber    = A.Fake <IUniverseDataRequestsSubscriber>();
            this._alertStream              = A.Fake <IUniverseAlertStream>();
            this._equityOrderFilterService = A.Fake <IUniverseEquityOrderFilterService>();

            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>());

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

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

            this._equityRulePlacingOrdersFactory = new EquityRulePlacingOrdersWithoutIntentToExecuteFactory(
                this._equityOrderFilterService,
                equityMarketCacheFactory,
                fixedIncomeMarketCacheFactory,
                this._tradingHoursService,
                new NullLogger <PlacingOrdersWithNoIntentToExecuteRule>(),
                new NullLogger <TradingHistoryStack>());
        }