コード例 #1
0
ファイル: Framework.cs プロジェクト: ForTrade/CSharp
		public Framework(string name, EventBus externalBus, InstrumentServer instrumentServer, DataServer dataServer = null)
		{
			this.isExternalDataQueue = true;
			this.name = name;
			this.LoadConfiguration();
			this.clock = new Clock(this, ClockMode.Realtime, false);
			this.eventBus = new EventBus(this, EventBusMode.Realtime);
			this.eventBus.reminderQueue = this.clock.reminderQueue;
			externalBus.Attach(this.eventBus);
			this.eventServer = new EventServer(this, this.eventBus);
			this.eventManager = new EventManager(this, this.eventBus);
			this.streamerManager = new StreamerManager();
			this.streamerManager.Add(new DataObjectStreamer());
			this.streamerManager.Add(new InstrumentStreamer());
			this.streamerManager.Add(new BidStreamer());
			this.streamerManager.Add(new AskStreamer());
			this.streamerManager.Add(new QuoteStreamer());
			this.streamerManager.Add(new TradeStreamer());
			this.streamerManager.Add(new BarStreamer());
			this.streamerManager.Add(new Level2SnapshotStreamer());
			this.streamerManager.Add(new Level2UpdateStreamer());
			this.streamerManager.Add(new NewsStreamer());
			this.streamerManager.Add(new FundamentalStreamer());
			this.streamerManager.Add(new DataSeriesStreamer());
			this.instrumentServer = instrumentServer;
			this.instrumentManager = new InstrumentManager(this, instrumentServer);
			this.dataServer = dataServer;
			this.dataManager = new DataManager(this, dataServer);
			this.providerManager = new ProviderManager(this, null, new ExecutionSimulator(this));
			this.eventLoggerManager = new EventLoggerManager();
			this.orderManager = new OrderManager(this);
			this.portfolioManager = new PortfolioManager(this);
			this.strategyManager = new StrategyManager(this);
			this.groupManager = new GroupManager(this);
			this.currencyConverter = new CurrencyConverter(this);
			this.dataFileManager = new DataFileManager(Installation.DataDir.FullName);
			if (Framework.currentFramework == null)
			{
				Framework.currentFramework = this;
			}
		}
コード例 #2
0
ファイル: Framework.cs プロジェクト: ForTrade/CSharp
		public Framework(string name = "", bool createServers = true)
		{
			this.name = name;
			this.LoadConfiguration();
			this.eventBus = new EventBus(this, EventBusMode.Realtime);
			this.clock = new Clock(this, ClockMode.Realtime, false);
			this.eventBus.reminderQueue = this.clock.reminderQueue;
			this.eventServer = new EventServer(this, this.eventBus);
			this.eventManager = new EventManager(this, this.eventBus);
			this.streamerManager = new StreamerManager();
			this.streamerManager.Add(new DataObjectStreamer());
			this.streamerManager.Add(new InstrumentStreamer());
			this.streamerManager.Add(new BidStreamer());
			this.streamerManager.Add(new AskStreamer());
			this.streamerManager.Add(new QuoteStreamer());
			this.streamerManager.Add(new TradeStreamer());
			this.streamerManager.Add(new BarStreamer());
			this.streamerManager.Add(new Level2SnapshotStreamer());
			this.streamerManager.Add(new Level2UpdateStreamer());
			this.streamerManager.Add(new NewsStreamer());
			this.streamerManager.Add(new FundamentalStreamer());
			this.streamerManager.Add(new DataSeriesStreamer());
			if (createServers)
			{
				if (this.configuration.IsInstrumentFileLocal)
				{
					this.instrumentServer = new FileInstrumentServer(this, this.configuration.InstrumentFileName, null);
				}
				else
				{
					this.instrumentServer = new FileInstrumentServer(this, "instruments.quant", this.configuration.InstrumentFileHost);
				}
				this.instrumentManager = new InstrumentManager(this, this.InstrumentServer);
				if (this.configuration.IsDataFileLocal)
				{
					this.dataServer = new FileDataServer(this, this.configuration.DataFileName, null);
				}
				else
				{
					this.dataServer = new FileDataServer(this, "data.quant", this.configuration.DataFileHost);
				}
				this.dataManager = new DataManager(this, this.dataServer);
			}
			this.providerManager = new ProviderManager(this, null, new ExecutionSimulator(this));
			this.eventLoggerManager = new EventLoggerManager();
			this.subscriptionManager = new SubscriptionManager(this);
			this.orderManager = new OrderManager(this);
			this.portfolioManager = new PortfolioManager(this);
			this.strategyManager = new StrategyManager(this);
			this.groupManager = new GroupManager(this);
			this.accountDataManager = new AccountDataManager(this);
			this.currencyConverter = new CurrencyConverter(this);
			this.dataFileManager = new DataFileManager(Installation.DataDir.FullName);
			if (Framework.currentFramework == null)
			{
				Framework.currentFramework = this;
			}
		}