public EquityRuleHighProfitFactory(
     ICostCalculatorFactory costCalculatorFactory,
     IRevenueCalculatorFactory revenueCalculatorFactory,
     IExchangeRateProfitCalculator exchangeRateProfitCalculator,
     IUniverseEquityOrderFilterService orderFilterService,
     IUniverseEquityMarketCacheFactory equityMarketCacheFactory,
     IUniverseFixedIncomeMarketCacheFactory fixedIncomeMarketCacheFactory,
     IEquityMarketDataCacheStrategyFactory cacheStrategyFactory,
     ICurrencyConverterService currencyConversionService,
     ILogger <HighProfitsRule> logger,
     ILogger <TradingHistoryStack> tradingHistoryLogger)
 {
     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._equityMarketCacheFactory =
         equityMarketCacheFactory ?? throw new ArgumentNullException(nameof(equityMarketCacheFactory));
     this._fixedIncomeMarketCacheFactory =
         fixedIncomeMarketCacheFactory ?? throw new ArgumentNullException(nameof(fixedIncomeMarketCacheFactory));
     this._cacheStrategyFactory =
         cacheStrategyFactory ?? throw new ArgumentNullException(nameof(cacheStrategyFactory));
     this._logger = logger ?? throw new ArgumentNullException(nameof(logger));
     this._tradingHistoryLogger =
         tradingHistoryLogger ?? throw new ArgumentNullException(nameof(tradingHistoryLogger));
     this._orderFilterService =
         orderFilterService ?? throw new ArgumentNullException(nameof(orderFilterService));
     this._currencyConversionService = currencyConversionService ?? throw new ArgumentNullException(nameof(currencyConversionService));
 }
        public CancelledOrdersSteps(ScenarioContext scenarioContext, UniverseSelectionState universeSelectionState)
        {
            this._scenarioContext        = scenarioContext;
            this._universeSelectionState = universeSelectionState;

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

            this._fixedIncomeMarketCacheFactory = new UniverseFixedIncomeMarketCacheFactory(
                new StubRuleRunDataRequestRepository(),
                new StubRuleRunDataRequestRepository(),
                new NullLogger <UniverseFixedIncomeMarketCacheFactory>());

            this._alertStream = A.Fake <IUniverseAlertStream>();
            this._ruleCtx     = A.Fake <ISystemProcessOperationRunRuleContext>();
            this._universeOrderFilterService = A.Fake <IUniverseEquityOrderFilterService>();

            this._equityRuleCancelledOrderFactory = new EquityRuleCancelledOrderFactory(
                this._universeOrderFilterService,
                this._equityMarketCacheFactory,
                this._fixedIncomeMarketCacheFactory,
                new NullLogger <CancelledOrderRule>(),
                new NullLogger <TradingHistoryStack>());
        }
Esempio n. 3
0
        public void Setup()
        {
            this._orderFilterService   = A.Fake <IUniverseEquityOrderFilterService>();
            this._equityFactory        = A.Fake <IUniverseEquityMarketCacheFactory>();
            this._fixedIncomeFactory   = A.Fake <IUniverseFixedIncomeMarketCacheFactory>();
            this._logger               = A.Fake <ILogger <CancelledOrderRule> >();
            this._tradingHistoryLogger = A.Fake <ILogger <TradingHistoryStack> >();

            this._parameters  = A.Fake <ICancelledOrderRuleEquitiesParameters>();
            this._ruleCtx     = A.Fake <ISystemProcessOperationRunRuleContext>();
            this._alertStream = A.Fake <IUniverseAlertStream>();
        }
 public EquityRuleCancelledOrderFactory(
     IUniverseEquityOrderFilterService orderFilterService,
     IUniverseEquityMarketCacheFactory equityFactory,
     IUniverseFixedIncomeMarketCacheFactory fixedIncomeFactory,
     ILogger <CancelledOrderRule> logger,
     ILogger <TradingHistoryStack> tradingHistoryLogger)
 {
     this._orderFilterService =
         orderFilterService ?? throw new ArgumentNullException(nameof(orderFilterService));
     this._equityFactory        = equityFactory ?? throw new ArgumentNullException(nameof(equityFactory));
     this._fixedIncomeFactory   = fixedIncomeFactory ?? throw new ArgumentNullException(nameof(fixedIncomeFactory));
     this._logger               = logger ?? throw new ArgumentNullException(nameof(logger));
     this._tradingHistoryLogger = tradingHistoryLogger;
 }
Esempio n. 5
0
        public void Setup()
        {
            this._orderFilterService   = A.Fake <IUniverseEquityOrderFilterService>();
            this._equityFactory        = A.Fake <IUniverseEquityMarketCacheFactory>();
            this._fixedIncomeFactory   = A.Fake <IUniverseFixedIncomeMarketCacheFactory>();
            this._portfolioFactory     = A.Fake <IPortfolioFactory>();
            this._orderAnalysisService = A.Fake <IOrderAnalysisService>();
            this._logger = new NullLogger <SpoofingRule>();
            this._tradingHistoryLogger = new NullLogger <TradingHistoryStack>();

            this._spoofingEquitiesParameters = A.Fake <ISpoofingRuleEquitiesParameters>();
            this._ruleCtx     = A.Fake <ISystemProcessOperationRunRuleContext>();
            this._alertStream = A.Fake <IUniverseAlertStream>();
        }
Esempio n. 6
0
        public void Setup()
        {
            this._orderFilterService  = A.Fake <IUniverseEquityOrderFilterService>();
            this._equityFactory       = A.Fake <IUniverseEquityMarketCacheFactory>();
            this._fixedIncomeFactory  = A.Fake <IUniverseFixedIncomeMarketCacheFactory>();
            this._tradingHoursService = A.Fake <IMarketTradingHoursService>();
            this._logger = new NullLogger <MarkingTheCloseRule>();
            this._tradingHistoryLogger  = new NullLogger <TradingHistoryStack>();
            this._dataRequestSubscriber = A.Fake <IUniverseDataRequestsSubscriber>();

            this._equitiesParameters = A.Fake <IMarkingTheCloseEquitiesParameters>();
            this._ruleCtx            = A.Fake <ISystemProcessOperationRunRuleContext>();
            this._alertStream        = A.Fake <IUniverseAlertStream>();
        }
        public void Setup()
        {
            this._currencyConverterService = A.Fake <ICurrencyConverterService>();
            this._clustering           = A.Fake <IClusteringService>();
            this._orderFilterService   = A.Fake <IUniverseEquityOrderFilterService>();
            this._equityFactory        = A.Fake <IUniverseEquityMarketCacheFactory>();
            this._fixedIncomeFactory   = A.Fake <IUniverseFixedIncomeMarketCacheFactory>();
            this._logger               = new NullLogger <WashTradeRule>();
            this._tradingHistoryLogger = new NullLogger <TradingHistoryStack>();

            this._equitiesParameters = A.Fake <IWashTradeRuleEquitiesParameters>();
            this._ruleCtx            = A.Fake <ISystemProcessOperationRunRuleContext>();
            this._alertStream        = A.Fake <IUniverseAlertStream>();
        }
Esempio n. 8
0
        public void Setup()
        {
            _orderFilterService           = A.Fake <IUniverseEquityOrderFilterService>();
            _equityFactory                = A.Fake <IUniverseEquityMarketCacheFactory>();
            _fixedIncomeFactory           = A.Fake <IUniverseFixedIncomeMarketCacheFactory>();
            _tradingHoursService          = A.Fake <IMarketTradingHoursService>();
            this.currencyConverterService = A.Fake <ICurrencyConverterService>();
            _logger = A.Fake <ILogger <IHighVolumeRule> >();
            _tradingHistoryLogger = A.Fake <ILogger <TradingHistoryStack> >();

            _equitiesParameters = A.Fake <IHighVolumeRuleEquitiesParameters>();
            _opCtx                 = A.Fake <ISystemProcessOperationRunRuleContext>();
            _alertStream           = A.Fake <IUniverseAlertStream>();
            _dataRequestSubscriber = A.Fake <IUniverseDataRequestsSubscriber>();
        }
 public EquityRuleHighVolumeFactory(
     IUniverseEquityOrderFilterService orderFilterService,
     IUniverseEquityMarketCacheFactory equityFactory,
     IUniverseFixedIncomeMarketCacheFactory fixedIncomeFactory,
     IMarketTradingHoursService tradingHoursService,
     ICurrencyConverterService currencyConverterService,
     ILogger <IHighVolumeRule> logger,
     ILogger <TradingHistoryStack> tradingHistoryLogger)
 {
     this.orderFilterService       = orderFilterService ?? throw new ArgumentNullException(nameof(orderFilterService));
     this.equityFactory            = equityFactory ?? throw new ArgumentNullException(nameof(equityFactory));
     this.fixedIncomeFactory       = fixedIncomeFactory ?? throw new ArgumentNullException(nameof(fixedIncomeFactory));
     this.tradingHoursService      = tradingHoursService ?? throw new ArgumentNullException(nameof(tradingHoursService));
     this.currencyConverterService = currencyConverterService ?? throw new ArgumentNullException(nameof(currencyConverterService));
     this.logger = logger ?? throw new ArgumentNullException(nameof(logger));
     this.tradingHistoryLogger = tradingHistoryLogger ?? throw new ArgumentNullException(nameof(tradingHistoryLogger));
 }
Esempio n. 10
0
        public WashTradeSteps(ScenarioContext scenarioContext, UniverseSelectionState universeSelectionState)
        {
            this._scenarioContext        = scenarioContext;
            this._universeSelectionState = universeSelectionState;

            var exchangeRateApiRepository = A.Fake <IExchangeRateApiCachingDecorator>();

            var exchangeRateDto = new ExchangeRateDto
            {
                DateTime         = new DateTime(2018, 01, 01),
                Name             = "GBX/USD",
                FixedCurrency    = "GBX",
                VariableCurrency = "USD",
                Rate             = 200d
            };

            A.CallTo(() => exchangeRateApiRepository.GetAsync(A <DateTime> .Ignored, A <DateTime> .Ignored)).Returns(
                new Dictionary <DateTime, IReadOnlyCollection <ExchangeRateDto> >
            {
                { new DateTime(2018, 01, 01), new[] { exchangeRateDto } }
            });

            var currencyLogger = new NullLogger <CurrencyConverterService>();

            this._currencyConverterService = new CurrencyConverterService(exchangeRateApiRepository, currencyLogger);

            this._washTradeClustering           = new ClusteringService();
            this._universeOrderFilterService    = A.Fake <IUniverseEquityOrderFilterService>();
            this._equityMarketCacheFactory      = A.Fake <IUniverseEquityMarketCacheFactory>();
            this._fixedIncomeMarketCacheFactory = A.Fake <IUniverseFixedIncomeMarketCacheFactory>();
            this._logger        = new NullLogger <WashTradeRule>();
            this._tradingLogger = new NullLogger <TradingHistoryStack>();

            this._equityRuleWashTradeFactory = new EquityRuleWashTradeFactory(
                this._currencyConverterService,
                this._washTradeClustering,
                this._universeOrderFilterService,
                this._equityMarketCacheFactory,
                this._fixedIncomeMarketCacheFactory,
                this._logger,
                this._tradingLogger);

            this._ruleCtx     = A.Fake <ISystemProcessOperationRunRuleContext>();
            this._alertStream = A.Fake <IUniverseAlertStream>();
        }
Esempio n. 11
0
 public EquityRulePlacingOrdersWithoutIntentToExecuteFactory(
     IUniverseEquityOrderFilterService orderFilterService,
     IUniverseEquityMarketCacheFactory equityFactory,
     IUniverseFixedIncomeMarketCacheFactory fixedIncomeFactory,
     IMarketTradingHoursService tradingHoursService,
     ILogger <PlacingOrdersWithNoIntentToExecuteRule> logger,
     ILogger <TradingHistoryStack> tradingHistoryLogger)
 {
     this._orderFilterService =
         orderFilterService ?? throw new ArgumentNullException(nameof(orderFilterService));
     this._equityFactory        = equityFactory ?? throw new ArgumentNullException(nameof(equityFactory));
     this._fixedIncomeFactory   = fixedIncomeFactory ?? throw new ArgumentNullException(nameof(fixedIncomeFactory));
     this._logger               = logger ?? throw new ArgumentNullException(nameof(logger));
     this._tradingHistoryLogger =
         tradingHistoryLogger ?? throw new ArgumentNullException(nameof(tradingHistoryLogger));
     this._tradingHoursService =
         tradingHoursService ?? throw new ArgumentNullException(nameof(tradingHoursService));
 }
Esempio n. 12
0
 public EquityRuleSpoofingFactory(
     IUniverseEquityMarketCacheFactory equityFactory,
     IUniverseFixedIncomeMarketCacheFactory fixedIncomeFactory,
     IUniverseEquityOrderFilterService orderFilterService,
     IPortfolioFactory portfolioFactory,
     IOrderAnalysisService analysisService,
     ILogger <SpoofingRule> logger,
     ILogger <TradingHistoryStack> tradingHistoryLogger)
 {
     this._orderFilterService =
         orderFilterService ?? throw new ArgumentNullException(nameof(orderFilterService));
     this._equityFactory        = equityFactory ?? throw new ArgumentNullException(nameof(equityFactory));
     this._fixedIncomeFactory   = fixedIncomeFactory ?? throw new ArgumentNullException(nameof(fixedIncomeFactory));
     this._portfolioFactory     = portfolioFactory ?? throw new ArgumentNullException(nameof(portfolioFactory));
     this._orderAnalysisService = analysisService ?? throw new ArgumentNullException(nameof(analysisService));
     this._logger = logger ?? throw new ArgumentNullException(nameof(logger));
     this._tradingHistoryLogger =
         tradingHistoryLogger ?? throw new ArgumentNullException(nameof(tradingHistoryLogger));
 }
 public HighVolumeVenueDecoratorFilterFactory(
     IUniverseEquityOrderFilterService equityOrderFilterService,
     IUniverseEquityMarketCacheFactory equityMarketCacheFactory,
     IUniverseFixedIncomeMarketCacheFactory fixedIncomeMarketCacheFactory,
     IMarketTradingHoursService marketTradingHoursService,
     ILogger <TradingHistoryStack> tradingHistoryLogger,
     ILogger <HighVolumeVenueFilter> venueLogger)
 {
     this._equityOrderFilterService = equityOrderFilterService
                                      ?? throw new ArgumentNullException(nameof(equityOrderFilterService));
     this._equityMarketCacheFactory = equityMarketCacheFactory
                                      ?? throw new ArgumentNullException(nameof(equityMarketCacheFactory));
     this._fixedIncomeMarketCacheFactory = fixedIncomeMarketCacheFactory
                                           ?? throw new ArgumentNullException(nameof(fixedIncomeMarketCacheFactory));
     this._marketTradingHoursService = marketTradingHoursService
                                       ?? throw new ArgumentNullException(nameof(marketTradingHoursService));
     this._tradingHistoryLogger =
         tradingHistoryLogger ?? throw new ArgumentNullException(nameof(tradingHistoryLogger));
     this._venueLogger = venueLogger ?? throw new ArgumentNullException(nameof(venueLogger));
 }
Esempio n. 14
0
 public EquityRuleWashTradeFactory(
     ICurrencyConverterService currencyConverterService,
     IClusteringService clustering,
     IUniverseEquityOrderFilterService orderFilterService,
     IUniverseEquityMarketCacheFactory equityFactory,
     IUniverseFixedIncomeMarketCacheFactory fixedIncomeFactory,
     ILogger <WashTradeRule> logger,
     ILogger <TradingHistoryStack> tradingHistoryLogger)
 {
     this._currencyConverterService = currencyConverterService
                                      ?? throw new ArgumentNullException(nameof(currencyConverterService));
     this._clustering         = clustering ?? throw new ArgumentNullException(nameof(clustering));
     this._orderFilterService =
         orderFilterService ?? throw new ArgumentNullException(nameof(orderFilterService));
     this._equityFactory        = equityFactory ?? throw new ArgumentNullException(nameof(equityFactory));
     this._fixedIncomeFactory   = fixedIncomeFactory ?? throw new ArgumentNullException(nameof(fixedIncomeFactory));
     this._logger               = logger ?? throw new ArgumentNullException(nameof(logger));
     this._tradingHistoryLogger =
         tradingHistoryLogger ?? throw new ArgumentNullException(nameof(tradingHistoryLogger));
 }
        public void Setup()
        {
            this._orderFilterService            = A.Fake <IUniverseEquityOrderFilterService>();
            this._costCalculatorFactory         = A.Fake <ICostCalculatorFactory>();
            this._revenueCalculatorFactory      = A.Fake <IRevenueCalculatorFactory>();
            this._exchangeRateProfitCalculator  = A.Fake <IExchangeRateProfitCalculator>();
            this._equityMarketCacheFactory      = A.Fake <IUniverseEquityMarketCacheFactory>();
            this._fixedIncomeMarketCacheFactory = A.Fake <IUniverseFixedIncomeMarketCacheFactory>();
            this._cacheStrategyFactory          = A.Fake <IEquityMarketDataCacheStrategyFactory>();
            this._judgementService         = A.Fake <IJudgementService>();
            this._logger                   = new NullLogger <HighProfitsRule>();
            this._tradingHistoryLogger     = new NullLogger <TradingHistoryStack>();
            this._currencyConverterService = A.Fake <ICurrencyConverterService>();

            this._equitiesParameters    = A.Fake <IHighProfitsRuleEquitiesParameters>();
            this._ruleCtxStream         = A.Fake <ISystemProcessOperationRunRuleContext>();
            this._ruleCtxMarket         = A.Fake <ISystemProcessOperationRunRuleContext>();
            this._dataRequestSubscriber = A.Fake <IUniverseDataRequestsSubscriber>();
            this._scheduledExecution    = new ScheduledExecution();
        }
Esempio n. 16
0
 public EquityRuleRampingFactory(
     IRampingAnalyser rampingAnalyser,
     IUniverseEquityOrderFilterService orderFilterService,
     IUniverseEquityMarketCacheFactory equityFactory,
     IUniverseFixedIncomeMarketCacheFactory fixedIncomeFactory,
     IMarketTradingHoursService tradingHoursService,
     ILogger <IRampingRule> logger,
     ILogger <TradingHistoryStack> tradingHistoryLogger)
 {
     this._rampingAnalyser    = rampingAnalyser ?? throw new ArgumentNullException(nameof(rampingAnalyser));
     this._orderFilterService =
         orderFilterService ?? throw new ArgumentNullException(nameof(orderFilterService));
     this._equityFactory        = equityFactory ?? throw new ArgumentNullException(nameof(equityFactory));
     this._fixedIncomeFactory   = fixedIncomeFactory ?? throw new ArgumentNullException(nameof(fixedIncomeFactory));
     this._logger               = logger ?? throw new ArgumentNullException(nameof(logger));
     this._tradingHistoryLogger =
         tradingHistoryLogger ?? throw new ArgumentNullException(nameof(tradingHistoryLogger));
     this._tradingHoursService =
         tradingHoursService ?? throw new ArgumentNullException(nameof(tradingHoursService));
 }
        /// <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)
            });

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

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

            this.universeOrderFilterService = A.Fake <IUniverseEquityOrderFilterService>();
            this.logger                = new NullLogger <HighProfitsRule>();
            this.tradingLogger         = new NullLogger <TradingHistoryStack>();
            this.ruleContext           = A.Fake <ISystemProcessOperationRunRuleContext>();
            this.dataRequestSubscriber = A.Fake <IUniverseDataRequestsSubscriber>();

            this.exchangeRateProfitCalculator   = A.Fake <IExchangeRateProfitCalculator>();
            this.marketDataCacheStrategyFactory = new EquityMarketDataCacheStrategyFactory();

            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.equityRuleHighProfitFactory = new EquityRuleHighProfitFactory(
                this.costCalculatorFactory,
                this.revenueCalculatorFactory,
                this.exchangeRateProfitCalculator,
                this.universeOrderFilterService,
                this.equityMarketCacheFactory,
                this.fixedIncomeMarketCacheFactory,
                this.marketDataCacheStrategyFactory,
                new CurrencyConverterService(
                    this.exchangeRateSelection.ExchangeRateRepository,
                    new NullLogger <CurrencyConverterService>()),
                this.logger,
                this.tradingLogger);

            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.exchangeRateProfitCalculator   = A.Fake <IExchangeRateProfitCalculator>();
            this.marketDataCacheStrategyFactory = new EquityMarketDataCacheStrategyFactory();
        }
        public RampingSteps(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>();

            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._rampingAnalyser = new RampingAnalyser(
                new TimeSeriesTrendClassifier(new NullLogger <TimeSeriesTrendClassifier>()),
                new OrderPriceImpactClassifier());
            this._equityOrderFilterService = A.Fake <IUniverseEquityOrderFilterService>();

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

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

            this._equityRuleRampingFactory = new EquityRuleRampingFactory(
                this._rampingAnalyser,
                this._equityOrderFilterService,
                equityMarketCacheFactory,
                fixedIncomeMarketCacheFactory,
                this._tradingHoursService,
                new NullLogger <RampingRule>(),
                new NullLogger <TradingHistoryStack>());
        }
        public HighVolumeSteps(ScenarioContext scenarioContext, UniverseSelectionState universeSelectionState)
        {
            _scenarioContext        = scenarioContext;
            _universeSelectionState = universeSelectionState;

            var exchangeRateApiRepository = A.Fake <IExchangeRateApiCachingDecorator>();

            var exchangeRateDto = new ExchangeRateDto
            {
                DateTime = new DateTime(2018, 01, 01), Name = "GBX/USD", FixedCurrency = "GBX", VariableCurrency = "USD", Rate = 0.02d
            };

            var exchangeRateDtoJpy = new ExchangeRateDto
            {
                DateTime         = new DateTime(2018, 01, 01),
                Name             = "USD/JPY",
                FixedCurrency    = "USD",
                VariableCurrency = "JPY",
                Rate             = 100
            };

            var exchangeRateDtoGbx = new ExchangeRateDto
            {
                DateTime         = new DateTime(2018, 01, 01),
                Name             = "GBX/GBX",
                FixedCurrency    = "GBX",
                VariableCurrency = "GBX",
                Rate             = 1
            };

            A.CallTo(() =>
                     exchangeRateApiRepository.GetAsync(A <DateTime> .Ignored, A <DateTime> .Ignored))
            .Returns(new Dictionary <DateTime, IReadOnlyCollection <ExchangeRateDto> >
            {
                { new DateTime(2018, 01, 01), new ExchangeRateDto[]
                  {
                      exchangeRateDto,
                      exchangeRateDtoJpy,
                      exchangeRateDtoGbx
                  } }
            });

            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              = "NASDAQ",
                    MarketOpenTime    = TimeSpan.FromHours(15),
                    MarketCloseTime   = TimeSpan.FromHours(23),
                    IsOpenOnMonday    = true,
                    IsOpenOnTuesday   = true,
                    IsOpenOnWednesday = true,
                    IsOpenOnThursday  = true,
                    IsOpenOnFriday    = true,
                    IsOpenOnSaturday  = true,
                    IsOpenOnSunday    = true,
                }
            });

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

            _equityMarketCacheFactory = new UniverseEquityMarketCacheFactory(
                new StubRuleRunDataRequestRepository(),
                new StubRuleRunDataRequestRepository(),
                new NullLogger <UniverseEquityMarketCacheFactory>());

            _fixedIncomeMarketCacheFactory = new UniverseFixedIncomeMarketCacheFactory(
                new StubRuleRunDataRequestRepository(),
                new StubRuleRunDataRequestRepository(),
                new NullLogger <UniverseFixedIncomeMarketCacheFactory>());

            var currencyLogger = new NullLogger <CurrencyConverterService>();

            currencyConverterService    = new CurrencyConverterService(exchangeRateApiRepository, currencyLogger);
            _universeOrderFilterService = A.Fake <IUniverseEquityOrderFilterService>();
            _logger                      = new NullLogger <HighVolumeRule>();
            _tradingLogger               = new NullLogger <TradingHistoryStack>();
            _ruleCtx                     = A.Fake <ISystemProcessOperationRunRuleContext>();
            _alertStream                 = A.Fake <IUniverseAlertStream>();
            _dataRequestSubscriber       = A.Fake <IUniverseDataRequestsSubscriber>();
            _equityRuleHighVolumeFactory = new EquityRuleHighVolumeFactory(
                _universeOrderFilterService,
                _equityMarketCacheFactory,
                _fixedIncomeMarketCacheFactory,
                _tradingHoursService,
                this.currencyConverterService,
                _logger,
                _tradingLogger);
        }
        public HighVolumeVenueFilterSteps(
            ScenarioContext scenarioContext,
            UniverseSelectionState universeSelectionState)
        {
            this._scenarioContext        = scenarioContext;
            this._universeSelectionState = universeSelectionState;
            this._observer = A.Fake <IObserver <IUniverseEvent> >();
            this._universeDataRequestsSubscriber = A.Fake <IUniverseDataRequestsSubscriber>();

            var exchangeRateApiRepository = A.Fake <IExchangeRateApiCachingDecorator>();

            var exchangeRateDto = new ExchangeRateDto
            {
                DateTime         = new DateTime(2018, 01, 01),
                Name             = "GBX/USD",
                FixedCurrency    = "GBX",
                VariableCurrency = "USD",
                Rate             = 0.02d
            };

            A.CallTo(() => exchangeRateApiRepository.GetAsync(A <DateTime> .Ignored, A <DateTime> .Ignored)).Returns(
                new Dictionary <DateTime, IReadOnlyCollection <ExchangeRateDto> >
            {
                { new DateTime(2018, 01, 01), new[] { exchangeRateDto } }
            });

            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._interdayUniverseMarketCacheFactory = new UniverseEquityMarketCacheFactory(
                new StubRuleRunDataRequestRepository(),
                new StubRuleRunDataRequestRepository(),
                new NullLogger <UniverseEquityMarketCacheFactory>());

            this._universeOrderFilterService = A.Fake <IUniverseEquityOrderFilterService>();
            this._logger        = new NullLogger <HighVolumeRule>();
            this._tradingLogger = new NullLogger <TradingHistoryStack>();
            this._ruleCtx       = A.Fake <ISystemProcessOperationRunRuleContext>();
        }
Esempio n. 21
0
        public MarkingTheCloseSteps(ScenarioContext scenarioContext, UniverseSelectionState universeSelectionState)
        {
            this._scenarioContext        = scenarioContext;
            this._universeSelectionState = universeSelectionState;

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

            this._fixedIncomeMarketCacheFactory = new UniverseFixedIncomeMarketCacheFactory(
                new StubRuleRunDataRequestRepository(),
                new StubRuleRunDataRequestRepository(),
                new NullLogger <UniverseFixedIncomeMarketCacheFactory>());

            this._alertStream = A.Fake <IUniverseAlertStream>();
            this._ruleCtx     = A.Fake <ISystemProcessOperationRunRuleContext>();
            this._universeOrderFilterService = 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>());
            this._dataRequestSubscriber = A.Fake <IUniverseDataRequestsSubscriber>();

            this._equityRuleMarkingTheCloseFactory = new EquityRuleMarkingTheCloseFactory(
                this._universeOrderFilterService,
                this._equityMarketCacheFactory,
                this._fixedIncomeMarketCacheFactory,
                this._tradingHoursService,
                new NullLogger <MarkingTheCloseRule>(),
                new NullLogger <TradingHistoryStack>());
        }