Attach() public method

public Attach ( EventBus bus ) : void
bus EventBus
return void
Exemplo n.º 1
0
        private Framework(string name, FrameworkMode mode, bool createServers, EventBus externalBus, InstrumentServer instrumentServer, DataServer dataServer)
        {
            Name      = name;
            this.mode = mode;
            LoadConfiguration();

            // Setup events compoents setup
            EventBus      = new EventBus(this);
            OutputManager = new OutputManager(this);
            Clock         = new Clock(this, ClockType.Local);
            EventBus.LocalClockEventQueue = Clock.ReminderQueue;
            ExchangeClock = new Clock(this, ClockType.Exchange);
            EventBus.ExchangeClockEventQueue = ExchangeClock.ReminderQueue;
            if (externalBus != null)
            {
                externalBus.Attach(EventBus);
            }
            EventServer  = new EventServer(this, EventBus);
            EventManager = new EventManager(this, EventBus);

            // Setup streamers
            StreamerManager = new StreamerManager();
            StreamerManager.AddDefaultStreamers();

            // Create Servers
            var iServer = instrumentServer ?? new FileInstrumentServer(this, Configuration.InstrumentFileName);
            var dServer = dataServer ?? new FileDataServer(this, Configuration.DataFileName);
            var oServer = new FileOrderServer(this, Configuration.OrderFileName);
            var pServer = new FilePortfolioServer(this, Configuration.PortfolioFileName);

            InstrumentManager = new InstrumentManager(this, iServer);
            InstrumentServer  = iServer;
            InstrumentManager.Load();
            DataManager      = new DataManager(this, dServer);
            DataServer       = dServer;
            OrderManager     = new OrderManager(this, oServer);
            OrderServer      = oServer;
            PortfolioManager = new PortfolioManager(this, pServer);
            PortfolioServer  = pServer;
            UserServer       = new XmlUserServer(this);
            UserManager      = new UserManager(this, UserServer);
            UserManager.Load();

            // Create Providers
            ProviderManager = new ProviderManager(this);

            // Other stuff
            EventLoggerManager  = new EventLoggerManager();
            SubscriptionManager = new SubscriptionManager(this);
            ScenarioManager     = new ScenarioManager(this);
            StrategyManager     = new StrategyManager(this);
            StatisticsManager   = new StatisticsManager(this);
            GroupManager        = new GroupManager(this);
            AccountDataManager  = new AccountDataManager(this);
            LicenseManager      = new LicenseManager();
            CurrencyConverter   = new CurrencyConverter(this);
            DataFileManager     = new DataFileManager(Installation.DataDir.FullName);

            instance = instance ?? this;
        }
Exemplo n.º 2
0
        private Framework(string name, FrameworkMode mode, bool createServers, EventBus externalBus, InstrumentServer instrumentServer, DataServer dataServer)
        {
            Name = name;
            this.mode = mode;
            LoadConfiguration();

            // Setup events compoents setup
            EventBus = new EventBus(this);
            OutputManager = new OutputManager(this);
            Clock = new Clock(this, ClockType.Local);
            EventBus.LocalClockEventQueue = Clock.ReminderQueue;
            ExchangeClock = new Clock(this, ClockType.Exchange);
            EventBus.ExchangeClockEventQueue = ExchangeClock.ReminderQueue;
            if (externalBus != null)
                externalBus.Attach(EventBus);
            EventServer = new EventServer(this, EventBus);
            EventManager = new EventManager(this, EventBus);

            // Setup streamers
            StreamerManager = new StreamerManager();
            StreamerManager.AddDefaultStreamers();

            // Create Servers
            var iServer = instrumentServer ?? new FileInstrumentServer(this, Configuration.InstrumentFileName);
            var dServer = dataServer ?? new FileDataServer(this, Configuration.DataFileName);
            var oServer = new FileOrderServer(this, Configuration.OrderFileName);
            var pServer = new FilePortfolioServer(this, Configuration.PortfolioFileName);

            InstrumentManager = new InstrumentManager(this, iServer);
            InstrumentServer = iServer;
            InstrumentManager.Load();
            DataManager = new DataManager(this, dServer);
            DataServer = dServer;
            OrderManager = new OrderManager(this, oServer);
            OrderServer = oServer;
            PortfolioManager = new PortfolioManager(this, pServer);
            PortfolioServer = pServer;
            UserServer = new XmlUserServer(this);
            UserManager = new UserManager(this, UserServer);
            UserManager.Load();

            // Create Providers
            ProviderManager = new ProviderManager(this);

            // Other stuff
            EventLoggerManager = new EventLoggerManager();
            SubscriptionManager = new SubscriptionManager(this);
            ScenarioManager = new ScenarioManager(this);
            StrategyManager = new StrategyManager(this);
            StatisticsManager = new StatisticsManager(this);
            GroupManager = new GroupManager(this);
            AccountDataManager = new AccountDataManager(this);
            LicenseManager = new LicenseManager();
            CurrencyConverter = new CurrencyConverter(this);
            DataFileManager = new DataFileManager(Installation.DataDir.FullName);

            instance = instance ?? this;
        }