Exemple #1
0
        private void MakeOrTestStrategies(bool makeNotTest)
        {
            if (workerQuote.IsBusy)
            {
                workerQuote.CancelAsync();
                return;
            }

            if (!File.Exists(tbFarmSetsPath.Text))
            {
                return;
            }

            var doc = new XmlDocument();

            using (var sr = new StreamReader(tbFarmSetsPath.Text, Encoding.UTF8))
                doc.Load(sr);
            if (doc.DocumentElement == null)
            {
                return;
            }

            if (string.IsNullOrEmpty(richTextBoxAccountIds.Text))
            {
                return;
            }
            var accIds = richTextBoxAccountIds.Text.ToIntArrayUniform();

            if (accIds.Length == 0)
            {
                return;
            }

            var quoteFolder = tbDestinationQuoteFolder.Text;

            if (string.IsNullOrEmpty(quoteFolder))
            {
                return;
            }
            if (!Directory.Exists(quoteFolder))
            {
                return;
            }

            var probWithdrawOnLossProfit = tbWdthProbOnLoss.Text.ToIntArrayUniform();
            var histMaker = new TradeHistoryMaker(tbSkipLossProb.Text.ToInt(), tbWithdrawProb.Text.ToInt(),
                                                  probWithdrawOnLossProfit[0], probWithdrawOnLossProfit[1],
                                                  !makeNotTest, tbStartTestDepo.Text.ToInt(),
                                                  dpModelStartegiesStart.Value, dpModelStrategiesEnd.Value);

            var histPtr = new HistoryMakerTaskParam
            {
                historyMaker = histMaker,
                portfolioDoc = doc
            };
            var task = new BackgroundWorkerTask(BackgroundWorkerTask.BackgroundWorkerTaskType.MakeTradeHistoryInDB,
                                                histPtr);

            workerQuote.RunWorkerAsync(task);
        }
Exemple #2
0
        private void MakeOrTestStrategies(bool makeNotTest)
        {
            if (workerQuote.IsBusy)
            {
                workerQuote.CancelAsync();
                return;
            }

            if (!File.Exists(tbFarmSetsPath.Text)) return;

            var doc = new XmlDocument();
            using (var sr = new StreamReader(tbFarmSetsPath.Text, Encoding.UTF8))
                doc.Load(sr);
            if (doc.DocumentElement == null)
                return;

            if (string.IsNullOrEmpty(richTextBoxAccountIds.Text)) return;
            var accIds = richTextBoxAccountIds.Text.ToIntArrayUniform();
            if (accIds.Length == 0) return;

            var quoteFolder = tbDestinationQuoteFolder.Text;
            if (string.IsNullOrEmpty(quoteFolder)) return;
            if (!Directory.Exists(quoteFolder)) return;

            var probWithdrawOnLossProfit = tbWdthProbOnLoss.Text.ToIntArrayUniform();
            var histMaker = new TradeHistoryMaker(tbSkipLossProb.Text.ToInt(), tbWithdrawProb.Text.ToInt(),
                probWithdrawOnLossProfit[0], probWithdrawOnLossProfit[1],
                !makeNotTest, tbStartTestDepo.Text.ToInt(),
                dpModelStartegiesStart.Value, dpModelStrategiesEnd.Value);

            var histPtr = new HistoryMakerTaskParam
            {
                historyMaker = histMaker,
                portfolioDoc = doc
            };
            var task = new BackgroundWorkerTask(BackgroundWorkerTask.BackgroundWorkerTaskType.MakeTradeHistoryInDB,
                    histPtr);
            workerQuote.RunWorkerAsync(task);
        }