Пример #1
0
 public void Start(string title, ProgressStatus status)
 {
     this._lblTitle.Text = title;
     this._status = status;
     this._initialized = false;
     this._progressBar.Minimum = 0;
     this._progressBar.Value = 0;
     this._timer.Enabled = true;
 }
Пример #2
0
 /// <summary>
 /// 从文件导入日K线数据
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void BtnImpKLineClick(object sender, EventArgs e)
 {
     ProgressStatus status = new ProgressStatus();
     this._progressController.Start("从文件导入日K线", status);
     var tm = new MThreadManager<string>(THREAD_COUNT, typeof(ImpKJapaneseWorker), status);
     tm.SetContext("connection-string", this.txtDatabase.Text)
         .AddItem(Directory.GetFiles(this.txtKLineDir.Text))
         .Start();
 }
Пример #3
0
        void BtnFilterStockClick(object sender, EventArgs e)
        {
            Database db = new Database(this.txtDatabase.Text);
            db.Open();
            IList<Stock> stocks = Stock.FindAll(db);
            db.Close();

            string corssStar = "AM-Open-Close=0.006; AM-Min-Max=0.05; AM-Prev=0.015; AM-Matched-Days=0.03; RatioVolReduce=50; Min-Matched-Days=4; Starting-Point=99999; Regression=true";
            IList<StrategyConfig> confList = new List<StrategyConfig>();
            confList.Add(new StrategyConfig("MicroPriceTrendStrategy", corssStar));

            ProgressStatus status = new ProgressStatus();
            this._progressController.Start("执行策略选股...", status);
            var tm = new MThreadManager<Stock>(THREAD_COUNT, typeof(PickingStrategyWorker), status);
            tm.SetContext("connection-string", this.txtDatabase.Text)
                .SetContext("executors", confList)
                .AddItem(stocks)
                .Start();
        }
Пример #4
0
 private void OnTimer_UpdateProgressBar(object sender, EventArgs e)
 {
     if(!this._initialized){
         if(!(this._status.IsRunning || this._status.HasFinished)) return;
         this._progressBar.Maximum = _status.TotalNum;
         this._initialized = true;
     }
     this._progressBar.Value = _status.FinishedNum;
     if(_status.HasFinished){
         this._timer.Enabled = false;
         ProgressStatus status = this._status;
         this._status = null;
         this._lblRate.Text = "100%";
         this._lblInfo.Text = "总数:" + status.FinishedNum + ",剩余:0,用时:" + status.ElapsedSeconds.ToString("F1") + "秒";
     }else{
         this._lblRate.Text = _status.CurrentRate.ToString("F1") + "%";
         this._lblInfo.Text = "总数:" + _status.TotalNum
             + ",剩余:" + _status.RemainingNum + ",用时:"
             + _status.ElapsedSeconds.ToString("F1") + "秒";
     }
 }
Пример #5
0
        void BtnUpdateShareholdersNumClick(object sender, EventArgs e)
        {
            int startId = 1;
            int.TryParse(this.txtStartStockId.Text, out startId);

            Database db = new Database(this.txtDatabase.Text);
            db.Open();
            IList<Stock> stocks = Stock.FindAll(db);
            db.Close();
            while (startId > 1 && stocks.Count > 0 && stocks[0].StockId < startId){
                stocks.RemoveAt(0);
            }

            ProgressStatus status = new ProgressStatus();
            this._progressController.Start("抓取最新股东数", status);
            var tm = new MThreadManager<Stock>(THREAD_COUNT, typeof(ImpShareHoldersNumWorker), status);
            tm.SetContext("connection-string", this.txtDatabase.Text)
                .AddItem(stocks)
                .Start();
        }
Пример #6
0
        void BtnKTrendClick(object sender, EventArgs e)
        {
            Database db = new Database(this.txtDatabase.Text);
            db.Open();
            IList<Stock> stocks = Stock.RemoveBlackList(Stock.FindAll(db));
            db.Close();

            ProgressStatus status = new ProgressStatus();
            this._progressController.Start("计算K线趋势", status);
            var tm = new MThreadManager<Stock>(THREAD_COUNT, typeof(CalKTrendWorker), status);
            tm.SetContext("connection-string", this.txtDatabase.Text)
                .AddItem(stocks)
                .Start();
        }
Пример #7
0
        void BtnImpStockExtInfoClick(object sender, EventArgs e)
        {
            Database db = new Database(this.txtDatabase.Text);
            db.Open();
            IList<Stock> stocks = Stock.FindAll(db);
            db.Close();

            ProgressStatus status = new ProgressStatus();
            this._progressController.Start("抓取股票基础信息", status);
            var tm = new MThreadManager<Stock>(THREAD_COUNT, typeof(ImpStockBasInfoWorker), status);
            tm.SetContext("connection-string", this.txtDatabase.Text)
                .AddItem(stocks)
                .Start();
        }