コード例 #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;
        }
コード例 #2
0
        private Framework(string name, FrameworkMode mode, bool createServers, EventBus externalBus, InstrumentServer instrumentServer, DataServer dataServer, string fileServerPath)
        {
            Name = name;
            this.mode = mode;
            LoadConfiguration();

            // Setup events compoents setup
            EventBus = new EventBus(this);
            OutputManager = new OutputManager(this, Configuration.IsOutputLogEnabled ? Configuration.OutputLogFileName : null);
            Clock = new Clock(this, ClockType.Local, false);
            EventBus.LocalClockEventQueue = Clock.ReminderQueue;
            ExchangeClock = new Clock(this, ClockType.Exchange, false);
            EventBus.ExchangeClockEventQueue = ExchangeClock.ReminderQueue;
            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;
        }