예제 #1
0
        void OnTradeHistoryInfoCalculated(TradeHistoryIntensityInfo info)
        {
            StrategyDataForm form = new StrategyDataForm();

            form.Visual = info;
            form.Show();
        }
예제 #2
0
        private void biTickerIntensity_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            List <TickerDownloadDataInfo> selected = GetTickersForData();
            TradeHistoryIntensityInfo     info     = new TradeHistoryIntensityInfo();

            info.DownloadProgressChanged += OnTickerDownloadProgressChanged;
            Crypto.Core.Helpers.TickerDownloadData historyInfo = null;
            ProgressForm         = new DownloadProgressForm();
            ProgressForm.Cancel += (d, ee) => {
                DownloadCanceled = true;
            };

            Thread t = new Thread(() => {
                foreach (TickerDownloadDataInfo di in selected)
                {
                    Exchange ex = Exchange.Get(di.Exchange);
                    if (!ex.Connect())
                    {
                        continue;
                    }
                    TickerInputInfo ti = new TickerInputInfo()
                    {
                        Exchange = ex.Type, Ticker = ex.Ticker(di.BaseCurrency, di.MarketCurrency), StartDate = di.StartDate, EndDate = di.EndDate, KlineIntervalMin = di.KLineIntervalMin
                    };
                    ti.TickerName = ti.Ticker.Name;
                    historyInfo   = info.DownloadItem(ti, false);
                    info.Items.Add(historyInfo);
                    info.Result.Add(historyInfo);
                }
                BeginInvoke(new MethodInvoker(() => ProgressForm.Close()));
            });

            t.Start();
            ProgressForm.ShowDialog(this);
            if (DownloadCanceled)
            {
                XtraMessageBox.Show("Downloading Canceled.");
                return;
            }

            StrategyDataForm dataForm = new StrategyDataForm();

            dataForm.Visual = info;
            dataForm.Show();
        }
예제 #3
0
        private void barButtonItem5_ItemClick_1(object sender, ItemClickEventArgs e)
        {
            using (TickerDataDownloadForm dlg = new TickerDataDownloadForm()
            {
                Owner = this
            }) {
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                DownloadCanceled = false;
                TradeHistoryIntensityInfo info = new TradeHistoryIntensityInfo();
                info.DownloadProgressChanged += OnTickerDownloadProgressChanged;
                info.Exchange = Exchange.Get(dlg.TickerInfo.Exchange);
                Crypto.Core.Helpers.TickerDownloadData historyInfo = null;
                ProgressForm         = new DownloadProgressForm();
                ProgressForm.Cancel += (d, ee) => {
                    DownloadCanceled = true;
                };

                Thread t = new Thread(() => {
                    historyInfo = info.DownloadItem(dlg.TickerInfo.Ticker.BaseCurrency, dlg.TickerInfo.Ticker.MarketCurrency);
                    BeginInvoke(new MethodInvoker(() => ProgressForm.Close()));
                });
                t.Start();
                ProgressForm.ShowDialog(this);
                if (DownloadCanceled)
                {
                    XtraMessageBox.Show("Downloading Canceled.");
                    return;
                }
                if (historyInfo == null)
                {
                    XtraMessageBox.Show("Error downloading ticker trade history");
                    return;
                }
                info.Items.Add(historyInfo);
                info.Result.Add(historyInfo);

                StrategyDataForm dataForm = new StrategyDataForm();
                dataForm.Visual = info;
                dataForm.Show();
            }
        }