Exemple #1
0
        static void Main(string[] args)
        {
            var date = new Date(Weekday.Fri, Month.Jul, 1990);
            try
            {
                var myOption = new VanillaOption();
                Console.WriteLine(myOption.Npv());
            }
            catch (NotImplementedException ex)
            {
                Console.WriteLine("Some {0}", ex.Message.ToString());
            }

            Console.ReadLine();
        }
Exemple #2
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);
            }
        }