Esempio n. 1
0
        private void GetTicksFromDb(string symbol)
        {
            var tickList = DataManager.GetContractData(symbol);
            if (tickList.Count > 0)
            {
                _data = new Data(tickList, Data.DataFileType.TickFromDb);

                _data.CreateData();

                //________//
                uiStrategy_dateTimeAdvOISStart.MaxDate = uiStrategy_dateTimeAdvOOOSStart.MaxDate = _data[_data.Count - 1].Time;
                uiStrategy_dateTimeAdvOISStart.MinDate = uiStrategy_dateTimeAdvOOOSStart.MinDate = _data[0].Time;

                uiStrategy_dateTimeAdvOISEnd.MaxDate = uiStrategy_dateTimeAdvOOOSEnd.MaxDate = _data[_data.Count - 1].Time;
                uiStrategy_dateTimeAdvOISEnd.MinDate = uiStrategy_dateTimeAdvOOOSEnd.MinDate = _data[0].Time;

                uiStrategy_dateTimeAdvOISStart.Value = _data[0].Time;
                uiStrategy_dateTimeAdvOISEnd.Value = uiStrategy_dateTimeAdvOOOSStart.Value = uiStrategy_dateTimeAdvOOOSEnd.Value = _data[_data.Count - 1].Time;

                uiStrategy_panelExOptions.Enabled = true;
                uiOptimizationInSample.Enabled = true;
                uiStrategy_panelExOptimizationOutOfSample.Enabled = true;
                uiStrategy_buttonXStop.Enabled = false;
            }
        }
Esempio n. 2
0
        private void uiFilePicker_Click(object sender, EventArgs e)
        {
            uiBlackSDivYield.Enabled = true;
            uiBlackSInterestRate.Enabled = true;
            uiBlackSPriceStrike.Enabled = true;
            uiBlackSVolality.Enabled = true;
            uiBlackSUnderlyingPrice.Enabled = true;

            try
            {
                if (uiStrategy_radioButtonDataFromFile.Checked)
                {

                    var fileDialog = new OpenFileDialog
                    {
                        Multiselect = true,
                        InitialDirectory = Directory.GetCurrentDirectory(),
                        Filter = @"TXT (*.txt)|*.txt",
                        FilterIndex = 2,
                        RestoreDirectory = true
                    };

                    if (fileDialog.ShowDialog() == DialogResult.OK)
                    {
                        _filepath = fileDialog.FileName;
                        _data = new Data(_filepath, Data.DataFileType.TextFromTs);
                        _data.CreateData();
                    }
                    else
                        _filepath = string.Empty;
                }
                //progressBarX1.Visible = true;
                //timer1.Enabled = true;
                //timer1.Start();
                if (_filepath == string.Empty)
                    return;

                Report(string.Format("{0} bars have been loaded from file .", _data.Count),
                       InformerMessageType.Success);

                uiStrategy_textBoxXFilepath.Text = _filepath;

                uiStrategy_dateTimeAdvOISStart.MaxDate = uiStrategy_dateTimeAdvOOOSStart.MaxDate = _data[_data.Count - 1].Time;
                uiStrategy_dateTimeAdvOISStart.MinDate = uiStrategy_dateTimeAdvOOOSStart.MinDate = _data[0].Time;

                uiStrategy_dateTimeAdvOISEnd.MaxDate = uiStrategy_dateTimeAdvOOOSEnd.MaxDate = _data[_data.Count - 1].Time;
                uiStrategy_dateTimeAdvOISEnd.MinDate = uiStrategy_dateTimeAdvOOOSEnd.MinDate = _data[0].Time;

                uiStrategy_dateTimeAdvOISStart.Value = _data[0].Time;
                uiStrategy_dateTimeAdvOISEnd.Value = uiStrategy_dateTimeAdvOOOSStart.Value = uiStrategy_dateTimeAdvOOOSEnd.Value = _data[_data.Count - 1].Time;

                uiStrategy_panelExOptions.Enabled = true;
                uiOptimizationInSample.Enabled = true;
                uiStrategy_panelExOptimizationOutOfSample.Enabled = true;

                uiStrategy_buttonXStop.Enabled = false;

                uiStrategy_panelExBlackScholes.Enabled = true;

                uiStrategy_comboBoxExDataSet.Items.Clear();
                var tempDataset = new TemporaryDatasets();

                _dataSets = DataManager.GetDatasets();

                uiStrategy_dataGridViewNoOptomizationParameters.DataSource = tempDataset.AliDataSet151519;
                uiStrategy_dataGridViewOptomizationParameters.DataSource = tempDataset.OptimParams;
                uiStrategy_comboBoxExDataSet.Items.Add("Default DataSet for file");
                uiStrategy_comboBoxExDataSet.SelectedIndex = uiStrategy_comboBoxExDataSet.Items.Count - 1;

                foreach (DataSetModel dataSet in _dataSets)
                {
                    uiStrategy_comboBoxExDataSet.Items.Add(dataSet.DataSetName);
                }
            }
            catch (Exception)
            {
                Report("Error when reading the file! Please, open another file.", InformerMessageType.Error);
            }
        }