private void buttonCalibrate_Click(object sender, EventArgs e) { CalibrationForm cf = new CalibrationForm(ss); DialogResult r = cf.ShowDialog(); if (r == DialogResult.OK) /** Calibration successful */ { if(cf.generatedSpot!=null) curveViewer.AddCurve(new CurveViewer.Curve(cf.generatedSpot, Color.Red)); ss = cf.ss; foreach (DataGridViewRow dgvr in dataGridViewFutures.Rows) { DataGridViewCellCollection cells = dgvr.Cells; double mat = (double)cells[0].Value; cells[1].Value = PriceFuture(mat); } foreach (DataGridViewRow dgvr in dataGridViewOption.Rows) { DataGridViewCellCollection cells = dgvr.Cells; Option newOpt = new Option() { Value = (double)cells[0].Value, StrikePrice = (double)cells[1].Value, DaysTilExpiry = (int)cells[2].Value, Type = (string)cells[3].Value, }; cells[4].Value = PriceOption(newOpt); } } }
private void buttonCalibrate_Click(object sender, EventArgs e) { CalibrationForm cf = new CalibrationForm(ss); DialogResult r = cf.ShowDialog(); if (r == DialogResult.OK) /** Calibration successful */ { if (cf.generatedSpot != null) { curveViewer.AddCurve(new CurveViewer.Curve(cf.generatedSpot, Color.Red)); } ss = cf.ss; foreach (DataGridViewRow dgvr in dataGridViewFutures.Rows) { DataGridViewCellCollection cells = dgvr.Cells; double mat = (double)cells[0].Value; cells[1].Value = PriceFuture(mat); } foreach (DataGridViewRow dgvr in dataGridViewOption.Rows) { DataGridViewCellCollection cells = dgvr.Cells; Option newOpt = new Option() { Value = (double)cells[0].Value, StrikePrice = (double)cells[1].Value, DaysTilExpiry = (int)cells[2].Value, Type = (string)cells[3].Value, }; cells[4].Value = PriceOption(newOpt); } } }