public void Build_RuleCtx_Null_Throws_Exception()
        {
            var factory = new EquityRuleWashTradeFactory(
                this._currencyConverterService,
                this._clustering,
                this._orderFilterService,
                this._equityFactory,
                this._fixedIncomeFactory,
                this._logger,
                this._tradingHistoryLogger);

            Assert.Throws <ArgumentNullException>(
                () => factory.Build(this._equitiesParameters, null, this._alertStream, RuleRunMode.ForceRun));
        }
Ejemplo n.º 2
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 void Build_Returns_A_WashTrade_Rule()
        {
            var factory = new EquityRuleWashTradeFactory(
                this._currencyConverterService,
                this._clustering,
                this._orderFilterService,
                this._equityFactory,
                this._fixedIncomeFactory,
                this._logger,
                this._tradingHistoryLogger);

            var result = factory.Build(
                this._equitiesParameters,
                this._ruleCtx,
                this._alertStream,
                RuleRunMode.ForceRun);

            Assert.IsNotNull(result);
            Assert.IsInstanceOf <WashTradeRule>(result);
        }