Exemplo n.º 1
0
        /// <summary>
        /// создать менеджера роботов
        /// </summary>
        /// <param name="hostChart">область для чарта</param>
        /// <param name="hostGlass">область для стакана</param>
        /// <param name="hostOpenDeals">область для таблицы открытых сделок</param>
        /// <param name="hostCloseDeals">область для таблицы закрытых сделок</param>
        /// <param name="hostAllDeals">область всех сделок</param>
        /// <param name="hostLogBot">область для бот лога</param>
        /// <param name="hostLogPrime">область для прайм лога</param>
        /// <param name="rectangleAroundChart">квадрат за чартом</param>
        /// <param name="hostAlerts">область для алертов</param>
        /// <param name="tabPanel">панель с роботами</param>
        /// <param name="tabBotTab">панель робота с вкладками инструментов</param>
        /// <param name="textBoxLimitPrice">текстБокс с ценой лимитника при вводе заявки</param>
        /// <param name="gridChartControlPanel">грид для панели управления чартом</param>
        /// <param name="startProgram">тип программы который запросил создание класса</param>
        public OsTraderMaster(WindowsFormsHost hostChart, WindowsFormsHost hostGlass, WindowsFormsHost hostOpenDeals,
                              WindowsFormsHost hostCloseDeals, WindowsFormsHost hostAllDeals, WindowsFormsHost hostLogBot, WindowsFormsHost hostLogPrime, Rectangle rectangleAroundChart, WindowsFormsHost hostAlerts,
                              TabControl tabPanel, TabControl tabBotTab, TextBox textBoxLimitPrice, Grid gridChartControlPanel, StartProgram startProgram)
        {
            NumberGen.GetNumberOrder(startProgram);
            _startProgram = startProgram;

            if (_startProgram == StartProgram.IsTester)
            {
                _typeWorkKeeper = ConnectorWorkType.Tester;
                ((TesterServer)ServerMaster.GetServers()[0]).TestingStartEvent += StrategyKeeper_TestingStartEvent;
                ((TesterServer)ServerMaster.GetServers()[0]).TestingFastEvent  += StrategyKeeper_TestingFastEvent;
                ((TesterServer)ServerMaster.GetServers()[0]).TestingEndEvent   += StrategyKeeper_TestingEndEvent;
            }

            if (_startProgram != StartProgram.IsTester)
            {
                ServerMaster.ActivateAutoConnection();
            }

            ServerMaster.LogMessageEvent += SendNewLogMessage;

            _tabBotTab = tabBotTab;

            if (_tabBotTab.Items != null)
            {
                _tabBotTab.Items.Clear();
            }
            _textBoxLimitPrice     = textBoxLimitPrice;
            _hostChart             = hostChart;
            _hostGlass             = hostGlass;
            _hostOpenDeals         = hostOpenDeals;
            _hostCloseDeals        = hostCloseDeals;
            _hostAllDeals          = hostAllDeals;
            _hostboxLog            = hostLogBot;
            _rectangleAroundChart  = rectangleAroundChart;
            _hostAlerts            = hostAlerts;
            _gridChartControlPanel = gridChartControlPanel;

            _tabBotNames = tabPanel;
            _tabBotNames.Items.Clear();

            _riskManager = new RiskManager.RiskManager("GlobalRiskManager", _startProgram);
            _riskManager.RiskManagerAlarmEvent += _riskManager_RiskManagerAlarmEvent;
            _riskManager.LogMessageEvent       += SendNewLogMessage;
            _globalController = new GlobalPosition(_hostAllDeals, _startProgram);
            _globalController.LogMessageEvent += SendNewLogMessage;

            _log = new Log("Prime", _startProgram);
            _log.StartPaint(hostLogPrime);
            _log.Listen(this);
            _hostLogPrime = hostLogPrime;

            SendNewLogMessage("Запуск OsTraderMaster. Включение программы.", LogMessageType.User);

            Load();
            _tabBotNames.SelectionChanged += _tabBotControl_SelectionChanged;
            ReloadRiskJournals();
            _globalController.StartPaint();
        }
Exemplo n.º 2
0
        public OsTraderMaster(StartProgram startProgram, WindowsFormsHost hostLogPrime)
        {
            NumberGen.GetNumberOrder(startProgram);
            _startProgram = startProgram;

            if (_startProgram == StartProgram.IsTester)
            {
                _typeWorkKeeper = ConnectorWorkType.Tester;
                ((TesterServer)ServerMaster.GetServers()[0]).TestingStartEvent += StrategyKeeper_TestingStartEvent;
                ((TesterServer)ServerMaster.GetServers()[0]).TestingFastEvent  += StrategyKeeper_TestingFastEvent;
                ((TesterServer)ServerMaster.GetServers()[0]).TestingEndEvent   += StrategyKeeper_TestingEndEvent;
            }

            if (_startProgram != StartProgram.IsTester)
            {
                ServerMaster.ActivateAutoConnection();
            }

            ServerMaster.LogMessageEvent += SendNewLogMessage;


            _riskManager = new RiskManager.RiskManager("GlobalRiskManager", _startProgram);
            _riskManager.RiskManagerAlarmEvent += _riskManager_RiskManagerAlarmEvent;
            _riskManager.LogMessageEvent       += SendNewLogMessage;
            _globalController = new GlobalPosition(_hostAllDeals, _startProgram);
            _globalController.LogMessageEvent += SendNewLogMessage;

            _log = new Log("Prime", _startProgram);
            _log.StartPaint(hostLogPrime);
            _log.Listen(this);
            _hostLogPrime = hostLogPrime;

            SendNewLogMessage(OsLocalization.Trader.Label1, LogMessageType.User);

            Load();
            _tabBotNames.SelectionChanged += _tabBotControl_SelectionChanged;
            ReloadRiskJournals();
            _globalController.StartPaint();

            Master = this;

            if (_startProgram == StartProgram.IsOsTrader && PrimeSettingsMaster.AutoStartApi)
            {
                ApiMaster = new AdminApiMaster(Master);
            }
        }