Inheritance: IDisposable
Beispiel #1
0
 private void Dispose(bool dispoing)
 {
     if (!this.disposed)
     {
         if (dispoing)
         {
             SaveConfiguration();
             if (this.bool_1)
             {
                 InstrumentServer?.Dispose();
             }
             if (this.bool_2)
             {
                 DataServer?.Dispose();
             }
             if (this.bool_3)
             {
                 OrderServer?.Dispose();
             }
             if (this.bool_4)
             {
                 PortfolioServer?.Dispose();
             }
             ProviderManager?.Dispose();
             DataManager?.Dispose();
             EventManager?.Dispose();
             OutputManager?.Dispose();
         }
         this.disposed = true;
     }
 }
Beispiel #2
0
 public DataManager(Framework framework, DataServer server)
 {
     this.framework = framework;
     Server = server;
     Server?.Open();
     this.thread = new Thread(ThreadRun) { Name = "Data Manager Thread", IsBackground = true };
     this.thread.Start();
 }
Beispiel #3
0
 public DataManager(Framework framework, DataServer server)
 {
     this.framework = framework;
     Server         = server;
     Server?.Open();
     this.thread = new Thread(ThreadRun)
     {
         Name = "Data Manager Thread", IsBackground = true
     };
     this.thread.Start();
 }
Beispiel #4
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;
        }
Beispiel #5
0
 public Framework(string name, EventBus externalBus, InstrumentServer instrumentServer, DataServer dataServer = null) : this(name, FrameworkMode.Simulation, createServers: false, externalBus: externalBus, instrumentServer: instrumentServer, dataServer: dataServer, fileServerPath: String.Empty)
 {
 }
Beispiel #6
0
 public Framework(string name, InstrumentServer instrumentServer, DataServer dataServer) : this(name, FrameworkMode.Simulation, createServers: false, externalBus: null, instrumentServer: instrumentServer, dataServer: dataServer)
 {
 }
Beispiel #7
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;
        }
Beispiel #8
0
 public Framework(string name, EventBus externalBus, InstrumentServer instrumentServer, DataServer dataServer = null) : this(name, FrameworkMode.Simulation, createServers : false, externalBus : externalBus, instrumentServer : instrumentServer, dataServer : dataServer, fileServerPath : String.Empty)
 {
 }
Beispiel #9
0
 public Framework(string name, InstrumentServer instrumentServer, DataServer dataServer) : this(name, FrameworkMode.Simulation, createServers : false, externalBus : null, instrumentServer : instrumentServer, dataServer : dataServer)
 {
 }