Пример #1
0
        public Main()
        {
            _settingsManager = Factories.CreateSettingsManager();
            _logger          = LoggerFactory.Create(_settingsManager.LogFilePath);

            this._timeManager = ServiceFactory.CreateTimeManager(_settingsManager.GetSettingValue(AppSettingsKey.Begin),
                                                                 _settingsManager.GetSettingValue(AppSettingsKey.End));

            InitializeComponent();

            CheckBasicSettings();
            InitBasicUI();
            if (!_basicSettingOK)
            {
                OnEditConfig(null, null);
                return;
            }

            InitOrderMaker();

            if (!HasTradeSettings)
            {
                this.tpStrategy.Controls.Add(UIHelpers.CreateLabel("您還沒有設定策略. 請先設定策略才可同步下單.", Color.Red, DockStyle.Fill), 0, 0);
            }
            else
            {
                this.tpStrategy.Controls.Add(UIHelpers.CreateLabel("策略設定", Color.Black, DockStyle.Fill), 0, 0);
            }

            InitStrategyUI();
        }
Пример #2
0
        public Main()
        {
            _settingsManager = Factories.CreateSettingsManager();
            this.seconds     = _settingsManager.GetSettingValue(AppSettingsKey.Seconds).ToInt();


            this._timeManager = Factories.CreateTimeManager(_settingsManager.GetSettingValue(AppSettingsKey.Open),
                                                            _settingsManager.GetSettingValue(AppSettingsKey.Close));

            _logger = LoggerFactory.Create(_settingsManager.LogFilePath);


            string siteUrl       = _settingsManager.GetSettingValue(AppSettingsKey.SiteUrl);
            string adminUser     = _settingsManager.GetSettingValue(AppSettingsKey.Admin);
            string adminPassword = _settingsManager.GetSettingValue(AppSettingsKey.AdminPassword);
            string dbKey         = _settingsManager.GetSettingValue(AppSettingsKey.DBKey);

            this._apiService = ServiceFactory.CreateApiService(siteUrl, adminUser, adminPassword, dbKey);

            string hubUrl   = _settingsManager.GetSettingValue(AppSettingsKey.HubUrl);
            string quoteKey = _settingsManager.GetSettingValue(AppSettingsKey.QuoteKey);

            _hubManager = Factories.CreateHubManager(hubUrl, quoteKey);


            // init source
            string provider = _settingsManager.GetSettingValue(AppSettingsKey.Provider);
            string sid      = _settingsManager.GetSettingValue(AppSettingsKey.SID);
            string password = _settingsManager.GetSettingValue(AppSettingsKey.Password);

            this._source = SourceFactory.Create(provider, sid, password);
            this._source.ExceptionOccured  += Source_ExceptionOccured;
            this._source.ActionExecuted    += Source_ActionExecuted;
            this._source.NotifyStockTick   += Source_NotifyStockTick;
            this._source.NotifyFuturesTick += Source_NotifyFuturesTick;

            Thread.Sleep(1500);


            InitializeComponent();
        }
Пример #3
0
        public API_TestForm()
        {
            _settingsManager = Factories.CreateSettingsManager();
            _logger          = LoggerFactory.Create(_settingsManager.LogFilePath);


            string name = _settingsManager.GetSettingValue(AppSettingsKey.OrderMaker);
            string ip   = _settingsManager.GetSettingValue(AppSettingsKey.OrderMakerIP);
            string sid  = _settingsManager.GetSettingValue(AppSettingsKey.SID);
            string pw   = CryptoGraphy.DecryptCipherTextToPlainText(_settingsManager.GetSettingValue(AppSettingsKey.Password));

            _orderMaker                 = ProviderFactory.Create(name, ip, sid, pw);
            _orderMaker.Ready          += this.OnOrderMakerReady;
            _orderMaker.ActionExecuted += this.OnActionExcuted;
            if (_orderMaker.Name == ProviderName.HUA_NAN)
            {
                _orderMaker.AccountPositionUpdated += OrderMaker_AccountPositionUpdated;
            }

            InitializeComponent();
        }