Exemple #1
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>());
        }
        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>());
        }
Exemple #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FixedIncomeHighVolumeSteps"/> class.
 /// </summary>
 /// <param name="scenarioContext">
 /// The scenario context.
 /// </param>
 /// <param name="universeSelectionState">
 /// The universe selection state.
 /// </param>
 public FixedIncomeHighVolumeSteps(
     ScenarioContext scenarioContext,
     UniverseSelectionState universeSelectionState)
 {
     this.scenarioContext        = scenarioContext;
     this.universeSelectionState = universeSelectionState;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="HighProfitSteps"/> class.
 /// </summary>
 /// <param name="scenarioContext">
 /// The scenario context.
 /// </param>
 /// <param name="universeSelectionState">
 /// The universe selection state.
 /// </param>
 /// <param name="exchangeRateSelection">
 /// The exchange rate selection.
 /// </param>
 public HighProfitSteps(
     ScenarioContext scenarioContext,
     UniverseSelectionState universeSelectionState,
     ExchangeRateSelection exchangeRateSelection)
 {
     this.scenarioContext        = scenarioContext;
     this.universeSelectionState = universeSelectionState;
     this.exchangeRateSelection  = exchangeRateSelection;
 }
 public UniverseSteps(
     ScenarioContext scenarioContext,
     UniverseSelectionState universeSelectionState,
     SecuritySelection securitySelection)
 {
     this._scenarioContext        = scenarioContext;
     this._universeSelectionState = universeSelectionState;
     this._securitySelection      = securitySelection;
 }
Exemple #6
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>();
        }
        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);
        }
Exemple #8
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>());
        }
        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>();
        }
        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 FixedIncomeWashTradeSteps(ScenarioContext scenarioContext, UniverseSelectionState universeSelectionState)
 {
     this._scenarioContext        = scenarioContext;
     this._universeSelectionState = universeSelectionState;
 }