/// <summary> /// Initializes a new instance of the <see cref="HighProfitsFixedIncomeSubscriber"/> class. /// </summary> /// <param name="fixedIncomeRuleHighVolumeFactory"> /// The fixed income rule high volume 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="logger"> /// The logger. /// </param> public HighProfitsFixedIncomeSubscriber( IFixedIncomeHighProfitFactory fixedIncomeRuleHighVolumeFactory, IRuleParameterToRulesMapperDecorator ruleParameterMapper, IUniverseFilterFactory universeFilterFactory, IOrganisationalFactorBrokerServiceFactory brokerServiceFactory, ILogger <HighVolumeFixedIncomeSubscriber> logger) { this.fixedIncomeRuleHighProfitsFactory = fixedIncomeRuleHighVolumeFactory ?? throw new ArgumentNullException(nameof(fixedIncomeRuleHighVolumeFactory)); 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.logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
/// <summary> /// The test setup. /// </summary> private void Setup() { this.tradingHoursService = A.Fake <IMarketTradingHoursService>(); A.CallTo(() => this.tradingHoursService.GetTradingHoursForMic("XLON")).Returns( new TradingHours { CloseOffsetInUtc = TimeSpan.FromHours(16), IsValid = true, Mic = "XLON", OpenOffsetInUtc = TimeSpan.FromHours(8) }); A.CallTo(() => this.tradingHoursService.GetTradingHoursForMic("NASDAQ")).Returns( new TradingHours { CloseOffsetInUtc = TimeSpan.FromHours(23), IsValid = true, Mic = "NASDAQ", OpenOffsetInUtc = TimeSpan.FromHours(15) }); A.CallTo(() => this.tradingHoursService.GetTradingHoursForMic("Diversity")).Returns( new TradingHours { CloseOffsetInUtc = TimeSpan.FromHours(16), IsValid = true, Mic = "Diversity", OpenOffsetInUtc = TimeSpan.FromHours(8) }); this.ruleContext = A.Fake <ISystemProcessOperationRunRuleContext>(); this.dataRequestSubscriber = A.Fake <IUniverseDataRequestsSubscriber>(); this.fixedIncomeOrderFilterService = new UniverseFixedIncomeOrderFilterService( new NullLogger <UniverseFixedIncomeOrderFilterService>()); this.logger = A.Fake <ILogger <FixedIncomeHighProfitsRule> >(); this.stackLogger = A.Fake <ILogger <TradingHistoryStack> >(); this.equityMarketCacheFactory = new UniverseEquityMarketCacheFactory( new StubRuleRunDataRequestRepository(), new StubRuleRunDataRequestRepository(), new NullLogger <UniverseEquityMarketCacheFactory>()); this.fixedIncomeMarketCacheFactory = new UniverseFixedIncomeMarketCacheFactory( new StubRuleRunDataRequestRepository(), new StubRuleRunDataRequestRepository(), new NullLogger <UniverseFixedIncomeMarketCacheFactory>()); this.marketDataCacheStrategyFactory = new FixedIncomeMarketDataCacheStrategyFactory(); this.costCalculatorFactory = new CostCalculatorFactory( new CurrencyConverterService( this.exchangeRateSelection.ExchangeRateRepository, new NullLogger <CurrencyConverterService>()), new NullLogger <CostCalculator>(), new NullLogger <CostCurrencyConvertingCalculator>()); this.revenueCalculatorFactory = new RevenueCalculatorFactory( this.tradingHoursService, new CurrencyConverterService( this.exchangeRateSelection.ExchangeRateRepository, new NullLogger <CurrencyConverterService>()), new NullLogger <RevenueCurrencyConvertingCalculator>(), new NullLogger <RevenueCalculator>()); this.exchangeRateProfitCalculator = A.Fake <IExchangeRateProfitCalculator>(); this.judgementRepository = A.Fake <IJudgementRepository>(); this.ruleViolationService = A.Fake <IRuleViolationService>(); this.judgementService = new JudgementService( this.judgementRepository, this.ruleViolationService, new HighProfitJudgementMapper(new NullLogger <HighProfitJudgementMapper>()), new FixedIncomeHighProfitJudgementMapper(new NullLogger <FixedIncomeHighProfitJudgementMapper>()), new FixedIncomeHighVolumeJudgementMapper(new NullLogger <FixedIncomeHighVolumeJudgementMapper>()), new NullLogger <JudgementService>()); this.factory = new FixedIncomeHighProfitFactory( this.fixedIncomeOrderFilterService, this.equityMarketCacheFactory, this.fixedIncomeMarketCacheFactory, this.marketDataCacheStrategyFactory, this.costCalculatorFactory, this.revenueCalculatorFactory, this.exchangeRateProfitCalculator, new CurrencyConverterService( this.exchangeRateSelection.ExchangeRateRepository, new NullLogger <CurrencyConverterService>()), this.logger, this.stackLogger); }