Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FixedIncomeWashTradeRule"/> class.
 /// </summary>
 /// <param name="parameters">
 /// The parameters.
 /// </param>
 /// <param name="orderFilterService">
 /// The order filter service.
 /// </param>
 /// <param name="ruleContext">
 /// The rule context.
 /// </param>
 /// <param name="equityFactory">
 /// The factory.
 /// </param>
 /// <param name="fixedIncomeFactory">
 /// The factory.
 /// </param>
 /// <param name="runMode">
 /// The run mode.
 /// </param>
 /// <param name="alertStream">
 /// The alert stream.
 /// </param>
 /// <param name="clusteringService">
 /// The clustering service.
 /// </param>
 /// <param name="portfolioFactory">
 /// The portfolio factory.
 /// </param>
 /// <param name="logger">
 /// The logger.
 /// </param>
 /// <param name="tradingStackLogger">
 /// The trading stack logger.
 /// </param>
 public FixedIncomeWashTradeRule(
     IWashTradeRuleFixedIncomeParameters parameters,
     IUniverseFixedIncomeOrderFilterService orderFilterService,
     ISystemProcessOperationRunRuleContext ruleContext,
     IUniverseEquityMarketCacheFactory equityFactory,
     IUniverseFixedIncomeMarketCacheFactory fixedIncomeFactory,
     RuleRunMode runMode,
     IUniverseAlertStream alertStream,
     IClusteringService clusteringService,
     IPortfolioFactory portfolioFactory,
     ILogger <FixedIncomeWashTradeRule> logger,
     ILogger <TradingHistoryStack> tradingStackLogger)
     : base(
         parameters?.Windows?.BackwardWindowSize ?? TimeSpan.FromDays(1),
         parameters?.Windows?.BackwardWindowSize ?? TimeSpan.FromDays(1),
         parameters?.Windows?.FutureWindowSize ?? TimeSpan.Zero,
         Rules.FixedIncomeWashTrades,
         Versioner.Version(1, 0),
         $"{nameof(FixedIncomeWashTradeRule)}",
         ruleContext,
         equityFactory,
         fixedIncomeFactory,
         runMode,
         logger,
         tradingStackLogger)
 {
     this.parameters         = parameters ?? throw new ArgumentNullException(nameof(parameters));
     this.orderFilterService = orderFilterService ?? throw new ArgumentNullException(nameof(orderFilterService));
     this.alertStream        = alertStream ?? throw new ArgumentNullException(nameof(alertStream));
     this.clusteringService  = clusteringService ?? throw new ArgumentNullException(nameof(clusteringService));
     this.portfolioFactory   = portfolioFactory ?? throw new ArgumentNullException(nameof(portfolioFactory));
     this.logger             = logger ?? throw new ArgumentNullException(nameof(logger));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FixedIncomeHighProfitFactory"/> class.
 /// </summary>
 /// <param name="fixedIncomeOrderFilterService">
 /// The fixed income order filter service.
 /// </param>
 /// <param name="equityCacheFactory">
 /// The market cache factory.
 /// </param>
 /// <param name="fixedIncomeCacheFactory">
 /// The market cache factory.
 /// </param>
 /// <param name="marketDataCacheStrategyFactory">
 /// The market data cache strategy factory.
 /// </param>
 /// <param name="costCalculatorFactory">
 /// The cost calculator factory.
 /// </param>
 /// <param name="revenueCalculatorFactory">
 /// The revenue calculator factory.
 /// </param>
 /// <param name="exchangeRateProfitCalculator">
 /// The exchange rate profit calculator.
 /// </param>
 /// <param name="logger">
 /// The logger.
 /// </param>
 /// <param name="stackLogger">
 /// The stack logger.
 /// </param>
 public FixedIncomeHighProfitFactory(
     IUniverseFixedIncomeOrderFilterService fixedIncomeOrderFilterService,
     IUniverseEquityMarketCacheFactory equityCacheFactory,
     IUniverseFixedIncomeMarketCacheFactory fixedIncomeCacheFactory,
     IFixedIncomeMarketDataCacheStrategyFactory marketDataCacheStrategyFactory,
     ICostCalculatorFactory costCalculatorFactory,
     IRevenueCalculatorFactory revenueCalculatorFactory,
     IExchangeRateProfitCalculator exchangeRateProfitCalculator,
     ICurrencyConverterService currencyConverterService,
     ILogger <FixedIncomeHighProfitsRule> logger,
     ILogger <TradingHistoryStack> stackLogger)
 {
     this.fixedIncomeOrderFilterService =
         fixedIncomeOrderFilterService ?? throw new ArgumentNullException(nameof(fixedIncomeOrderFilterService));
     this.equityMarketCacheFactory =
         equityCacheFactory ?? throw new ArgumentNullException(nameof(equityCacheFactory));
     this.fixedIncomeCacheFactory =
         fixedIncomeCacheFactory ?? throw new ArgumentNullException(nameof(fixedIncomeCacheFactory));
     this.marketDataCacheStrategyFactory = marketDataCacheStrategyFactory ?? throw new ArgumentNullException(nameof(marketDataCacheStrategyFactory));
     this.costCalculatorFactory          =
         costCalculatorFactory ?? throw new ArgumentNullException(nameof(costCalculatorFactory));
     this.revenueCalculatorFactory     = revenueCalculatorFactory ?? throw new ArgumentNullException(nameof(revenueCalculatorFactory));
     this.exchangeRateProfitCalculator = exchangeRateProfitCalculator ?? throw new ArgumentNullException(nameof(exchangeRateProfitCalculator));
     this.currencyConverterService     = currencyConverterService ?? throw new ArgumentNullException(nameof(currencyConverterService));
     this.logger      = logger ?? throw new ArgumentNullException(nameof(logger));
     this.stackLogger = stackLogger ?? throw new ArgumentNullException(nameof(stackLogger));
 }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FixedIncomeHighProfitsMarketClosureRule"/> class.
 /// </summary>
 /// <param name="fixedIncomeParameters">
 /// The fixed income parameters.
 /// </param>
 /// <param name="ruleContext">
 /// The rule context.
 /// </param>
 /// <param name="costCalculatorFactory">
 /// The cost calculator factory.
 /// </param>
 /// <param name="revenueCalculatorFactory">
 /// The revenue calculator factory.
 /// </param>
 /// <param name="exchangeRateProfitCalculator">
 /// The exchange rate profit calculator.
 /// </param>
 /// <param name="orderFilter">
 /// The order filter.
 /// </param>
 /// <param name="equityMarketCacheFactory">
 /// The market cache factory.
 /// </param>
 /// <param name="fixedIncomeMarketCacheFactory">
 /// The market cache factory.
 /// </param>
 /// <param name="marketDataCacheFactory">
 /// The market data cache factory.
 /// </param>
 /// <param name="dataRequestSubscriber">
 /// The data request subscriber.
 /// </param>
 /// <param name="judgementService">
 /// The judgement service.
 /// </param>
 /// <param name="runMode">
 /// The run mode.
 /// </param>
 /// <param name="logger">
 /// The logger.
 /// </param>
 /// <param name="tradingHistoryLogger">
 /// The trading history logger.
 /// </param>
 public FixedIncomeHighProfitsMarketClosureRule(
     IHighProfitsRuleFixedIncomeParameters fixedIncomeParameters,
     ISystemProcessOperationRunRuleContext ruleContext,
     ICostCalculatorFactory costCalculatorFactory,
     IRevenueCalculatorFactory revenueCalculatorFactory,
     IExchangeRateProfitCalculator exchangeRateProfitCalculator,
     IUniverseFixedIncomeOrderFilterService orderFilter,
     IUniverseEquityMarketCacheFactory equityMarketCacheFactory,
     IUniverseFixedIncomeMarketCacheFactory fixedIncomeMarketCacheFactory,
     IFixedIncomeMarketDataCacheStrategyFactory marketDataCacheFactory,
     IUniverseDataRequestsSubscriber dataRequestSubscriber,
     IFixedIncomeHighProfitJudgementService judgementService,
     ICurrencyConverterService currencyConverterService,
     RuleRunMode runMode,
     ILogger <FixedIncomeHighProfitsRule> logger,
     ILogger <TradingHistoryStack> tradingHistoryLogger)
     : base(
         fixedIncomeParameters,
         ruleContext,
         costCalculatorFactory,
         revenueCalculatorFactory,
         exchangeRateProfitCalculator,
         orderFilter,
         equityMarketCacheFactory,
         fixedIncomeMarketCacheFactory,
         marketDataCacheFactory,
         dataRequestSubscriber,
         judgementService,
         currencyConverterService,
         runMode,
         logger,
         tradingHistoryLogger)
 {
     this.MarketClosureRule = true;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FixedIncomeHighVolumeRule"/> class.
 /// </summary>
 /// <param name="parameters">
 /// The parameters.
 /// </param>
 /// <param name="orderFilterService">
 /// The order filter service.
 /// </param>
 /// <param name="ruleContext">
 /// The rule context.
 /// </param>
 /// <param name="equityFactory">
 /// The factory.
 /// </param>
 /// <param name="fixedIncomeFactory">
 /// The factory.
 /// </param>
 /// <param name="judgementService">
 /// The judgement service.
 /// </param>
 /// <param name="dataRequestSubscriber">
 /// The data request subscriber
 /// </param>
 /// <param name="tradingHoursService">
 /// The trading hours service
 /// </param>
 /// <param name="runMode">
 /// The run mode.
 /// </param>
 /// <param name="logger">
 /// The logger.
 /// </param>
 /// <param name="tradingStackLogger">
 /// The trading stack logger.
 /// </param>
 public FixedIncomeHighVolumeRule(
     IHighVolumeIssuanceRuleFixedIncomeParameters parameters,
     IUniverseFixedIncomeOrderFilterService orderFilterService,
     ISystemProcessOperationRunRuleContext ruleContext,
     IUniverseEquityMarketCacheFactory equityFactory,
     IUniverseFixedIncomeMarketCacheFactory fixedIncomeFactory,
     IFixedIncomeHighVolumeJudgementService judgementService,
     IUniverseDataRequestsSubscriber dataRequestSubscriber,
     IMarketTradingHoursService tradingHoursService,
     RuleRunMode runMode,
     ILogger <FixedIncomeHighVolumeRule> logger,
     ILogger <TradingHistoryStack> tradingStackLogger)
     : base(
         parameters.Windows.BackwardWindowSize,
         parameters.Windows.BackwardWindowSize,
         parameters.Windows.FutureWindowSize,
         Rules.FixedIncomeHighVolumeIssuance,
         FixedIncomeHighVolumeFactory.Version,
         $"{nameof(FixedIncomeHighVolumeRule)}",
         ruleContext,
         equityFactory,
         fixedIncomeFactory,
         runMode,
         logger,
         tradingStackLogger)
 {
     this.parameters            = parameters ?? throw new ArgumentNullException(nameof(parameters));
     this.orderFilterService    = orderFilterService ?? throw new ArgumentNullException(nameof(orderFilterService));
     this.judgementService      = judgementService ?? throw new ArgumentNullException(nameof(judgementService));
     this.dataRequestSubscriber = dataRequestSubscriber ?? throw new ArgumentNullException(nameof(dataRequestSubscriber));
     this.tradingHoursService   = tradingHoursService ?? throw new ArgumentNullException(nameof(tradingHoursService));
     this.logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Esempio n. 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FixedIncomeHighProfitsStreamRule"/> class.
        /// Constructor for the high profits stream rule
        /// </summary>
        /// <param name="fixedIncomeParameters">
        /// parameters from the client service user interface
        /// </param>
        /// <param name="ruleContext">
        /// auditing helper
        /// </param>
        /// <param name="costCalculatorFactory">
        /// cost logic service factory
        /// </param>
        /// <param name="revenueCalculatorFactory">
        /// revenue logic service factory
        /// </param>
        /// <param name="exchangeRateProfitCalculator">
        /// exchange rate service
        /// </param>
        /// <param name="orderFilter">
        /// classification financial instruments filtering service
        /// </param>
        /// <param name="equityMarketCacheFactory">
        /// time bar cache factory
        /// </param>
        /// /// <param name="fixedIncomeMarketCacheFactory">
        /// time bar cache factory
        /// </param>
        /// <param name="marketDataCacheFactory">
        /// market time bar cache factory
        /// </param>
        /// <param name="dataRequestSubscriber">
        /// data fetch pattern helper
        /// </param>
        /// <param name="judgementService">
        /// rule analysis service
        /// </param>
        /// <param name="runMode">
        /// forced or validation
        /// </param>
        /// <param name="logger">
        /// logging helper
        /// </param>
        /// <param name="tradingHistoryLogger">
        /// logging helper for trading history
        /// </param>
        public FixedIncomeHighProfitsStreamRule(
            IHighProfitsRuleFixedIncomeParameters fixedIncomeParameters,
            ISystemProcessOperationRunRuleContext ruleContext,
            ICostCalculatorFactory costCalculatorFactory,
            IRevenueCalculatorFactory revenueCalculatorFactory,
            IExchangeRateProfitCalculator exchangeRateProfitCalculator,
            IUniverseFixedIncomeOrderFilterService orderFilter,
            IUniverseEquityMarketCacheFactory equityMarketCacheFactory,
            IUniverseFixedIncomeMarketCacheFactory fixedIncomeMarketCacheFactory,
            IFixedIncomeMarketDataCacheStrategyFactory marketDataCacheFactory,
            IUniverseDataRequestsSubscriber dataRequestSubscriber,
            IFixedIncomeHighProfitJudgementService judgementService,
            ICurrencyConverterService currencyService,
            RuleRunMode runMode,
            ILogger <FixedIncomeHighProfitsRule> logger,
            ILogger <TradingHistoryStack> tradingHistoryLogger)
            : base(
                fixedIncomeParameters?.Windows?.BackwardWindowSize ?? TimeSpan.FromHours(8),
                fixedIncomeParameters?.Windows?.BackwardWindowSize ?? TimeSpan.FromHours(8),
                fixedIncomeParameters?.Windows?.FutureWindowSize ?? TimeSpan.Zero,
                Domain.Surveillance.Scheduling.Rules.FixedIncomeHighProfits,
                FixedIncomeHighProfitFactory.Version,
                "Fixed Income High Profit Rule",
                ruleContext,
                equityMarketCacheFactory,
                fixedIncomeMarketCacheFactory,
                runMode,
                logger,
                tradingHistoryLogger)
        {
            this.FixedIncomeParameters =
                fixedIncomeParameters ?? throw new ArgumentNullException(nameof(fixedIncomeParameters));

            this.RuleCtx = ruleContext ?? throw new ArgumentNullException(nameof(ruleContext));

            this.costCalculatorFactory =
                costCalculatorFactory ?? throw new ArgumentNullException(nameof(costCalculatorFactory));

            this.revenueCalculatorFactory = revenueCalculatorFactory
                                            ?? throw new ArgumentNullException(nameof(revenueCalculatorFactory));

            this.marketDataCacheFactory =
                marketDataCacheFactory ?? throw new ArgumentNullException(nameof(marketDataCacheFactory));

            this.exchangeRateProfitCalculator = exchangeRateProfitCalculator
                                                ?? throw new ArgumentNullException(
                                                          nameof(exchangeRateProfitCalculator));

            this.orderFilter = orderFilter ?? throw new ArgumentNullException(nameof(orderFilter));

            this.dataRequestSubscriber =
                dataRequestSubscriber ?? throw new ArgumentNullException(nameof(dataRequestSubscriber));

            this.JudgementService         = judgementService ?? throw new ArgumentNullException(nameof(judgementService));
            this.currencyConverterService = currencyService ?? throw new ArgumentNullException(nameof(currencyService));

            this.Logger = logger ?? throw new ArgumentNullException(nameof(logger));
        }
Esempio n. 6
0
 public void Setup()
 {
     this.parameters                    = A.Fake <IHighVolumeIssuanceRuleFixedIncomeParameters>();
     this.fixedIncomeOrderFile          = A.Fake <IUniverseFixedIncomeOrderFilterService>();
     this.ruleContext                   = A.Fake <ISystemProcessOperationRunRuleContext>();
     this.equityMarketCacheFactory      = A.Fake <IUniverseEquityMarketCacheFactory>();
     this.fixedIncomeMarketCacheFactory = A.Fake <IUniverseFixedIncomeMarketCacheFactory>();
     this.marketTradingHoursService     = A.Fake <IMarketTradingHoursService>();
     this.tradingStackLogger            = new NullLogger <TradingHistoryStack>();
 }
Esempio n. 7
0
 public void Setup()
 {
     this._parameters           = A.Fake <IWashTradeRuleFixedIncomeParameters>();
     this._fixedIncomeOrderFile = A.Fake <IUniverseFixedIncomeOrderFilterService>();
     this._ruleCtx = A.Fake <ISystemProcessOperationRunRuleContext>();
     this._equityMarketCacheFactory      = A.Fake <IUniverseEquityMarketCacheFactory>();
     this._fixedIncomeMarketCacheFactory = A.Fake <IUniverseFixedIncomeMarketCacheFactory>();
     this._alertStream        = A.Fake <IUniverseAlertStream>();
     this._clusteringService  = A.Fake <IClusteringService>();
     this._portfolioFactory   = A.Fake <IPortfolioFactory>();
     this._logger             = new NullLogger <FixedIncomeHighProfitsRule>();
     this._tradingStackLogger = new NullLogger <TradingHistoryStack>();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FixedIncomeHighVolumeFactory"/> class.
 /// </summary>
 /// <param name="filterService">
 /// The filter service.
 /// </param>
 /// <param name="equityMarketCacheFactory">
 /// The market cache factory.
 /// </param>
 /// <param name="fixedIncomeMarketCacheFactory">
 /// The market cache factory.
 /// </param>
 /// <param name="logger">
 /// The logger.
 /// </param>
 /// <param name="tradingLogger">
 /// The trading logger.
 /// </param>
 /// <param name="marketTradingHoursService">
 /// The trading hours service.
 /// </param>
 public FixedIncomeHighVolumeFactory(
     IUniverseFixedIncomeOrderFilterService filterService,
     IUniverseEquityMarketCacheFactory equityMarketCacheFactory,
     IUniverseFixedIncomeMarketCacheFactory fixedIncomeMarketCacheFactory,
     ILogger <FixedIncomeHighVolumeRule> logger,
     ILogger <TradingHistoryStack> tradingLogger,
     IMarketTradingHoursService marketTradingHoursService)
 {
     this.filterService            = filterService ?? throw new ArgumentNullException(nameof(filterService));
     this.equityMarketCacheFactory =
         equityMarketCacheFactory ?? throw new ArgumentNullException(nameof(this.equityMarketCacheFactory));
     this.fixedIncomeMarketCacheFactory =
         fixedIncomeMarketCacheFactory ?? throw new ArgumentNullException(nameof(this.fixedIncomeMarketCacheFactory));
     this.marketTradingHoursService = marketTradingHoursService ?? throw new ArgumentNullException(nameof(marketTradingHoursService));
     this.logger        = logger ?? throw new ArgumentNullException(nameof(logger));
     this.tradingLogger = tradingLogger ?? throw new ArgumentNullException(nameof(tradingLogger));
 }
        private void Setup()
        {
            this._orderFilterService = A.Fake <IUniverseFixedIncomeOrderFilterService>();
            this._ruleCtx            = A.Fake <ISystemProcessOperationRunRuleContext>();
            this._alertStream        = A.Fake <IUniverseAlertStream>();

            this._portfolioFactory         = new PortfolioFactory();
            this._clusteringService        = new ClusteringService();
            this._equityMarketCacheFactory = new UniverseEquityMarketCacheFactory(
                new StubRuleRunDataRequestRepository(),
                new StubRuleRunDataRequestRepository(),
                new NullLogger <UniverseEquityMarketCacheFactory>());
            this._fixedIncomeMarketCacheFactory = new UniverseFixedIncomeMarketCacheFactory(
                new StubRuleRunDataRequestRepository(),
                new StubRuleRunDataRequestRepository(),
                new NullLogger <UniverseFixedIncomeMarketCacheFactory>());
        }
Esempio n. 10
0
 public void Setup()
 {
     this.fixedIncomeOrderFilterService  = A.Fake <IUniverseFixedIncomeOrderFilterService>();
     this.equityMarketCacheFactory       = A.Fake <IUniverseEquityMarketCacheFactory>();
     this.fixedIncomeMarketCacheFactory  = A.Fake <IUniverseFixedIncomeMarketCacheFactory>();
     this.marketDataCacheStrategyFactory = A.Fake <IFixedIncomeMarketDataCacheStrategyFactory>();
     this.costCalculatorFactory          = A.Fake <ICostCalculatorFactory>();
     this.revenueCalculatorFactory       = A.Fake <IRevenueCalculatorFactory>();
     this.exchangeRateProfitCalculator   = A.Fake <IExchangeRateProfitCalculator>();
     this.logger                   = A.Fake <ILogger <FixedIncomeHighProfitsRule> >();
     this.stackLogger              = A.Fake <ILogger <TradingHistoryStack> >();
     this.parameters               = A.Fake <IHighProfitsRuleFixedIncomeParameters>();
     this.ruleContext              = A.Fake <ISystemProcessOperationRunRuleContext>();
     this.judgementService         = A.Fake <IFixedIncomeHighProfitJudgementService>();
     this.dataRequestSubscriber    = A.Fake <IUniverseDataRequestsSubscriber>();
     this.currencyConverterService = A.Fake <ICurrencyConverterService>();
     this.runMode                  = RuleRunMode.ValidationRun;
     this.scheduledExecution       = new ScheduledExecution();
 }
Esempio n. 11
0
        /// <summary>
        /// The test setup.
        /// </summary>
        private void Setup()
        {
            this.orderFilterService        = A.Fake <IUniverseFixedIncomeOrderFilterService>();
            this.ruleContext               = A.Fake <ISystemProcessOperationRunRuleContext>();
            this.dataRequestSubscriber     = A.Fake <IUniverseDataRequestsSubscriber>();
            this.marketTradingHoursService = A.Fake <IMarketTradingHoursService>();

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

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

            A
            .CallTo(() => repository.GetAsync()).
            Returns(new ExchangeDto[]
            {
                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              = "Diversity",
                    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.marketTradingHoursService = new MarketTradingHoursService(repository, new NullLogger <MarketTradingHoursService>());

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

            this.fixedIncomeMarketCacheFactory = new UniverseFixedIncomeMarketCacheFactory(
                new StubRuleRunDataRequestRepository(),
                new StubRuleRunDataRequestRepository(),
                new NullLogger <UniverseFixedIncomeMarketCacheFactory>());
        }
Esempio n. 12
0
        /// <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);
        }