Exemplo 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;
            }
        }
Exemplo n.º 2
0
        private void uiDataFromDB_CheckedChanged(object sender, EventArgs e)
        {
            if (uiStrategy_radioButtonDataFromDB.Checked)
            {
                _data = null;
                uiStrategy_buttonXStart.Enabled = false;

                uiCalendar_buttonXSave.Enabled = false;
                uiStrategy_panelExBlackScholesPanel.Enabled = false;
                uiStrategy_checkBoxXReqTVCheck.Checked = false;
                uiStrategy_comboBoxExSymbol.Items.Clear();
                uiCalendar_comboBoxXSymbol.Items.Clear();

                var symbolList = DataManager.GetContracts();

                foreach (var item in symbolList)
                {
                    uiStrategy_comboBoxExSymbol.Items.Add(item.ContractName);
                    uiCalendar_comboBoxXSymbol.Items.Add(item.ContractName);
                }

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

                uiFilePathLabel.Visible = false;
                uiStrategy_buttonXFilePicker.Visible = false;
                uiStrategy_textBoxXFilepath.Visible = false;

                if (uiStrategy_comboBoxExSymbol.Items.Count > 0)
                {
                    uiStrategy_comboBoxExSymbol.SelectedIndex = 0;
                }
                uiCalendar_panelExSaving.Enabled = true;
            }
        }
Exemplo n.º 3
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);
            }
        }
Exemplo n.º 4
0
 public StepChange(StrategyParameters _parameters, List<StrategyAdditionalParameter> _additional, ref Data _data)
 {
     parameters = _parameters;
     additional = _additional;
     ticks = _data.Bars;
 }