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>());
        }
Beispiel #2
0
        public SpoofingSteps(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>());

            this._equityRuleSpoofingFactory = new EquityRuleSpoofingFactory(
                equityMarketCacheFactory,
                fixedIncomeMarketCacheFactory,
                new UniverseEquityOrderFilterService(new NullLogger <UniverseEquityOrderFilterService>()),
                new PortfolioFactory(),
                this._orderAnalysisService,
                new NullLogger <SpoofingRule>(),
                new NullLogger <TradingHistoryStack>());
        }
Beispiel #3
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>());
        }
Beispiel #4
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>());
        }
        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>());
        }