コード例 #1
0
        public void Initiate(IStockExchangeStream stockStream)
        {
            lock (this._stateTransition)
            {
                if (stockStream == null)
                {
                    this._logger.Log(
                        LogLevel.Error,
                        "Initiation attempt in order data generator with null stock stream");
                    return;
                }

                this._stockStream  = stockStream;
                this._unsubscriber = stockStream.Subscribe(this);
            }

            if (string.IsNullOrWhiteSpace(this._path))
            {
                this._logger.LogError(
                    "Equities File Data Import Process did not find file because the path was empty or null");
                return;
            }

            if (!Directory.Exists(this._path))
            {
                Directory.CreateDirectory(this._path);
            }
        }
コード例 #2
0
        public void InitiateTrading(IStockExchangeStream stockStream, IOrderStream <Order> tradeStream)
        {
            lock (this._stateTransition)
            {
                if (stockStream == null)
                {
                    this.Logger.Log(
                        LogLevel.Error,
                        "Initiation attempt in order data generator with null stock stream");
                    return;
                }

                if (tradeStream == null)
                {
                    this.Logger.Log(
                        LogLevel.Error,
                        "Initiation attempt in order data generator with null trade stream");
                    return;
                }

                if (this._generatorExecuting)
                {
                    this.Logger.LogInformation("Initiating new trading with predecessor active");
                    this._TerminateTrading();
                }

                this.Logger.LogInformation("Order data generator initiated with new stock stream");
                this.StockStream         = stockStream;
                this.TradeStream         = tradeStream;
                this._unsubscriber       = stockStream.Subscribe(this);
                this._generatorExecuting = true;

                this._InitiateTrading();
            }
        }
 public void InitiateTrading(IStockExchangeStream stockStream, IOrderStream <Order> tradeStream)
 {
     this._unsubscriber = stockStream.Subscribe(this);
     this._stream       = this._streamFactory.Create();
     this._baseGenerator.InitiateTrading(this._stream, tradeStream);
 }