Ejemplo n.º 1
0
        private void btnPrice_Click(object sender, EventArgs e)
        {
            try
            {
                var date = new Date(Weekday.Fri, (Month)cboMonth.SelectedItem, (int)cboMonth.SelectedItem);

                var fxOption = new VanillaOption((Exercise)cboExerciseType.SelectedItem, double.Parse(tbStrike.Text),
                                                 double.Parse(tbSpot.Text), double.Parse(tbCrossRfR.Text), double.Parse(tbBRfR.Text),
                                                 double.Parse(tbTtM.Text), double.Parse(tbVolatility.Text), date, (OptionPricing.ValuationMethod)cboValuationMethod.SelectedItem, (OptionPricing.Type)cboType.SelectedItem);

                tboPrice.Text = fxOption.Npv().ToString();
                tbDelta.Text  = fxOption.Delta().ToString();
                tbGamma.Text  = fxOption.Gamma().ToString();
                tbTheta.Text  = fxOption.Theta().ToString();
                tbVega.Text   = fxOption.Vega().ToString();
            }
            catch (NotImplementedException ex)
            {
                MessageBox.Show("{0}", ex.Message);
            }
        }