Exemplo n.º 1
0
 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;
     }
 }
Exemplo n.º 2
0
		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;
			}
		}