Ejemplo n.º 1
0
        private void GetYTM_Click(object sender, EventArgs e)
        {
            int    years = (int)Years.Value;
            double coupon = (double)Coupon.Value, face = (double)Face.Value, price = (double)Price.Value;
            double rate = Calculators.CalcYield(coupon, years, face, price);

            YTM.Value = (decimal)rate;
            if (autoClipboard.Checked)
            {
                Clipboard.SetText(rate.ToString("f7"));
            }
        }
Ejemplo n.º 2
0
        private void GetPrice_Click(object sender, EventArgs e)
        {
            int    years = (int)Years.Value;
            double coupon = (double)Coupon.Value, face = (double)Face.Value, rate = (double)YTM.Value;
            double price = Calculators.CalcPrice(coupon, years, face, rate);

            Price.Value = (decimal)price;
            if (autoClipboard.Checked)
            {
                Clipboard.SetText(price.ToString("f7"));
            }
        }