Ejemplo n.º 1
0
        public void InitiateTrading_WithExistingTrading_DoesNotDeadLockOnTerminatingOldTrading()
        {
            var orderDataGenerator = new TradingMarketUpdateDrivenProcess(this._logger, this._tradeStrategy);

            orderDataGenerator.InitiateTrading(this._stockStream, this._tradeStream);
            orderDataGenerator.InitiateTrading(this._stockStream, this._tradeStream);

            A.CallTo(() => this._unsubscriber.Dispose()).MustHaveHappenedOnceExactly();
        }
Ejemplo n.º 2
0
        // Assemble choices
        public IOrderDataGenerator Finish()
        {
            if (this._heartbeatSelected)
            {
                var strategy = new MarkovTradeStrategy(this._logger, this._volumeStrategy);
                IOrderDataGenerator process = new TradingHeartBeatDrivenProcess(
                    this._logger,
                    strategy,
                    this._heartbeat);

                if (this._sedolFilter != null && this._sedolFilter.Any())
                {
                    process = new OrderDataGeneratorSedolFilteringDecorator(
                        this._streamFactory,
                        process,
                        this._sedolFilter,
                        this._inclusive);
                }

                return(process);
            }

            if (this._marketUpdateSelected)
            {
                var strategy = new MarkovTradeStrategy(this._logger, this._volumeStrategy);
                IOrderDataGenerator process = new TradingMarketUpdateDrivenProcess(this._logger, strategy);

                if (this._sedolFilter != null && this._sedolFilter.Any())
                {
                    process = new OrderDataGeneratorSedolFilteringDecorator(
                        this._streamFactory,
                        process,
                        this._sedolFilter,
                        this._inclusive);
                }

                return(process);
            }

            throw new ArgumentOutOfRangeException(nameof(this._marketUpdateSelected));
        }