private void SetMyView(BondClient bondClient)
        {
            var bondDateAndPrices = client.ComputeToBondLastDate(MapClientFixBondWithLibraryFixBond(BondCLient));
            var bondPrices        = bondDateAndPrices.Values.ToArray();
            var bondDates         = bondDateAndPrices.Keys.ToArray();



            Model = new PlotModel {
                Title = "Pricer"
            };

            Model.Title    = "Pricer";
            Model.Subtitle = "using OxyPlot ";

            var series1 = new LineSeries();

            series1.Title      = "Series 1";
            series1.MarkerType = MarkerType.Circle;

            for (int i = 0; i < bondDateAndPrices.Count; i++)
            {
                series1.Points.Add(new DataPoint(DateTimeAxis.ToDouble(bondDates[i]), bondPrices[i]));
            }


            Model.Axes.Add(new DateTimeAxis {
                Position = AxisPosition.Bottom, StringFormat = "dd/MM/yyyy"
            });
            Model.Series.Add(series1);
        }
Esempio n. 2
0
        public ActionResult Index(BondClient bondClient)
        {
            var bondPrices = GetBondPrices(bondClient);

            var couponsCouru = GetCouponsCouru(bondClient);

            SetViewBagForShow(bondPrices, couponsCouru);

            return(View(bondClient));
        }
        private BondClient GetDefaultBond()
        {
            BondClient bond = new BondClient();

            bond.Maturity    = 2;
            bond.Periodicity = 6;
            bond.IssueDate   = DateTime.Parse("01/01/1993");
            bond.Rate        = 0.05;
            bond.Nominal     = 100;
            return(bond);
        }
        //private List<double> GetBondPrices(BondClient bond)
        //{
        //    var libraryBond = MapClientFixBondWithLibraryFixBond(bond);

        //    var dates = GetPricingDates(libraryBond);
        //    List<double> prices = new List<double>();
        //    double bondPrice;
        //    int i = 0;

        //    foreach (var item in dates)
        //    {
        //        bondPrice = client.Compute(libraryBond, item);
        //        prices.Add(bondPrice);
        //        i++;
        //        if (i==30)
        //        {

        //        }

        //    }

        //    return prices;
        //}
        private BondWcf MapClientFixBondWithLibraryFixBond(BondClient clientBond)
        {
            // A revoir !!!
            var bond = new BondWcf();

            bond.Maturity    = clientBond.Maturity;
            bond.Periodicity = clientBond.Periodicity;
            bond.IssueDate   = clientBond.IssueDate;
            bond.Rate        = clientBond.Rate;
            bond.Nominal     = clientBond.Nominal;

            return(bond);
        }
Esempio n. 5
0
        private List <double> GetCouponsCouru(BondClient bond)
        {
            var libraryBond = MapClientFixBondWithLibraryFixBond(bond);

            var           dates        = GetPricingDates(libraryBond);
            List <double> couponsCouru = new List <double>();

            foreach (var item in dates)
            {
                couponsCouru.Add(libraryBond.GetCouponCouru(item));
            }

            return(couponsCouru);
        }
Esempio n. 6
0
        private List <double> GetBondPrices(BondClient bond)
        {
            var libraryBond = MapClientFixBondWithLibraryFixBond(bond);

            var           dates  = GetPricingDates(libraryBond);
            List <double> prices = new List <double>();
            double        bondPrice;


            foreach (var item in dates)
            {
                bondPrice = pricer.Compute(libraryBond, item);
                prices.Add(bondPrice);
            }

            return(prices);
        }