SlideShare a Scribd company logo
1 of 30
Download to read offline
Venture Lab Finance Course
Project 1: Bond Portfolio Management
Team: AlphaBeta

Comments : Please see first 10 pages for results (little text, mostly column
numbersand figures for easy reading)


Steps 1 and 2 (Max Points: 9)

   Dirty Prices
The dirty prices, obtained by adding the accrued interest to the bond prices, are as follows :
Out[455]//TableForm=
             102.404
             100.261
             104.303
             101.521
             106.163
             101.775
             108.158
             100.647
             109.182
                                                                                                                   (1)
             103.665
             111.315
             100.109
             112.088
             106.649
             114.377
             102.787
             116.103
             105.61


   System of Equations for Zero - coupon prices in Step 2
The zero - coupon bond portfolio are created as in Example 4.3 (page 77) in the text, except that the discrete compound-
ing formula is replaced with continuous compounding formula.
             portfolioPrice     couponsB couponsA askPriceOriginalA askPriceOriginalB;
             portfolioFaceValue      couponsB couponsA  1 FaceValue;                                               (2)
             Exp SpotRate t t portfolioFaceValue portfolioFaceValue
2   VentureFinanceProject1.nb




Solve this system of equations for each time, keeping in mind that it starts from a non-zreto value (as done in code
below).

The results are (in percentages) :
        0.956849
        0.495406
        0.544766
        0.577495
        0.556351
        0.521734
        0.41242
        0.561462
        0.922664

The code below shows the steps used in the calculations :

        zeroCoupon   couponsB couponsA askPriceOriginalA askPriceOriginalB;
        portfolioFaceValue    couponsB couponsA 1 100;
        spotRates Flatten Table Solve s      2   ii 1 tillFirst Log     portfolioFaceValue                      ii     zeroCoupon
        spotRates tillFirst .01 0.5 couponsA couponsB    1 ,spotRates    Flatten;



Step 3 (Max: 9 Points)

    Bond Price Formula
The bond price is given by
                            N
            Fe    r tN tN         Ck e   r t k t k.
                                                                                                                     (3)
                            k 1

The Mathematica code for the above is below :

        priceOfBondContinuous FV_,couponRate_,n_,m_:2 : Module coupon ,
        coupon couponRate FV m;
        FV discountRate n Total Table coupon discountRate ii , ii,1 m,n,1 m


Also, the form of the spot rate and the corresponding discount rate is below :

        spotRate t_ : a0 a1 t a2 t^2 a3 t^3 a4 t^4;
        discountRate t_ : Exp spotRate t t ;


    Objective Function
The objective function to be minimized is the sum of squares of the 18 terms:
             9
                   ModelBondTypeAk             AskPriceBondTypeAk ^ 2
            k 1                                                                                                      (4)
                  ModelBondTypeBk           AskPriceBondTypeBk ^ 2
VentureFinanceProject1.nb    3




The only subtlety is that the start time is not zero. This is taken into account. The Mathematica code implementing this
is below :

       tillFirst numberofDaysBeforeNextCoupon 365;
       modelA priceOfBondContinuous 100,couponsA     100, tillFirst     2   &   Range 1 ,9,1 ;
       modelB priceOfBondContinuous 100,couponsB     100, tillFirst     2   &   Range 1 ,9 ,1
       sol NMinimize    modelA askPriceA ^2 modelB askPriceB ^2  Total,a0 0.0 , a0,a1,a2,a3,a4


   Results for ais
The results for the ai ’s are
              0.0134751
               0.0259828
              0.0167159                                                                                                        (5)
               0.00412212
              0.00035758

The minimum value for the cost function is found to be

              0.629816                                                                                                         (6)



Step 4 (Max: 9 Points)

   Plot Fitted Term Structure


            0.012


            0.010


            0.008

Out[440]=
            0.006


            0.004


            0.002


            0.000
                    0           2             4              6             8

The curve in red is the result computed using the polynomial fit, and the green one is using the zero - coupon calcula-
tion noted above.


   Advant ages/Disadvant ages
            The spot rate is highly sensitive in fluctuations at any measurement, something which is inevitable in real life.
            The polynomial approach is more robust against such fluctuations, as it incorporates all the measurements in
            arriving at the final estimate of an instantaneous spot rate.
            The quality of the polynomial fit depends on the number of data points. That is, if the degree in t is chosen to
            be too large, the problem of overfitting results.
4    VentureFinanceProject1.nb




            The choice of least-squares is widely used, due to it nice analytical properties (e.g., one can differentiate the
            cost function). However, in many cases, a better choice is one tht minimizes the L-1 norm (see vast literature
            on compressive sensing).
            A better model would be to use a stochastic model (in place of the polynomial model) for the spot rate and fit
            that to the data.



Step 5: Cash Matching (Max. Points: 9)

    Formulation of Part A (3 Points)
First, form the bond matrix, i.e., the payments from the bonds of the various durations and coupon rates. Note it is
clipped due to matrix size.
Out[453]//MatrixForm=
                 102.313 100.438 2.1875   0.875  1.9375 0.6875    2.125   0.375   2                         0.9375   2.125
                    0       0    102.188 100.875 1.9375 0.6875    2.125   0.375   2                         0.9375   2.125
                    0       0       0       0    101.938 100.688 2.125    0.375   2                         0.9375   2.125
                    0       0       0       0       0       0    102.125 100.375 2                          0.9375   2.125
                    0       0       0       0       0       0       0       0    102                        100.938 2.125
                                                                                                                       (7)
                    0       0       0       0       0       0       0       0     0                            0    102.125
                    0       0       0       0       0       0       0       0     0                            0
                    0       0       0       0       0       0       0       0     0                            0
                    0       0       0       0       0       0       0       0     0                            0

Form the vector of the bond matrix times the amounts minus the liabilities, which is the excess periodic cash flows:

                bondMatrix vars liabilities;                                                                              (8)

Now the excess periodic cash flows are fed back (at zero interest) to purchase the bonds. Thus, he equation to solve is
in Mathematica code as follows:
    In[456]:=   bM bondMatrix.vars liabilities;
                simpleMatching   bM 1     0,
                   bM 1     bM 2     0,
                   bM 1     bM 2     bM 3    0,
                   bM 1     bM 2     bM 3    bM 4     0,
                   bM 1     bM 2     bM 3    bM 4     bM 5     0,
                   bM 1     bM 2     bM 3    bM 4     bM 5    bM 6    0,
                                                                                                                          (9)
                   bM 1     bM 2     bM 3    bM 4     bM 5    bM 6    bM                     7       0,
                   bM 1     bM 2     bM 3    bM 4     bM 5    bM 6    bM                     7       bM 8       0,
                   bM 1     bM 2     bM 3
                     bM 4      bM 5    bM 6    bM 7     bM 8     bM 9    0                    ;
                solutionSimpleMatching NMinimize vars.askPrice,
                   Flatten simpleMatching, Thread vars 0    , vars
                Chop bondMatrix.vars liabilities . solutionSimpleMatching                        2

Observe that :
            The cost function is the vector dot product of vars (the bond amounts) and the bond price computed in Step 1
            (reflecting accrued interest rate).
            The excesses from the previous step are fed back next time period, as evident from the first nince inequality
            structures;
            The excesses all must exceed 0;
VentureFinanceProject1.nb   5




           The quantities all exceed zero (no short-selling).


   Solution of Part A (1 Point)
The solution obtained from the above is :
Out[475]//TableForm=
              0.
              74.933
              0.
              25.2608
              0.
              375.482
              0.
              48.0633
              0.
                                                                                                                       (10)
              778.244
              0.
              105.54
              485.803
              0.
              55.5195
              0.
              146.699
              0.

The cost is found to be

              222 207.29                                                                                               (11)


   Formulation of Part B (3 Points)
The formulation is similar except that there is discounting.

        discounts       Exp   spotRatesAnalytical 0.5

The optimization problem is similar in structure, but note the discounting of the surplus at each time step.

  In[476]:=   bM bondMatrix.vars liabilities;
              simpleMatching    discounts 1 bM 1         0,
                 discounts 2 bM 1         bM 2      0,
                 discounts 3      discounts 2 bM 1        bM 2     bM 3     0,
                 discounts 4
                      discounts 3     discounts 2 bM 1        bM 2      bM 3     bM 4     0,
                 discounts 5      discounts 4     discounts 3
                             discounts 2 bM 1         bM 2     bM 3      bM 4     bM 5     0,
                 discounts 6      discounts 5     discounts 4
                             discounts 3     discounts 2 bM 1       bM 2      bM 3
                          bM 4       bM 5      bM 6      0,
                 discounts 7      discounts 6     discounts 5
                             discounts 4     discounts 3    discounts 2 bM 1        bM 2                               (12)
                                 bM 3       bM 4       bM 5     bM 6      bM 7     0,
                 discounts 8      discounts 7     discounts 6    discounts 5    discounts 4
6   VentureFinanceProject1.nb




                                  discounts 3     discounts 2 bM 1       bM 2      bM 3
                                bM 4      bM 5      bM 6       bM 7     bM 8     0,
                discounts 9     discounts 8     discounts 7
                           discounts 6     discounts 5      discounts 4   discounts 3
                                         discounts 2 bM 1         bM 2    bM 3      bM 4
                                bM 5      bM 6      bM 7       bM 8     bM 9     0 ;
             solutionSimpleMatching NMinimize vars.askPrice, Flatten
                  simpleMatching, Thread vars 0      , vars
             Chop bondMatrix.vars liabilities . solutionSimpleMatching 2
              vars . solutionSimpleMatching 2         Total


    Solution of Part B (1 Point)
The solution obtained from the above is :
Out[488]//TableForm=
             0.
             74.933
             0.
             25.2608
             0.
             375.482
             0.
             48.0633
             0.
                                                                                                                                   (13)
             778.244
             0.
             105.54
             485.803
             0.
             55.5195
             0.
             146.699
             0.

The cost is found to be

        222 207.29

In this case, the numbers turn out to be the same. This is not going to be the case in general.



Step 6: Immunization (Maximum Points : 9)

    Derivatives (3 points)
Firs, note the simple structure of the derivatives :
                                                                          n
                    PV tN       tN F   tN   a0 a1 t N a2 t2 a3 t3 a4 t4
                                                          N     N     N         tk Ck   tk   a0 a1 t k a2 t2 a3 t3 a4 t4
                                                                                                           k     k     k   ,       (12)
               a0                                                         k 1


                                                                                                                               ,



                                                                                                                                   (14)
VentureFinanceProject1.nb   7




                                                                             n
                   PV tN       tN 2 F   tN   a0 a1 t N a2 t2 a3 t3 a4 t4
                                                           N     N     N         tk 2 Ck   tk   a0 a1 t k a2 t2 a3 t3 a4 t4
                                                                                                              k     k     k   ,
              a1                                                           k 1
                                                                             n
                   PV tN       tN 3 F   tN   a0 a1 t N a2 t2 a3 t3 a4 t4
                                                           N     N     N         tk 3 Ck   tk   a0 a1 t k a2 t2 a3 t3 a4 t4
                                                                                                              k     k     k   ,
              a2                                                           k 1
                                                                             n
                   PV tN       tN 4 F   tN   a0 a1 t N a2 t2 a3 t3 a4 t4
                                                           N     N     N         tk 4 Ck   tk   a0 a1 t k a2 t2 a3 t3 a4 t4
                                                                                                              k     k     k   ,
              a3                                                           k 1
                                                                             n
                   PV tN       tN 5 F   tN   a0 a1 t N a2 t2 a3 t3 a4 t4
                                                           N     N     N         tk 5 Ck   tk   a0 a1 t k a2 t2 a3 t3 a4 t4
                                                                                                              k     k     k   .
              a4                                                           k 1



It is straightforward to write the same for a portfolio.


   Const raint s
The structure of the derivatives is rather simple. It is as if appropriate powers of t are applied to the coupon and face
value. In Mathematica code, all the terms a0-a4 case is implemented as
           factor          ConstantArray 1, 18             tis     tis ^ 2       tis ^ 3 tis ^ 4 ;                                         (15)

Here, tis are the different times at which the payments are made. This factor multiplies the liabilities and the coupons.

           vars Array a, 18 ;      Variables
           tis Riffle Range 0, 8, 1      2., Range 0, 8, 1     2. ;
           modFV factor 100;
                                                                                                                                           (16)
           modcoupons factor semiAnnualcoupons;
           modliabilities factor 1 ;; 18 ;; 2
               10 000, 5000, 40 000, 7000, 80 000, 12 000, 50 000, 6000, 15 000 ;

The bond matrix is then also suitably modified:

           bondMatrix
              modcoupons       modFV 1 , modFV 2 , ConstantArray 0, 16           Flatten ,
              Flatten 0, 0, Drop modcoupons, 2
               Flatten 0, 0, modFV 3 , modFV 4 , ConstantArray 0, 14 ,
              Flatten 0, 0, 0, 0, Drop modcoupons, 4
               Flatten 0, 0, 0, 0, modFV 5 , modFV 6 , ConstantArray 0, 12 ,
              Flatten 0, 0, 0, 0, 0, 0, Drop modcoupons, 6
               Flatten 0, 0, 0, 0, 0, 0, modFV 7 , modFV 8 , ConstantArray 0, 10 ,
              Flatten 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 8       Flatten
                 0, 0, 0, 0, 0, 0, 0, 0, modFV 9 , modFV 10 , ConstantArray 0, 8 ,
              Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 10      Flatten                                                       (17)
                 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 11 , modFV 12 , ConstantArray 0, 6 ,
              Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 12      Flatten 0, 0,
                  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 13 , modFV 14 , ConstantArray 0, 4 ,
              Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 14
               Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                  modFV 15 , modFV 16 , ConstantArray 0, 2 ,
              Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 16
               Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                  0, 0, 0, 0, 0,              ,

                                                                                                                                           (14)
8   VentureFinanceProject1.nb




                       0, 0, 0, 0, 0, modFV   17   , modFV   18
                  ;

         The optimization problem that is solved is then simply that the
          sum of the number of bonds is minimum not the cost as in previous case .
              solDeriv Minimize Total vars,
                 Thread bondMatrix.vars   modliabilities , Thread vars      0   , vars   (18)
               vars . solDeriv 2       Total


    Answers (2 Points)

    a0

The objective value is 2026.87.
Out[515]//TableForm=
         58.8723
         0.
         10.2338
         0.
         360.458
         0.
         37.4415
         0.
         768.237
         0.
         103.602
         0.
         485.803
         0.
         55.5195
         0.
         146.699
         0.

    a0 - a1

The objective value is 1909.30
Out[539]//TableForm=
              0.
              0.
              0.
              0.
              335.968                                                                    (17)
              0.
              23.9821
              0.
              762.076
                                                                                         (19)
              0.
              100.558
              0.
              484.858
              0.
VentureFinanceProject1.nb   9




             55.1604
             0.
             146.699
             0.

   a0 - a2

The objective value is 1813.70
Out[548]//TableForm=
        0.
        0.
        0.
        0.
        281.354
        0.
        0.
        0.
        751.488
        0.
        95.9613
        0.
        483.5
        0.
        54.6994
        0.
        146.699
        0.

   a0 - a3

The objective value is 1651.34.
Out[557]//TableForm=
        0.
        0.
        0.
        0.
        146.535
        0.
        0.
        0.
        733.167
        0.
        89.1605
        0.
        481.638
        0.
        54.144
        0.
        146.699                                           (19)
        0.
10    VentureFinanceProject1.nb




     a0 - a4

The objective value is 1459.58.
Out[566]//TableForm=
         0.
         0.
         0.
         0.
         0.
         0.
         0.
         0.
         701.08
         0.
         79.1567
         0.
         479.145
         0.
         53.4955
         0.
         146.699
         0.



Step 7 and 8 : Comparison of 5A, 5B and 6 and Write-
Up(Maximum Points : 9)

     Risk (2 Points)
           Simple Cash Matching: An advantage is that it is simple. However, it is not robust against changes of interst
           rates.
           Complex Cash Matching: This is certainly more robust against changes in interest rates, comapred to simple
           cash matching as it incorporates expected interest rates.
           Immunization Portfolio: This is much more robust as it incorporates the changes in the parameters in the spot
           rate model. However, it is more complicated to implement (but much more so).
In terms of risk, the immunization portfolio is definitely the best option.


     Cost (2 Points)
           In the example, the simple cash matching and complex cash matching yielded the same result. In general, the
           complex cash matching is preferred.
           The immunization portfolio was devised such that the total number of shares were the smallest. IN fact, it
           turned out the cost was also the smallest.
In terms of cost, use immunization portfolio.


     Implementation in Practice (2 Points)
           The simple cash matching should definitely not be implemented in practise, as heavy losses are possible in
           uncerain times.
VentureFinanceProject1.nb   11




            Complex cash matching is more robust, but still not sufficiently robust.
            Immunization portfolios strongly preferred.


   Overall Report Style : Concise Explanations, Lack of Logic Mistakes or
   Numerical Inconsistencies (3 Points)


Appendix: Mathematica Code

   Part 1

   Step 1

In[587]:=   ClearAll "` " ;
            dateMonth0 10;
            dateDay0 11;
            dateYear0 2012;
            dateMonthAfter 2;
            dateDayAfter 15;
            dateYearAfter 2013;
            dateMonthBefore 8;
            dateDayBefore 15;
            dateYearBefore 2012;
            numberOfDaysSinceLastCoupon DateDifference 2012, 8, 15 , 2012, 10, 11 ;
            numberofDaysBeforeNextCoupon DateDifference 2012, 10, 11 , 2013, 2, 15 ;
            numberOfDaysInCurrentCouponPeriod DateDifference 2012, 8, 15 , 2013, 2, 15 ;
            fraction   numberOfDaysSinceLastCoupon numberOfDaysInCurrentCouponPeriod ;
            FV 100;
            coupons   4.625, 0.875, 4.375, 1.75, 3.875, 1.375,
               4.25, 0.75, 4, 1.875, 4.25, 0.5, 4, 2.375, 4.25, 1.25, 4.5, 2.125 ;
            couponsA coupons 1 ;; Length coupons ;; 2 ;
            couponsB coupons 2 ;; Length coupons ;; 2 ;
            semiAnnualcoupons coupons 2;
            askPrice0   101, 100, 103, 101, 105, 101 ,
               107, 100, 108, 103, 110, 100, 111, 106, 113, 102, 115, 105 ;
            askPrice1 N 22, 4, 20, 8, 18, 18, 16, 17, 18, 12, 21, 1, 15, 9, 23, 19, 13, 9
                32 ;
            askPrice01 N askPrice0 askPrice1 ;
            askPriceOriginal askPrice01;
            askPriceOriginalA askPriceOriginal 1 ;; Length coupons ;; 2 ;
            askPriceOriginalB askPriceOriginal 2 ;; Length coupons ;; 2 ;
            deltaAsk fraction coupons 2;
            askPrice askPrice01 deltaAsk;
            askPriceA askPrice 1 ;; Length coupons ;; 2 ;
            askPriceB askPrice 2 ;; Length coupons ;; 2 ;
            spotRate t_ : a0 a1 t a2 t ^ 2 a3 t ^ 3 a4 t ^ 4;
            discountRate t_ : Exp spotRate t t ;
12   VentureFinanceProject1.nb




            priceOfBondContinuous FV_, couponRate_, n_, m_: 2 : Module coupon ,
              coupon couponRate FV m;
              FV discountRate n   Total Table coupon discountRate ii , ii, 1 m, n, 1 m

            tillFirst numberofDaysBeforeNextCoupon 365;
            modelA priceOfBondContinuous 100, couponsA          100, tillFirst         2   &
                 Range 1 , 9, 1 ;
            modelB priceOfBondContinuous 100, couponsB          100, tillFirst         2   &
                 Range 1 , 9 , 1 ;
            sol NMinimize       modelA askPriceA ^ 2    modelB askPriceB ^ 2    Total, a0 0.0 ,
               a0, a1, a2, a3, a4
            inds    a0, a1, a2, a3, a4 . sol 2 ;
            ft Total inds .Table t ^ ii 1 , ii, 1, 5       ;
            spotRatesAnalytical Table ft . t ii , ii, 0, 4, 0.5
            pl1 ListLinePlot spotRatesAnalytical, Frame True, PlotRange All, PlotStyle Red ;
            Print "Step 2:" ;
            zeroCoupon      couponsB couponsA askPriceOriginalA askPriceOriginalB;
            portfolioFaceValue        couponsB couponsA    1 100;
            spotRates
               Flatten Table Solve s         2   ii 1    tillFirst Log     portfolioFaceValue ii
                             zeroCoupon ii       , s , ii, 2, 9    All, 2 ;
            spotRates    tillFirst .01 0.5 couponsA couponsB      1 , spotRates     Flatten;
            pl2 ListLinePlot spotRates, Frame True, PlotRange All, PlotStyle Green ;
            Show pl1, pl2
            termStructure t_      Total inds .Table t ^ ii 1 , ii, 1, 5   ;
            Plot Evaluate termStructure t tillFirst , t, 0, 5
Out[622]=    0.629816,
              a0 0.0134751, a1       0.0259828, a2       0.0167159, a3   0.00412212, a4   0.00035758

Out[625]=    0.0134751, 0.00416979, 0.000443666, 9.74682 10 6 ,
             0.00111736, 0.00255222, 0.00363639, 0.00422831, 0.00472279

Step 2:


            0.012


            0.010


            0.008

Out[633]=
            0.006


            0.004


            0.002


            0.000
                    0            2      4            6             8
VentureFinanceProject1.nb   13




            0.014


            0.012


            0.010


            0.008
Out[635]=
            0.006


            0.004


            0.002


                         1          2            3       4         5

In[649]:=   zeroCoupon
Out[649]=    80.8868, 59.8, 64.1048, 81.5607, 52.4863, 87.0129, 40.0967, 69.1471, 50.7839

In[443]:=    priceOfBondContinuous 100, couponsA       100, tillFirst          2        &     0, 1, 3, 4        .
             sol 2
            ListLinePlot
             askPriceB   priceOfBondContinuous 100, couponsB     100,      tillFirst              2      &
                  Range 0, 8, 1    . sol 2
Out[443]=    99.7814, 102.212, 105.678, 107.99

             6



             4



             2
Out[444]=



                         2              4            6       8


             2
14   VentureFinanceProject1.nb




In[445]:=   liabilities   10 000, 5000, 40 000, 7000, 80 000, 12 000, 50 000, 6000, 15 000 ;
            vars Array a, 18 ;
            bondMatrix   semiAnnualcoupons       100, 100, ConstantArray 0, 16         Flatten ,
               Flatten 0, 0, Drop semiAnnualcoupons, 2
                 Flatten 0, 0, 100, 100, ConstantArray 0, 14 ,
               Flatten 0, 0, 0, 0, Drop semiAnnualcoupons, 4
                 Flatten 0, 0, 0, 0, 100, 100, ConstantArray 0, 12 ,
               Flatten 0, 0, 0, 0, 0, 0, Drop semiAnnualcoupons, 6
                 Flatten 0, 0, 0, 0, 0, 0, 100, 100, ConstantArray 0, 10 ,
               Flatten 0, 0, 0, 0, 0, 0, 0, 0, Drop semiAnnualcoupons, 8
                 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 100, 100, ConstantArray 0, 8 ,
               Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop semiAnnualcoupons, 10
                 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 100, ConstantArray 0, 6 ,
               Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop semiAnnualcoupons, 12
                 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 100, ConstantArray 0, 4 ,
               Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop semiAnnualcoupons, 14
                 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 100, ConstantArray 0, 2 ,
               Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop semiAnnualcoupons, 16
                 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 100
               ;
            solSimp Minimize vars.askPrice,
               Thread bondMatrix.vars     liabilities , Thread vars 0 , vars
            Chop bondMatrix.vars liabilities . solSimp 2
             vars . solSimp 2         Total
Out[448]=    222 207., a 1    0., a 2   74.933, a 3     0., a 4    25.2608, a 5    0., a 6    375.482,
              a 7    0., a 8   48.0633, a 9    0., a 10     778.244, a 11    0., a 12    105.54,
              a 13    485.803, a 14   0., a 15    55.5195, a 16     0., a 17    146.699, a 18    0.

Out[449]=    0, 0, 0, 0, 0, 0, 0, 0, 0

Out[450]=   2095.54

In[451]:=   solLPV LinearProgramming askPrice, bondMatrix, liabilities
            Chop bondMatrix.vars liabilities . Thread vars solLPV
Out[451]=    0., 74.933, 0., 25.2608, 0., 375.482, 0., 48.0633,
             0., 778.244, 0., 105.54, 485.803, 0., 55.5195, 0., 146.699, 0.

Out[452]=    0, 0, 0, 0, 0, 0, 0, 0, 0

In[453]:=   bondMatrix       MatrixForm
Out[453]//MatrixForm=
            102.313 100.438 2.1875   0.875  1.9375 0.6875    2.125   0.375   2         0.9375   2.125   0.25
               0       0    102.188 100.875 1.9375 0.6875    2.125   0.375   2         0.9375   2.125   0.25
               0       0       0       0    101.938 100.688 2.125    0.375   2         0.9375   2.125   0.25
               0       0       0       0       0       0    102.125 100.375 2          0.9375   2.125   0.25
               0       0       0       0       0       0       0       0    102        100.938 2.125    0.25
               0       0       0       0       0       0       0       0     0            0    102.125 100.25
               0       0       0       0       0       0       0       0     0            0       0
               0       0       0       0       0       0       0       0     0            0       0
               0       0       0       0       0       0       0       0     0            0       0
VentureFinanceProject1.nb    15




In[456]:=   bM bondMatrix.vars liabilities;
            simpleMatching   bM 1     0,
               bM 1     bM 2     0,
               bM 1     bM 2     bM 3    0,
               bM 1     bM 2     bM 3    bM 4    0,
               bM 1     bM 2     bM 3    bM 4   bM 5      0,
               bM 1     bM 2     bM 3    bM 4   bM 5     bM 6      0,
               bM 1     bM 2     bM 3    bM 4   bM 5     bM 6     bM 7           0,
               bM 1     bM 2     bM 3    bM 4   bM 5     bM 6     bM 7           bM 8        0,
               bM 1     bM 2     bM 3    bM 4   bM 5     bM 6     bM 7           bM 8        bM 9            0 ;
            solutionSimpleMatching
             NMinimize vars.askPrice, Flatten simpleMatching, Thread vars        0    , vars
            Chop bondMatrix.vars liabilities . solutionSimpleMatching 2
Out[458]=    222 207., a 1    0., a 2   74.933, a 3     0., a 4    25.2608, a 5    0., a 6    375.482,
              a 7    0., a 8   48.0633, a 9    0., a 10     778.244, a 11    0., a 12    105.54,
              a 13    485.803, a 14   0., a 15    55.5195, a 16     0., a 17    146.699, a 18    0.

Out[459]=    0, 0, 0, 0, 0, 0, 0, 0, 0

In[481]:=   spotRatesAnalytical Table ft . t ii , ii, 0, 4, 0.5
            discounts Exp spotRatesAnalytical 0.5
Out[481]=    0.0134751, 0.00416979, 0.000443666, 9.74682 10 6 ,
             0.00111736, 0.00255222, 0.00363639, 0.00422831, 0.00472279

Out[482]=    0.993285, 0.997917, 0.999778, 0.999995, 0.999441, 0.998725, 0.998183, 0.997888, 0.997641
16   VentureFinanceProject1.nb




In[516]:=   bM bondMatrix.vars liabilities;
            simpleMatching    discounts 1 bM 1          0,
               discounts 2 bM 1         bM 2      0,
               discounts 3     discounts 2 bM 1           bM 2      bM 3     0,
               discounts 4
                    discounts 3     discounts 2 bM 1          bM 2      bM 3     bM 4     0,
               discounts 5     discounts 4      discounts 3      discounts 2 bM 1       bM 2
                        bM 3       bM 4       bM 5       0,
               discounts 6     discounts 5      discounts 4      discounts 3    discounts 2
                                bM 1      bM 2       bM 3       bM 4      bM 5      bM 6     0,
               discounts 7     discounts 6      discounts 5      discounts 4
                              discounts 3      discounts 2 bM 1         bM 2     bM 3
                            bM 4      bM 5       bM 6        bM 7     0,
               discounts 8     discounts 7      discounts 6      discounts 5    discounts 4
                                 discounts 3      discounts 2 bM 1         bM 2      bM 3
                               bM 4       bM 5       bM 6       bM 7      bM 8     0,
               discounts 9     discounts 8      discounts 7      discounts 6
                              discounts 5      discounts 4      discounts 3
                                         discounts 2 bM 1         bM 2      bM 3      bM 4
                               bM 5       bM 6       bM 7       bM 8      bM 9     0 ;
            solutionSimpleMatching NMinimize vars.askPrice, Flatten
                 simpleMatching, Thread vars 0        , vars
            Chop bondMatrix.vars liabilities . solutionSimpleMatching 2
             vars . solutionSimpleMatching 2           Total
            vars . solutionSimpleMatching 2         TableForm
Out[518]=    222 207., a 1    0., a 2   74.933, a 3     0., a 4    25.2608, a 5    0., a 6    375.482,
              a 7    0., a 8   48.0633, a 9    0., a 10     778.244, a 11    0., a 12    105.54,
              a 13    485.803, a 14   0., a 15    55.5195, a 16     0., a 17    146.699, a 18    0.

Out[519]=    0, 0, 0, 0, 0, 0, 0, 0, 0

Out[520]=   2095.54
Out[521]//TableForm=
        0.
        74.933
        0.
        25.2608
        0.
        375.482
        0.
        48.0633
        0.
        778.244
        0.
        105.54
        485.803
        0.
        55.5195
        0.
        146.699
        0.
VentureFinanceProject1.nb   17




a0 - a1
  bM bondMatrix.vars liabilities;
  simpleMatching    discounts 1 bM 1          0,
     discounts 2 bM 1         bM 2      0,
     discounts 3     discounts 2 bM 1           bM 2      bM 3     0,
     discounts 4
          discounts 3     discounts 2 bM 1          bM 2      bM 3     bM 4     0,
     discounts 5     discounts 4      discounts 3      discounts 2 bM 1       bM 2
              bM 3       bM 4       bM 5       0,
     discounts 6     discounts 5      discounts 4      discounts 3    discounts 2 bM        1
                     bM 2       bM 3       bM 4       bM 5      bM 6     0,
     discounts 7     discounts 6      discounts 5      discounts 4
                    discounts 3      discounts 2 bM 1         bM 2     bM 3
                  bM 4      bM 5       bM 6        bM 7     0,
     discounts 8     discounts 7      discounts 6      discounts 5    discounts 4
                       discounts 3      discounts 2 bM 1         bM 2      bM 3
                     bM 4       bM 5       bM 6       bM 7      bM 8     0,
     discounts 9     discounts 8      discounts 7      discounts 6
                    discounts 5      discounts 4      discounts 3
                               discounts 2 bM 1         bM 2      bM 3      bM 4
                     bM 5       bM 6       bM 7       bM 8      bM 9     0 ;
  solutionSimpleMatching NMinimize vars.askPrice, Flatten
       simpleMatching, Thread vars 0        , vars
  Chop bondMatrix.vars liabilities . solutionSimpleMatching 2
   vars . solutionSimpleMatching 2           Total
  vars . solutionSimpleMatching 2         TableForm

  discountRate t
   t       a0 a1 t a2 t2 a3 t3 a4 t4


  D F discountRate t , a0
       t    a0 a1 t a2 t2 a3 t3 a4 t4     Ft

  discountRate tk
   tk       a0 a1 t k a2 t2 a3 t3 a4 t4
                          k     k     k
18   VentureFinanceProject1.nb




                                                                          n
                                    tN    a0 a1 t N a2 t2 a3 t3 a4 t4                        tk        a0 a1 t k a2 t2 a3 t3 a4 t4
               PV tN       tN F                         N     N     N             tk Ck                              k     k     k   ,
          a0                                                             k 1

                                                                              n
                                           a0 a1 t N a2 t2 a3 t3 a4 t4                                   a0 a1 t k a2 t2 a3 t3 a4 t4
               PV tN       tN 2 F    tN                  N     N     N             tk 2 Ck        tk                   k     k     k     ,
          a1                                                              k 1

                                                                              n
                                           a0 a1 t N a2 t2 a3 t3 a4 t4                                   a0 a1 t k a2 t2 a3 t3 a4 t4
               PV tN       tN 3 F    tN                  N     N     N             tk 3 Ck        tk                   k     k     k     ,
          a2                                                              k 1

                                                                              n
                                           a0 a1 t N a2 t2 a3 t3 a4 t4                                   a0 a1 t k a2 t2 a3 t3 a4 t4
               PV tN       tN 4 F    tN                  N     N     N             tk 4 Ck        tk                   k     k     k     ,
          a3                                                              k 1

                                                                              n
                                           a0 a1 t N a2 t2 a3 t3 a4 t4                                   a0 a1 t k a2 t2 a3 t3 a4 t4
               PV tN       tN 5 F    tN                  N     N     N             tk 5 Ck        tk                   k     k     k     .
          a4                                                              k 1




         0., 0., 0.5, 0.5, 1., 1., 1.5, 1.5, 2., 2., 2.5, 2.5, 3., 3., 3.5, 3.5, 4., 4.

        modliabilities
         10 000, 5000, 40 000, 7000, 80 000, 12 000, 50 000, 6000, 15 000
          1., 1., 1.5, 1.5, 2., 2., 2.5, 2.5, 3., 3., 3.5, 3.5, 4., 4., 4.5, 4.5, 5., 5.

It is as if appropriate powers of t are applied to the coupon and face value.
VentureFinanceProject1.nb   19




   a0
In[522]:=   factor    ConstantArray 1, 18      0 tis 0 tis ^ 2 0 tis ^ 3 0 tis ^ 4 ;
            modliabilities
              factor 1 ;; 18 ;; 2      10 000, 5000, 40 000, 7000, 80 000, 12 000, 50 000, 6000, 15 000 ;
            vars Array a, 18 ;
            tis Riffle Range 0, 8, 1       2., Range 0, 8, 1    2. ;
            modFV factor 100;
            modcoupons factor semiAnnualcoupons;
            bondMatrix     modcoupons      modFV 1 , modFV 2 , ConstantArray 0, 16              Flatten ,
               Flatten 0, 0, Drop modcoupons, 2
                 Flatten 0, 0, modFV 3 , modFV 4 , ConstantArray 0, 14 ,
               Flatten 0, 0, 0, 0, Drop modcoupons, 4
                 Flatten 0, 0, 0, 0, modFV 5 , modFV 6 , ConstantArray 0, 12 ,
               Flatten 0, 0, 0, 0, 0, 0, Drop modcoupons, 6
                 Flatten 0, 0, 0, 0, 0, 0, modFV 7 , modFV 8 , ConstantArray 0, 10 ,
               Flatten 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 8
                 Flatten 0, 0, 0, 0, 0, 0, 0, 0, modFV 9 , modFV 10 , ConstantArray 0, 8 ,
               Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 10
                 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 11 , modFV 12 , ConstantArray 0, 6 ,
               Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 12          Flatten
                   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 13 , modFV 14 , ConstantArray 0, 4 ,
               Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 14         Flatten 0,
                   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 15 , modFV 16 , ConstantArray 0, 2 ,
               Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 16
                 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 17 , modFV 18
               ;
              solSimp Minimize vars.askPrice,
                 Thread bondMatrix.vars       modliabilities ,Thread vars 0 ,vars
              Chop bondMatrix.vars liabilities .solSimp 2
            solDeriv Minimize Total vars,
               Thread bondMatrix.vars        modliabilities , Thread vars 0 , vars
             vars . solDeriv 2           TableForm
20   VentureFinanceProject1.nb




Out[530]//TableForm=
        58.8723
        0.
        10.2338
        0.
        360.458
        0.
        37.4415
        0.
        768.237
        0.
        103.602
        0.
        485.803
        0.
        55.5195
        0.
        146.699
        0.

Out[529]=     2026.87, a 1     58.8723, a 2    0., a 3    10.2338, a 4    0., a 5    360.458, a 6     0.,
               a 7    37.4415, a 8    0., a 9    768.237, a 10    0., a 11    103.602, a 12     0.,
               a 13    485.803, a 14    0., a 15    55.5195, a 16    0., a 17     146.699, a 18    0.

            2026.87, a 1     58.8723, a 2    0., a 3    10.2338, a 4    0., a 5    360.458, a 6     0.,
             a 7    37.4415, a 8    0., a 9    768.237, a 10    0., a 11    103.602, a 12     0.,
             a 13    485.803, a 14    0., a 15    55.5195, a 16    0., a 17     146.699, a 18    0.
        58.8723
        0.
        10.2338
        0.
        360.458
        0.
        37.4415
        0.
        768.237
        0.
        103.602
        0.
        485.803
        0.
        55.5195
        0.
        146.699
        0.
VentureFinanceProject1.nb   21




   a0 - a1
In[531]:=   factor    ConstantArray 1, 18       tis 0 tis ^ 2 0 tis ^ 3 0 tis ^ 4 ;
            modliabilities
              factor 1 ;; 18 ;; 2      10 000, 5000, 40 000, 7000, 80 000, 12 000, 50 000, 6000, 15 000 ;
            vars Array a, 18 ;
            tis Riffle Range 0, 8, 1       2., Range 0, 8, 1    2. ;
            modFV factor 100;
            modcoupons factor semiAnnualcoupons;
            bondMatrix     modcoupons      modFV 1 , modFV 2 , ConstantArray 0, 16              Flatten ,
               Flatten 0, 0, Drop modcoupons, 2
                 Flatten 0, 0, modFV 3 , modFV 4 , ConstantArray 0, 14 ,
               Flatten 0, 0, 0, 0, Drop modcoupons, 4
                 Flatten 0, 0, 0, 0, modFV 5 , modFV 6 , ConstantArray 0, 12 ,
               Flatten 0, 0, 0, 0, 0, 0, Drop modcoupons, 6
                 Flatten 0, 0, 0, 0, 0, 0, modFV 7 , modFV 8 , ConstantArray 0, 10 ,
               Flatten 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 8
                 Flatten 0, 0, 0, 0, 0, 0, 0, 0, modFV 9 , modFV 10 , ConstantArray 0, 8 ,
               Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 10
                 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 11 , modFV 12 , ConstantArray 0, 6 ,
               Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 12          Flatten
                   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 13 , modFV 14 , ConstantArray 0, 4 ,
               Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 14         Flatten 0,
                   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 15 , modFV 16 , ConstantArray 0, 2 ,
               Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 16
                 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 17 , modFV 18
               ;
              solSimp Minimize vars.askPrice,
                 Thread bondMatrix.vars       modliabilities ,Thread vars 0 ,vars
              Chop bondMatrix.vars liabilities .solSimp 2
            solDeriv Minimize Total vars,
               Thread bondMatrix.vars        modliabilities , Thread vars 0 , vars
             vars . solDeriv 2           TableForm
Out[538]=    1909.3, a 1   0., a 2   0., a 3    0., a 4    0., a 5     335.968, a 6    0.,
              a 7   23.9821, a 8   0., a 9    762.076, a 10    0., a 11     100.558, a 12    0.,
              a 13   484.858, a 14   0., a 15    55.1604, a 16     0., a 17    146.699, a 18    0.
22   VentureFinanceProject1.nb




Out[539]//TableForm=
        0.
        0.
        0.
        0.
        335.968
        0.
        23.9821
        0.
        762.076
        0.
        100.558
        0.
        484.858
        0.
        55.1604
        0.
        146.699
        0.
VentureFinanceProject1.nb   23




   a0 - a2
In[540]:=   factor    ConstantArray 1, 18       tis tis ^ 2 0 tis ^ 3 0 tis ^ 4 ;
            modliabilities
              factor 1 ;; 18 ;; 2      10 000, 5000, 40 000, 7000, 80 000, 12 000, 50 000, 6000, 15 000 ;
            vars Array a, 18 ;
            tis Riffle Range 0, 8, 1       2., Range 0, 8, 1    2. ;
            modFV factor 100;
            modcoupons factor semiAnnualcoupons;
            bondMatrix     modcoupons      modFV 1 , modFV 2 , ConstantArray 0, 16              Flatten ,
               Flatten 0, 0, Drop modcoupons, 2
                 Flatten 0, 0, modFV 3 , modFV 4 , ConstantArray 0, 14 ,
               Flatten 0, 0, 0, 0, Drop modcoupons, 4
                 Flatten 0, 0, 0, 0, modFV 5 , modFV 6 , ConstantArray 0, 12 ,
               Flatten 0, 0, 0, 0, 0, 0, Drop modcoupons, 6
                 Flatten 0, 0, 0, 0, 0, 0, modFV 7 , modFV 8 , ConstantArray 0, 10 ,
               Flatten 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 8
                 Flatten 0, 0, 0, 0, 0, 0, 0, 0, modFV 9 , modFV 10 , ConstantArray 0, 8 ,
               Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 10
                 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 11 , modFV 12 , ConstantArray 0, 6 ,
               Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 12          Flatten
                   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 13 , modFV 14 , ConstantArray 0, 4 ,
               Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 14         Flatten 0,
                   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 15 , modFV 16 , ConstantArray 0, 2 ,
               Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 16
                 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 17 , modFV 18
               ;
              solSimp Minimize vars.askPrice,
                 Thread bondMatrix.vars       modliabilities ,Thread vars 0 ,vars
              Chop bondMatrix.vars liabilities .solSimp 2
            solDeriv Minimize Total vars,
               Thread bondMatrix.vars        modliabilities , Thread vars 0 , vars
             vars . solDeriv 2           TableForm
Out[547]=    1813.7, a 1    0., a 2    0., a 3   0., a 4    0., a 5    281.354, a 6    0.,
              a 7   0., a 8    0., a 9    751.488, a 10   0., a 11    95.9613, a 12     0.,
              a 13   483.5, a 14    0., a 15    54.6994, a 16    0., a 17    146.699, a 18          0.
24   VentureFinanceProject1.nb




Out[548]//TableForm=
        0.
        0.
        0.
        0.
        281.354
        0.
        0.
        0.
        751.488
        0.
        95.9613
        0.
        483.5
        0.
        54.6994
        0.
        146.699
        0.
VentureFinanceProject1.nb   25




   a0 - a3
In[549]:=   factor    ConstantArray 1, 18       tis tis ^ 2 tis ^ 3 0 tis ^ 4 ;
            modliabilities
              factor 1 ;; 18 ;; 2      10 000, 5000, 40 000, 7000, 80 000, 12 000, 50 000, 6000, 15 000 ;
            vars Array a, 18 ;
            tis Riffle Range 0, 8, 1       2., Range 0, 8, 1    2. ;
            modFV factor 100;
            modcoupons factor semiAnnualcoupons;
            bondMatrix     modcoupons      modFV 1 , modFV 2 , ConstantArray 0, 16              Flatten ,
               Flatten 0, 0, Drop modcoupons, 2
                 Flatten 0, 0, modFV 3 , modFV 4 , ConstantArray 0, 14 ,
               Flatten 0, 0, 0, 0, Drop modcoupons, 4
                 Flatten 0, 0, 0, 0, modFV 5 , modFV 6 , ConstantArray 0, 12 ,
               Flatten 0, 0, 0, 0, 0, 0, Drop modcoupons, 6
                 Flatten 0, 0, 0, 0, 0, 0, modFV 7 , modFV 8 , ConstantArray 0, 10 ,
               Flatten 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 8
                 Flatten 0, 0, 0, 0, 0, 0, 0, 0, modFV 9 , modFV 10 , ConstantArray 0, 8 ,
               Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 10
                 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 11 , modFV 12 , ConstantArray 0, 6 ,
               Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 12          Flatten
                   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 13 , modFV 14 , ConstantArray 0, 4 ,
               Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 14         Flatten 0,
                   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 15 , modFV 16 , ConstantArray 0, 2 ,
               Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 16
                 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 17 , modFV 18
               ;
              solSimp Minimize vars.askPrice,
                 Thread bondMatrix.vars       modliabilities ,Thread vars 0 ,vars
              Chop bondMatrix.vars liabilities .solSimp 2
            solDeriv Minimize Total vars,
               Thread bondMatrix.vars        modliabilities , Thread vars 0 , vars
             vars . solDeriv 2           TableForm
Out[556]=    1651.34, a 1    0., a 2    0., a 3    0., a 4   0., a 5    146.535, a 6    0.,
              a 7    0., a 8   0., a 9    733.167, a 10    0., a 11   89.1605, a 12    0.,
              a 13    481.638, a 14    0., a 15   54.144, a 16    0., a 17    146.699, a 18          0.
26   VentureFinanceProject1.nb




Out[557]//TableForm=
        0.
        0.
        0.
        0.
        146.535
        0.
        0.
        0.
        733.167
        0.
        89.1605
        0.
        481.638
        0.
        54.144
        0.
        146.699
        0.
VentureFinanceProject1.nb   27




   a0 - a4
In[577]:=   factor    ConstantArray 1, 18       tis tis ^ 2 tis ^ 3 tis ^ 4 ;
            modliabilities
              factor 1 ;; 18 ;; 2      10 000, 5000, 40 000, 7000, 80 000, 12 000, 50 000, 6000, 15 000 ;
            vars Array a, 18 ;
            tis Riffle Range 0, 8, 1       2., Range 0, 8, 1    2. ;
            modFV factor 100;
            modcoupons factor semiAnnualcoupons;
            bondMatrix     modcoupons      modFV 1 , modFV 2 , ConstantArray 0, 16              Flatten ,
               Flatten 0, 0, Drop modcoupons, 2
                 Flatten 0, 0, modFV 3 , modFV 4 , ConstantArray 0, 14 ,
               Flatten 0, 0, 0, 0, Drop modcoupons, 4
                 Flatten 0, 0, 0, 0, modFV 5 , modFV 6 , ConstantArray 0, 12 ,
               Flatten 0, 0, 0, 0, 0, 0, Drop modcoupons, 6
                 Flatten 0, 0, 0, 0, 0, 0, modFV 7 , modFV 8 , ConstantArray 0, 10 ,
               Flatten 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 8
                 Flatten 0, 0, 0, 0, 0, 0, 0, 0, modFV 9 , modFV 10 , ConstantArray 0, 8 ,
               Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 10
                 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 11 , modFV 12 , ConstantArray 0, 6 ,
               Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 12          Flatten
                   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 13 , modFV 14 , ConstantArray 0, 4 ,
               Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 14         Flatten 0,
                   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 15 , modFV 16 , ConstantArray 0, 2 ,
               Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 16
                 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 17 , modFV 18
               ;
              solSimp Minimize vars.askPrice,
                 Thread bondMatrix.vars       modliabilities ,Thread vars 0 ,vars
              Chop bondMatrix.vars liabilities .solSimp 2
            solDeriv Minimize Total vars,
               Thread bondMatrix.vars        modliabilities , Thread vars 0 , vars
             vars . solDeriv 2           TableForm
             vars . solDeriv 2       . askPrice
Out[584]=    1459.58, a 1     0., a 2    0., a 3     0., a 4   0., a 5    0., a 6    0., a 7   0.,
              a 8    0., a 9    701.08, a 10     0., a 11    79.1567, a 12    0., a 13    479.145,
              a 14    0., a 15    53.4955, a 16     0., a 17    146.699, a 18     0.
28   VentureFinanceProject1.nb




Out[585]//TableForm=
        0.
        0.
        0.
        0.
        0.
        0.
        0.
        0.
        701.08
        0.
        79.1567
        0.
        479.145
        0.
        53.4955
        0.
        146.699
        0.

Out[586]=   162 214.


     Part 0 : Chapter 4, Exercise 4
        ClearAll "` " ;
        dateMonth0 11;
        dateDay0 5;
        dateYear0 2011;
        dateMonthAfter 2;
        dateDayAfter 15;
        dateYearAfter 2012;
        dateMonthBefore 8;
        dateDayBefore 15;
        dateYearBefore 2011;
        numberOfDaysSinceLastCoupon DateDifference 2012, 8, 15 , 2012, 10, 11 ;
        numberofDaysBeforeNextCoupon DateDifference 2012, 10, 11 , 2013, 2, 15 ;
        numberOfDaysInCurrentCouponPeriod DateDifference 2012, 8, 15 , 2013, 2, 15 ;
        fraction    numberOfDaysSinceLastCoupon numberOfDaysInCurrentCouponPeriod ;
        FV 100;
        askPrice0
           100, 100, 100, 101, 101, 101, 100, 102, 98, 102, 97, 101, 99, 109, 101, 107, 99, 103 ;
        askPrice1    0, 22, 24, 1, 7, 12, 26, 1, 5, 9, 13, 23, 5, 4, 13, 27, 13, 0 32;
        askPrice01 N askPrice0 askPrice1 ;
        coupons0   6, 9, 7, 8, 8, 8, 8, 8, 6, 8, 6, 8, 7, 11, 8, 10, 7, 8 ;
        coupons1   5 8, 1 8, 7 8, 1 4, 1 4, 3 8,
           0, 3 4, 7 8, 7 8, 7 8, 5 8, 3 4, 1 4, 1 2, 1 2, 7 8, 7 8 ;
        coupons N coupons0 coupons1 ;
        couponsA coupons 1 ;; Length coupons ;; 2 ;
        couponsB coupons 2 ;; Length coupons ;; 2 ;
        deltaAsk   DateDifference 2011, 8, 15 , 2011, 11, 5
             DateDifference 2011, 8, 5 , 2012, 2, 15          coupons 2;
VentureFinanceProject1.nb   29




  numberofDaysBeforeNextCoupon DateDifference 2012,10,11 , 2013,2,15 ;
askPrice askPrice01 deltaAsk;
askPriceA askPrice 1 ;; Length coupons ;; 2 ;
askPriceB askPrice 2 ;; Length coupons ;; 2 ;
tillFirst numberofDaysBeforeNextCoupon 365;
spotRate t_ : a0 a1 t a2 t ^ 2 a3 t ^ 3 a4 t ^ 4;
discountRate t_ : Exp spotRate t t ;
priceOfBondContinuous FV_, couponRate_, n_, m_: 2 : Module nterms, coupon ,
  coupon couponRate FV m;
  nterms n m;
  FV discountRate n   Total Table coupon discountRate ii , ii, 1 m, n, 1 m

  priceOfBondContinuous 100,6.25 100,1 2
 priceOfBondContinuous 100,6.25 100,1
 priceOfBondContinuous 100,6.25 100,2
modelA discountRate .275 priceOfBondContinuous 100, couponsA            100,    2 &
   Range 1, 9, 1 ;
modelB discountRate .275 priceOfBondContinuous 100, couponsB            100,    2 &
   Range 1, 9, 1 ;
sol NMinimize       modelA askPriceA ^ 2    modelB askPriceB ^ 2     Total, a0 0 ,
   a0, a1, a2, a3, a4
inds    a0, a1, a2, a3, a4 . sol 2
ft Total inds .Table t ^ ii 1 , ii, 1, 5
pl1 ListLinePlot Table ft . t ii , ii, 0, 4, 0.5 ,
   Frame True, PlotRange All, PlotStyle Red ;
zeroCoupon      couponsB couponsA askPriceA askPriceB
portfolioFaceValue        couponsB couponsA    1 100
  spotRates Flatten
      Table Solve s       2 ii 1 Log     portfolioFaceValue ii     zeroCoupon ii       ,s ,
        ii,2,8       All,2 ;
spotRates    Flatten Table Solve s        2    ii 1   tillFirst Log
                portfolioFaceValue ii      zeroCoupon ii      , s , ii, 2, 9     All, 2 ;
spotRates    0.30978260869565216` .01 couponsA couponsB       1    2, spotRates     Flatten
pl2 ListLinePlot spotRates, Frame True, PlotRange All ;
Show pl1, pl2
 0.237341, a0     0., a1   0.0754916, a2    0.0336651, a3    0.00720111, a4    0.000585291

 0., 0.0754916, 0.0336651, 0.00720111, 0.000585291

0.    0.0754916 t 0.0336651 t2   0.00720111 t3   0.000585291 t4
     37.0483, 4.51637, 1.37737, 8.23242, 24.4295, 20.4818, 34.8115, 17.4228, 9.02927

     37.7358, 4.7619, 1.51515, 9.375, 29.0909, 25.4545, 45.1613, 23.5294, 12.6984

 0.0243954, 0.0785483, 0.0812127, 0.0776395,
 0.0803287, 0.0812861, 0.0820085, 0.0817839, 0.0816982
30   VentureFinanceProject1.nb




        0.08




        0.06




        0.04




        0.02




        0.00
               0             2   4   6   8

More Related Content

Viewers also liked

PENGENALAN KEPADA TRANSISTOR
PENGENALAN KEPADA TRANSISTORPENGENALAN KEPADA TRANSISTOR
PENGENALAN KEPADA TRANSISTORMadihahNazirah
 
Annual Report of Ukrainian Center for Social Data, 2015
Annual Report of Ukrainian Center for Social Data, 2015Annual Report of Ukrainian Center for Social Data, 2015
Annual Report of Ukrainian Center for Social Data, 2015Andriy Gorbal
 
Річний звіт Українського центру суспільних даних, 2015
Річний звіт Українського центру суспільних даних, 2015Річний звіт Українського центру суспільних даних, 2015
Річний звіт Українського центру суспільних даних, 2015Andriy Gorbal
 
Secret cv üniversite seminerleri
Secret cv üniversite seminerleriSecret cv üniversite seminerleri
Secret cv üniversite seminerleriA. Cezmi Göbüt
 
Db프로그래밍 환경 설정(131062 장택순)
Db프로그래밍 환경 설정(131062 장택순)Db프로그래밍 환경 설정(131062 장택순)
Db프로그래밍 환경 설정(131062 장택순)TaekSoon Jang
 
Binary Options Trading Strategies | Best Trading Strategies for Binary Options
Binary Options Trading Strategies | Best Trading Strategies for Binary OptionsBinary Options Trading Strategies | Best Trading Strategies for Binary Options
Binary Options Trading Strategies | Best Trading Strategies for Binary OptionsSteve Roberts
 
Postmortem diablo ii
Postmortem   diablo iiPostmortem   diablo ii
Postmortem diablo iiTaekSoon Jang
 
Bridge pattern for Dummies
Bridge pattern for DummiesBridge pattern for Dummies
Bridge pattern for DummiesTaekSoon Jang
 

Viewers also liked (13)

PENGENALAN KEPADA TRANSISTOR
PENGENALAN KEPADA TRANSISTORPENGENALAN KEPADA TRANSISTOR
PENGENALAN KEPADA TRANSISTOR
 
Cc department
Cc departmentCc department
Cc department
 
Annual Report of Ukrainian Center for Social Data, 2015
Annual Report of Ukrainian Center for Social Data, 2015Annual Report of Ukrainian Center for Social Data, 2015
Annual Report of Ukrainian Center for Social Data, 2015
 
тайна имени алла
тайна имени аллатайна имени алла
тайна имени алла
 
Umago e la mia citta
Umago e la mia cittaUmago e la mia citta
Umago e la mia citta
 
Річний звіт Українського центру суспільних даних, 2015
Річний звіт Українського центру суспільних даних, 2015Річний звіт Українського центру суспільних даних, 2015
Річний звіт Українського центру суспільних даних, 2015
 
Secret cv üniversite seminerleri
Secret cv üniversite seminerleriSecret cv üniversite seminerleri
Secret cv üniversite seminerleri
 
Db프로그래밍 환경 설정(131062 장택순)
Db프로그래밍 환경 설정(131062 장택순)Db프로그래밍 환경 설정(131062 장택순)
Db프로그래밍 환경 설정(131062 장택순)
 
Ford case presentation
Ford   case presentationFord   case presentation
Ford case presentation
 
Binary Options Trading Strategies | Best Trading Strategies for Binary Options
Binary Options Trading Strategies | Best Trading Strategies for Binary OptionsBinary Options Trading Strategies | Best Trading Strategies for Binary Options
Binary Options Trading Strategies | Best Trading Strategies for Binary Options
 
Postmortem diablo ii
Postmortem   diablo iiPostmortem   diablo ii
Postmortem diablo ii
 
Bridge pattern for Dummies
Bridge pattern for DummiesBridge pattern for Dummies
Bridge pattern for Dummies
 
PENGENALAN TRANSISTOR
PENGENALAN TRANSISTORPENGENALAN TRANSISTOR
PENGENALAN TRANSISTOR
 

Similar to Venture financeproject1

Lcci business statistics series 2 2002 考试
Lcci business statistics series 2 2002 考试Lcci business statistics series 2 2002 考试
Lcci business statistics series 2 2002 考试priya5594
 
[論文紹介] DPSNet: End-to-end Deep Plane Sweep Stereo
[論文紹介] DPSNet: End-to-end Deep Plane Sweep Stereo[論文紹介] DPSNet: End-to-end Deep Plane Sweep Stereo
[論文紹介] DPSNet: End-to-end Deep Plane Sweep StereoSeiya Ito
 
Statistics project2
Statistics project2Statistics project2
Statistics project2shri1984
 
PA 1c. Decision VariablesabcdCalculated values0.21110.531110.09760.docx
PA 1c. Decision VariablesabcdCalculated values0.21110.531110.09760.docxPA 1c. Decision VariablesabcdCalculated values0.21110.531110.09760.docx
PA 1c. Decision VariablesabcdCalculated values0.21110.531110.09760.docxgerardkortney
 
4 production and cost
4  production and cost4  production and cost
4 production and costdannygriff1
 
CAE REPORT
CAE REPORTCAE REPORT
CAE REPORTdayahisa
 
Spring 2003
Spring 2003Spring 2003
Spring 2003butest
 
Computer architecture, a quantitative approach (solution for 5th edition)
Computer architecture, a quantitative approach (solution for 5th edition)Computer architecture, a quantitative approach (solution for 5th edition)
Computer architecture, a quantitative approach (solution for 5th edition)Zohaib Ali
 
Dac07
Dac07Dac07
Dac07makro
 
Engine90 crawford-decision-making (1)
Engine90 crawford-decision-making (1)Engine90 crawford-decision-making (1)
Engine90 crawford-decision-making (1)Divyansh Dokania
 
EGT267 Programming for Engineering Applications Spring 2020 .docx
EGT267 Programming for Engineering Applications Spring 2020 .docxEGT267 Programming for Engineering Applications Spring 2020 .docx
EGT267 Programming for Engineering Applications Spring 2020 .docxgidmanmary
 
Team maverick bond portfolio managment projekt 1
Team maverick bond portfolio managment projekt 1Team maverick bond portfolio managment projekt 1
Team maverick bond portfolio managment projekt 1Predrag Pesic
 
2020 겨울방학 정기스터디 3주차
2020 겨울방학 정기스터디 3주차2020 겨울방학 정기스터디 3주차
2020 겨울방학 정기스터디 3주차Moonki Choi
 
Art and Science Come Together When Mastering Relevance Ranking - Tom Burgmans...
Art and Science Come Together When Mastering Relevance Ranking - Tom Burgmans...Art and Science Come Together When Mastering Relevance Ranking - Tom Burgmans...
Art and Science Come Together When Mastering Relevance Ranking - Tom Burgmans...Lucidworks
 
Peter Warken - Effective Pricing of Cliquet Options - Masters thesis 122015
Peter Warken - Effective Pricing of Cliquet Options - Masters thesis 122015Peter Warken - Effective Pricing of Cliquet Options - Masters thesis 122015
Peter Warken - Effective Pricing of Cliquet Options - Masters thesis 122015Peter Warken
 

Similar to Venture financeproject1 (20)

Lcci business statistics series 2 2002 考试
Lcci business statistics series 2 2002 考试Lcci business statistics series 2 2002 考试
Lcci business statistics series 2 2002 考试
 
[論文紹介] DPSNet: End-to-end Deep Plane Sweep Stereo
[論文紹介] DPSNet: End-to-end Deep Plane Sweep Stereo[論文紹介] DPSNet: End-to-end Deep Plane Sweep Stereo
[論文紹介] DPSNet: End-to-end Deep Plane Sweep Stereo
 
Statistics project2
Statistics project2Statistics project2
Statistics project2
 
Xgboost
XgboostXgboost
Xgboost
 
PA 1c. Decision VariablesabcdCalculated values0.21110.531110.09760.docx
PA 1c. Decision VariablesabcdCalculated values0.21110.531110.09760.docxPA 1c. Decision VariablesabcdCalculated values0.21110.531110.09760.docx
PA 1c. Decision VariablesabcdCalculated values0.21110.531110.09760.docx
 
Asian basket options
Asian basket optionsAsian basket options
Asian basket options
 
4 production and cost
4  production and cost4  production and cost
4 production and cost
 
CAE REPORT
CAE REPORTCAE REPORT
CAE REPORT
 
Spring 2003
Spring 2003Spring 2003
Spring 2003
 
Computer architecture, a quantitative approach (solution for 5th edition)
Computer architecture, a quantitative approach (solution for 5th edition)Computer architecture, a quantitative approach (solution for 5th edition)
Computer architecture, a quantitative approach (solution for 5th edition)
 
Dac07
Dac07Dac07
Dac07
 
Engine90 crawford-decision-making (1)
Engine90 crawford-decision-making (1)Engine90 crawford-decision-making (1)
Engine90 crawford-decision-making (1)
 
EGT267 Programming for Engineering Applications Spring 2020 .docx
EGT267 Programming for Engineering Applications Spring 2020 .docxEGT267 Programming for Engineering Applications Spring 2020 .docx
EGT267 Programming for Engineering Applications Spring 2020 .docx
 
Verify High Sigma Whitepaper
Verify High Sigma WhitepaperVerify High Sigma Whitepaper
Verify High Sigma Whitepaper
 
Team maverick bond portfolio managment projekt 1
Team maverick bond portfolio managment projekt 1Team maverick bond portfolio managment projekt 1
Team maverick bond portfolio managment projekt 1
 
2020 겨울방학 정기스터디 3주차
2020 겨울방학 정기스터디 3주차2020 겨울방학 정기스터디 3주차
2020 겨울방학 정기스터디 3주차
 
Mafa
MafaMafa
Mafa
 
Linear Programming Review.ppt
Linear Programming Review.pptLinear Programming Review.ppt
Linear Programming Review.ppt
 
Art and Science Come Together When Mastering Relevance Ranking - Tom Burgmans...
Art and Science Come Together When Mastering Relevance Ranking - Tom Burgmans...Art and Science Come Together When Mastering Relevance Ranking - Tom Burgmans...
Art and Science Come Together When Mastering Relevance Ranking - Tom Burgmans...
 
Peter Warken - Effective Pricing of Cliquet Options - Masters thesis 122015
Peter Warken - Effective Pricing of Cliquet Options - Masters thesis 122015Peter Warken - Effective Pricing of Cliquet Options - Masters thesis 122015
Peter Warken - Effective Pricing of Cliquet Options - Masters thesis 122015
 

Venture financeproject1

  • 1. Venture Lab Finance Course Project 1: Bond Portfolio Management Team: AlphaBeta Comments : Please see first 10 pages for results (little text, mostly column numbersand figures for easy reading) Steps 1 and 2 (Max Points: 9) Dirty Prices The dirty prices, obtained by adding the accrued interest to the bond prices, are as follows : Out[455]//TableForm= 102.404 100.261 104.303 101.521 106.163 101.775 108.158 100.647 109.182 (1) 103.665 111.315 100.109 112.088 106.649 114.377 102.787 116.103 105.61 System of Equations for Zero - coupon prices in Step 2 The zero - coupon bond portfolio are created as in Example 4.3 (page 77) in the text, except that the discrete compound- ing formula is replaced with continuous compounding formula. portfolioPrice couponsB couponsA askPriceOriginalA askPriceOriginalB; portfolioFaceValue couponsB couponsA 1 FaceValue; (2) Exp SpotRate t t portfolioFaceValue portfolioFaceValue
  • 2. 2 VentureFinanceProject1.nb Solve this system of equations for each time, keeping in mind that it starts from a non-zreto value (as done in code below). The results are (in percentages) : 0.956849 0.495406 0.544766 0.577495 0.556351 0.521734 0.41242 0.561462 0.922664 The code below shows the steps used in the calculations : zeroCoupon couponsB couponsA askPriceOriginalA askPriceOriginalB; portfolioFaceValue couponsB couponsA 1 100; spotRates Flatten Table Solve s 2 ii 1 tillFirst Log portfolioFaceValue ii zeroCoupon spotRates tillFirst .01 0.5 couponsA couponsB 1 ,spotRates Flatten; Step 3 (Max: 9 Points) Bond Price Formula The bond price is given by N Fe r tN tN Ck e r t k t k. (3) k 1 The Mathematica code for the above is below : priceOfBondContinuous FV_,couponRate_,n_,m_:2 : Module coupon , coupon couponRate FV m; FV discountRate n Total Table coupon discountRate ii , ii,1 m,n,1 m Also, the form of the spot rate and the corresponding discount rate is below : spotRate t_ : a0 a1 t a2 t^2 a3 t^3 a4 t^4; discountRate t_ : Exp spotRate t t ; Objective Function The objective function to be minimized is the sum of squares of the 18 terms: 9 ModelBondTypeAk AskPriceBondTypeAk ^ 2 k 1 (4) ModelBondTypeBk AskPriceBondTypeBk ^ 2
  • 3. VentureFinanceProject1.nb 3 The only subtlety is that the start time is not zero. This is taken into account. The Mathematica code implementing this is below : tillFirst numberofDaysBeforeNextCoupon 365; modelA priceOfBondContinuous 100,couponsA 100, tillFirst 2 & Range 1 ,9,1 ; modelB priceOfBondContinuous 100,couponsB 100, tillFirst 2 & Range 1 ,9 ,1 sol NMinimize modelA askPriceA ^2 modelB askPriceB ^2 Total,a0 0.0 , a0,a1,a2,a3,a4 Results for ais The results for the ai ’s are 0.0134751 0.0259828 0.0167159 (5) 0.00412212 0.00035758 The minimum value for the cost function is found to be 0.629816 (6) Step 4 (Max: 9 Points) Plot Fitted Term Structure 0.012 0.010 0.008 Out[440]= 0.006 0.004 0.002 0.000 0 2 4 6 8 The curve in red is the result computed using the polynomial fit, and the green one is using the zero - coupon calcula- tion noted above. Advant ages/Disadvant ages The spot rate is highly sensitive in fluctuations at any measurement, something which is inevitable in real life. The polynomial approach is more robust against such fluctuations, as it incorporates all the measurements in arriving at the final estimate of an instantaneous spot rate. The quality of the polynomial fit depends on the number of data points. That is, if the degree in t is chosen to be too large, the problem of overfitting results.
  • 4. 4 VentureFinanceProject1.nb The choice of least-squares is widely used, due to it nice analytical properties (e.g., one can differentiate the cost function). However, in many cases, a better choice is one tht minimizes the L-1 norm (see vast literature on compressive sensing). A better model would be to use a stochastic model (in place of the polynomial model) for the spot rate and fit that to the data. Step 5: Cash Matching (Max. Points: 9) Formulation of Part A (3 Points) First, form the bond matrix, i.e., the payments from the bonds of the various durations and coupon rates. Note it is clipped due to matrix size. Out[453]//MatrixForm= 102.313 100.438 2.1875 0.875 1.9375 0.6875 2.125 0.375 2 0.9375 2.125 0 0 102.188 100.875 1.9375 0.6875 2.125 0.375 2 0.9375 2.125 0 0 0 0 101.938 100.688 2.125 0.375 2 0.9375 2.125 0 0 0 0 0 0 102.125 100.375 2 0.9375 2.125 0 0 0 0 0 0 0 0 102 100.938 2.125 (7) 0 0 0 0 0 0 0 0 0 0 102.125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Form the vector of the bond matrix times the amounts minus the liabilities, which is the excess periodic cash flows: bondMatrix vars liabilities; (8) Now the excess periodic cash flows are fed back (at zero interest) to purchase the bonds. Thus, he equation to solve is in Mathematica code as follows: In[456]:= bM bondMatrix.vars liabilities; simpleMatching bM 1 0, bM 1 bM 2 0, bM 1 bM 2 bM 3 0, bM 1 bM 2 bM 3 bM 4 0, bM 1 bM 2 bM 3 bM 4 bM 5 0, bM 1 bM 2 bM 3 bM 4 bM 5 bM 6 0, (9) bM 1 bM 2 bM 3 bM 4 bM 5 bM 6 bM 7 0, bM 1 bM 2 bM 3 bM 4 bM 5 bM 6 bM 7 bM 8 0, bM 1 bM 2 bM 3 bM 4 bM 5 bM 6 bM 7 bM 8 bM 9 0 ; solutionSimpleMatching NMinimize vars.askPrice, Flatten simpleMatching, Thread vars 0 , vars Chop bondMatrix.vars liabilities . solutionSimpleMatching 2 Observe that : The cost function is the vector dot product of vars (the bond amounts) and the bond price computed in Step 1 (reflecting accrued interest rate). The excesses from the previous step are fed back next time period, as evident from the first nince inequality structures; The excesses all must exceed 0;
  • 5. VentureFinanceProject1.nb 5 The quantities all exceed zero (no short-selling). Solution of Part A (1 Point) The solution obtained from the above is : Out[475]//TableForm= 0. 74.933 0. 25.2608 0. 375.482 0. 48.0633 0. (10) 778.244 0. 105.54 485.803 0. 55.5195 0. 146.699 0. The cost is found to be 222 207.29 (11) Formulation of Part B (3 Points) The formulation is similar except that there is discounting. discounts Exp spotRatesAnalytical 0.5 The optimization problem is similar in structure, but note the discounting of the surplus at each time step. In[476]:= bM bondMatrix.vars liabilities; simpleMatching discounts 1 bM 1 0, discounts 2 bM 1 bM 2 0, discounts 3 discounts 2 bM 1 bM 2 bM 3 0, discounts 4 discounts 3 discounts 2 bM 1 bM 2 bM 3 bM 4 0, discounts 5 discounts 4 discounts 3 discounts 2 bM 1 bM 2 bM 3 bM 4 bM 5 0, discounts 6 discounts 5 discounts 4 discounts 3 discounts 2 bM 1 bM 2 bM 3 bM 4 bM 5 bM 6 0, discounts 7 discounts 6 discounts 5 discounts 4 discounts 3 discounts 2 bM 1 bM 2 (12) bM 3 bM 4 bM 5 bM 6 bM 7 0, discounts 8 discounts 7 discounts 6 discounts 5 discounts 4
  • 6. 6 VentureFinanceProject1.nb discounts 3 discounts 2 bM 1 bM 2 bM 3 bM 4 bM 5 bM 6 bM 7 bM 8 0, discounts 9 discounts 8 discounts 7 discounts 6 discounts 5 discounts 4 discounts 3 discounts 2 bM 1 bM 2 bM 3 bM 4 bM 5 bM 6 bM 7 bM 8 bM 9 0 ; solutionSimpleMatching NMinimize vars.askPrice, Flatten simpleMatching, Thread vars 0 , vars Chop bondMatrix.vars liabilities . solutionSimpleMatching 2 vars . solutionSimpleMatching 2 Total Solution of Part B (1 Point) The solution obtained from the above is : Out[488]//TableForm= 0. 74.933 0. 25.2608 0. 375.482 0. 48.0633 0. (13) 778.244 0. 105.54 485.803 0. 55.5195 0. 146.699 0. The cost is found to be 222 207.29 In this case, the numbers turn out to be the same. This is not going to be the case in general. Step 6: Immunization (Maximum Points : 9) Derivatives (3 points) Firs, note the simple structure of the derivatives : n PV tN tN F tN a0 a1 t N a2 t2 a3 t3 a4 t4 N N N tk Ck tk a0 a1 t k a2 t2 a3 t3 a4 t4 k k k , (12) a0 k 1 , (14)
  • 7. VentureFinanceProject1.nb 7 n PV tN tN 2 F tN a0 a1 t N a2 t2 a3 t3 a4 t4 N N N tk 2 Ck tk a0 a1 t k a2 t2 a3 t3 a4 t4 k k k , a1 k 1 n PV tN tN 3 F tN a0 a1 t N a2 t2 a3 t3 a4 t4 N N N tk 3 Ck tk a0 a1 t k a2 t2 a3 t3 a4 t4 k k k , a2 k 1 n PV tN tN 4 F tN a0 a1 t N a2 t2 a3 t3 a4 t4 N N N tk 4 Ck tk a0 a1 t k a2 t2 a3 t3 a4 t4 k k k , a3 k 1 n PV tN tN 5 F tN a0 a1 t N a2 t2 a3 t3 a4 t4 N N N tk 5 Ck tk a0 a1 t k a2 t2 a3 t3 a4 t4 k k k . a4 k 1 It is straightforward to write the same for a portfolio. Const raint s The structure of the derivatives is rather simple. It is as if appropriate powers of t are applied to the coupon and face value. In Mathematica code, all the terms a0-a4 case is implemented as factor ConstantArray 1, 18 tis tis ^ 2 tis ^ 3 tis ^ 4 ; (15) Here, tis are the different times at which the payments are made. This factor multiplies the liabilities and the coupons. vars Array a, 18 ; Variables tis Riffle Range 0, 8, 1 2., Range 0, 8, 1 2. ; modFV factor 100; (16) modcoupons factor semiAnnualcoupons; modliabilities factor 1 ;; 18 ;; 2 10 000, 5000, 40 000, 7000, 80 000, 12 000, 50 000, 6000, 15 000 ; The bond matrix is then also suitably modified: bondMatrix modcoupons modFV 1 , modFV 2 , ConstantArray 0, 16 Flatten , Flatten 0, 0, Drop modcoupons, 2 Flatten 0, 0, modFV 3 , modFV 4 , ConstantArray 0, 14 , Flatten 0, 0, 0, 0, Drop modcoupons, 4 Flatten 0, 0, 0, 0, modFV 5 , modFV 6 , ConstantArray 0, 12 , Flatten 0, 0, 0, 0, 0, 0, Drop modcoupons, 6 Flatten 0, 0, 0, 0, 0, 0, modFV 7 , modFV 8 , ConstantArray 0, 10 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 8 Flatten 0, 0, 0, 0, 0, 0, 0, 0, modFV 9 , modFV 10 , ConstantArray 0, 8 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 10 Flatten (17) 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 11 , modFV 12 , ConstantArray 0, 6 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 12 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 13 , modFV 14 , ConstantArray 0, 4 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 14 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 15 , modFV 16 , ConstantArray 0, 2 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 16 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, , (14)
  • 8. 8 VentureFinanceProject1.nb 0, 0, 0, 0, 0, modFV 17 , modFV 18 ; The optimization problem that is solved is then simply that the sum of the number of bonds is minimum not the cost as in previous case . solDeriv Minimize Total vars, Thread bondMatrix.vars modliabilities , Thread vars 0 , vars (18) vars . solDeriv 2 Total Answers (2 Points) a0 The objective value is 2026.87. Out[515]//TableForm= 58.8723 0. 10.2338 0. 360.458 0. 37.4415 0. 768.237 0. 103.602 0. 485.803 0. 55.5195 0. 146.699 0. a0 - a1 The objective value is 1909.30 Out[539]//TableForm= 0. 0. 0. 0. 335.968 (17) 0. 23.9821 0. 762.076 (19) 0. 100.558 0. 484.858 0.
  • 9. VentureFinanceProject1.nb 9 55.1604 0. 146.699 0. a0 - a2 The objective value is 1813.70 Out[548]//TableForm= 0. 0. 0. 0. 281.354 0. 0. 0. 751.488 0. 95.9613 0. 483.5 0. 54.6994 0. 146.699 0. a0 - a3 The objective value is 1651.34. Out[557]//TableForm= 0. 0. 0. 0. 146.535 0. 0. 0. 733.167 0. 89.1605 0. 481.638 0. 54.144 0. 146.699 (19) 0.
  • 10. 10 VentureFinanceProject1.nb a0 - a4 The objective value is 1459.58. Out[566]//TableForm= 0. 0. 0. 0. 0. 0. 0. 0. 701.08 0. 79.1567 0. 479.145 0. 53.4955 0. 146.699 0. Step 7 and 8 : Comparison of 5A, 5B and 6 and Write- Up(Maximum Points : 9) Risk (2 Points) Simple Cash Matching: An advantage is that it is simple. However, it is not robust against changes of interst rates. Complex Cash Matching: This is certainly more robust against changes in interest rates, comapred to simple cash matching as it incorporates expected interest rates. Immunization Portfolio: This is much more robust as it incorporates the changes in the parameters in the spot rate model. However, it is more complicated to implement (but much more so). In terms of risk, the immunization portfolio is definitely the best option. Cost (2 Points) In the example, the simple cash matching and complex cash matching yielded the same result. In general, the complex cash matching is preferred. The immunization portfolio was devised such that the total number of shares were the smallest. IN fact, it turned out the cost was also the smallest. In terms of cost, use immunization portfolio. Implementation in Practice (2 Points) The simple cash matching should definitely not be implemented in practise, as heavy losses are possible in uncerain times.
  • 11. VentureFinanceProject1.nb 11 Complex cash matching is more robust, but still not sufficiently robust. Immunization portfolios strongly preferred. Overall Report Style : Concise Explanations, Lack of Logic Mistakes or Numerical Inconsistencies (3 Points) Appendix: Mathematica Code Part 1 Step 1 In[587]:= ClearAll "` " ; dateMonth0 10; dateDay0 11; dateYear0 2012; dateMonthAfter 2; dateDayAfter 15; dateYearAfter 2013; dateMonthBefore 8; dateDayBefore 15; dateYearBefore 2012; numberOfDaysSinceLastCoupon DateDifference 2012, 8, 15 , 2012, 10, 11 ; numberofDaysBeforeNextCoupon DateDifference 2012, 10, 11 , 2013, 2, 15 ; numberOfDaysInCurrentCouponPeriod DateDifference 2012, 8, 15 , 2013, 2, 15 ; fraction numberOfDaysSinceLastCoupon numberOfDaysInCurrentCouponPeriod ; FV 100; coupons 4.625, 0.875, 4.375, 1.75, 3.875, 1.375, 4.25, 0.75, 4, 1.875, 4.25, 0.5, 4, 2.375, 4.25, 1.25, 4.5, 2.125 ; couponsA coupons 1 ;; Length coupons ;; 2 ; couponsB coupons 2 ;; Length coupons ;; 2 ; semiAnnualcoupons coupons 2; askPrice0 101, 100, 103, 101, 105, 101 , 107, 100, 108, 103, 110, 100, 111, 106, 113, 102, 115, 105 ; askPrice1 N 22, 4, 20, 8, 18, 18, 16, 17, 18, 12, 21, 1, 15, 9, 23, 19, 13, 9 32 ; askPrice01 N askPrice0 askPrice1 ; askPriceOriginal askPrice01; askPriceOriginalA askPriceOriginal 1 ;; Length coupons ;; 2 ; askPriceOriginalB askPriceOriginal 2 ;; Length coupons ;; 2 ; deltaAsk fraction coupons 2; askPrice askPrice01 deltaAsk; askPriceA askPrice 1 ;; Length coupons ;; 2 ; askPriceB askPrice 2 ;; Length coupons ;; 2 ; spotRate t_ : a0 a1 t a2 t ^ 2 a3 t ^ 3 a4 t ^ 4; discountRate t_ : Exp spotRate t t ;
  • 12. 12 VentureFinanceProject1.nb priceOfBondContinuous FV_, couponRate_, n_, m_: 2 : Module coupon , coupon couponRate FV m; FV discountRate n Total Table coupon discountRate ii , ii, 1 m, n, 1 m tillFirst numberofDaysBeforeNextCoupon 365; modelA priceOfBondContinuous 100, couponsA 100, tillFirst 2 & Range 1 , 9, 1 ; modelB priceOfBondContinuous 100, couponsB 100, tillFirst 2 & Range 1 , 9 , 1 ; sol NMinimize modelA askPriceA ^ 2 modelB askPriceB ^ 2 Total, a0 0.0 , a0, a1, a2, a3, a4 inds a0, a1, a2, a3, a4 . sol 2 ; ft Total inds .Table t ^ ii 1 , ii, 1, 5 ; spotRatesAnalytical Table ft . t ii , ii, 0, 4, 0.5 pl1 ListLinePlot spotRatesAnalytical, Frame True, PlotRange All, PlotStyle Red ; Print "Step 2:" ; zeroCoupon couponsB couponsA askPriceOriginalA askPriceOriginalB; portfolioFaceValue couponsB couponsA 1 100; spotRates Flatten Table Solve s 2 ii 1 tillFirst Log portfolioFaceValue ii zeroCoupon ii , s , ii, 2, 9 All, 2 ; spotRates tillFirst .01 0.5 couponsA couponsB 1 , spotRates Flatten; pl2 ListLinePlot spotRates, Frame True, PlotRange All, PlotStyle Green ; Show pl1, pl2 termStructure t_ Total inds .Table t ^ ii 1 , ii, 1, 5 ; Plot Evaluate termStructure t tillFirst , t, 0, 5 Out[622]= 0.629816, a0 0.0134751, a1 0.0259828, a2 0.0167159, a3 0.00412212, a4 0.00035758 Out[625]= 0.0134751, 0.00416979, 0.000443666, 9.74682 10 6 , 0.00111736, 0.00255222, 0.00363639, 0.00422831, 0.00472279 Step 2: 0.012 0.010 0.008 Out[633]= 0.006 0.004 0.002 0.000 0 2 4 6 8
  • 13. VentureFinanceProject1.nb 13 0.014 0.012 0.010 0.008 Out[635]= 0.006 0.004 0.002 1 2 3 4 5 In[649]:= zeroCoupon Out[649]= 80.8868, 59.8, 64.1048, 81.5607, 52.4863, 87.0129, 40.0967, 69.1471, 50.7839 In[443]:= priceOfBondContinuous 100, couponsA 100, tillFirst 2 & 0, 1, 3, 4 . sol 2 ListLinePlot askPriceB priceOfBondContinuous 100, couponsB 100, tillFirst 2 & Range 0, 8, 1 . sol 2 Out[443]= 99.7814, 102.212, 105.678, 107.99 6 4 2 Out[444]= 2 4 6 8 2
  • 14. 14 VentureFinanceProject1.nb In[445]:= liabilities 10 000, 5000, 40 000, 7000, 80 000, 12 000, 50 000, 6000, 15 000 ; vars Array a, 18 ; bondMatrix semiAnnualcoupons 100, 100, ConstantArray 0, 16 Flatten , Flatten 0, 0, Drop semiAnnualcoupons, 2 Flatten 0, 0, 100, 100, ConstantArray 0, 14 , Flatten 0, 0, 0, 0, Drop semiAnnualcoupons, 4 Flatten 0, 0, 0, 0, 100, 100, ConstantArray 0, 12 , Flatten 0, 0, 0, 0, 0, 0, Drop semiAnnualcoupons, 6 Flatten 0, 0, 0, 0, 0, 0, 100, 100, ConstantArray 0, 10 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, Drop semiAnnualcoupons, 8 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 100, 100, ConstantArray 0, 8 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop semiAnnualcoupons, 10 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 100, ConstantArray 0, 6 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop semiAnnualcoupons, 12 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 100, ConstantArray 0, 4 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop semiAnnualcoupons, 14 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 100, ConstantArray 0, 2 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop semiAnnualcoupons, 16 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 100 ; solSimp Minimize vars.askPrice, Thread bondMatrix.vars liabilities , Thread vars 0 , vars Chop bondMatrix.vars liabilities . solSimp 2 vars . solSimp 2 Total Out[448]= 222 207., a 1 0., a 2 74.933, a 3 0., a 4 25.2608, a 5 0., a 6 375.482, a 7 0., a 8 48.0633, a 9 0., a 10 778.244, a 11 0., a 12 105.54, a 13 485.803, a 14 0., a 15 55.5195, a 16 0., a 17 146.699, a 18 0. Out[449]= 0, 0, 0, 0, 0, 0, 0, 0, 0 Out[450]= 2095.54 In[451]:= solLPV LinearProgramming askPrice, bondMatrix, liabilities Chop bondMatrix.vars liabilities . Thread vars solLPV Out[451]= 0., 74.933, 0., 25.2608, 0., 375.482, 0., 48.0633, 0., 778.244, 0., 105.54, 485.803, 0., 55.5195, 0., 146.699, 0. Out[452]= 0, 0, 0, 0, 0, 0, 0, 0, 0 In[453]:= bondMatrix MatrixForm Out[453]//MatrixForm= 102.313 100.438 2.1875 0.875 1.9375 0.6875 2.125 0.375 2 0.9375 2.125 0.25 0 0 102.188 100.875 1.9375 0.6875 2.125 0.375 2 0.9375 2.125 0.25 0 0 0 0 101.938 100.688 2.125 0.375 2 0.9375 2.125 0.25 0 0 0 0 0 0 102.125 100.375 2 0.9375 2.125 0.25 0 0 0 0 0 0 0 0 102 100.938 2.125 0.25 0 0 0 0 0 0 0 0 0 0 102.125 100.25 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  • 15. VentureFinanceProject1.nb 15 In[456]:= bM bondMatrix.vars liabilities; simpleMatching bM 1 0, bM 1 bM 2 0, bM 1 bM 2 bM 3 0, bM 1 bM 2 bM 3 bM 4 0, bM 1 bM 2 bM 3 bM 4 bM 5 0, bM 1 bM 2 bM 3 bM 4 bM 5 bM 6 0, bM 1 bM 2 bM 3 bM 4 bM 5 bM 6 bM 7 0, bM 1 bM 2 bM 3 bM 4 bM 5 bM 6 bM 7 bM 8 0, bM 1 bM 2 bM 3 bM 4 bM 5 bM 6 bM 7 bM 8 bM 9 0 ; solutionSimpleMatching NMinimize vars.askPrice, Flatten simpleMatching, Thread vars 0 , vars Chop bondMatrix.vars liabilities . solutionSimpleMatching 2 Out[458]= 222 207., a 1 0., a 2 74.933, a 3 0., a 4 25.2608, a 5 0., a 6 375.482, a 7 0., a 8 48.0633, a 9 0., a 10 778.244, a 11 0., a 12 105.54, a 13 485.803, a 14 0., a 15 55.5195, a 16 0., a 17 146.699, a 18 0. Out[459]= 0, 0, 0, 0, 0, 0, 0, 0, 0 In[481]:= spotRatesAnalytical Table ft . t ii , ii, 0, 4, 0.5 discounts Exp spotRatesAnalytical 0.5 Out[481]= 0.0134751, 0.00416979, 0.000443666, 9.74682 10 6 , 0.00111736, 0.00255222, 0.00363639, 0.00422831, 0.00472279 Out[482]= 0.993285, 0.997917, 0.999778, 0.999995, 0.999441, 0.998725, 0.998183, 0.997888, 0.997641
  • 16. 16 VentureFinanceProject1.nb In[516]:= bM bondMatrix.vars liabilities; simpleMatching discounts 1 bM 1 0, discounts 2 bM 1 bM 2 0, discounts 3 discounts 2 bM 1 bM 2 bM 3 0, discounts 4 discounts 3 discounts 2 bM 1 bM 2 bM 3 bM 4 0, discounts 5 discounts 4 discounts 3 discounts 2 bM 1 bM 2 bM 3 bM 4 bM 5 0, discounts 6 discounts 5 discounts 4 discounts 3 discounts 2 bM 1 bM 2 bM 3 bM 4 bM 5 bM 6 0, discounts 7 discounts 6 discounts 5 discounts 4 discounts 3 discounts 2 bM 1 bM 2 bM 3 bM 4 bM 5 bM 6 bM 7 0, discounts 8 discounts 7 discounts 6 discounts 5 discounts 4 discounts 3 discounts 2 bM 1 bM 2 bM 3 bM 4 bM 5 bM 6 bM 7 bM 8 0, discounts 9 discounts 8 discounts 7 discounts 6 discounts 5 discounts 4 discounts 3 discounts 2 bM 1 bM 2 bM 3 bM 4 bM 5 bM 6 bM 7 bM 8 bM 9 0 ; solutionSimpleMatching NMinimize vars.askPrice, Flatten simpleMatching, Thread vars 0 , vars Chop bondMatrix.vars liabilities . solutionSimpleMatching 2 vars . solutionSimpleMatching 2 Total vars . solutionSimpleMatching 2 TableForm Out[518]= 222 207., a 1 0., a 2 74.933, a 3 0., a 4 25.2608, a 5 0., a 6 375.482, a 7 0., a 8 48.0633, a 9 0., a 10 778.244, a 11 0., a 12 105.54, a 13 485.803, a 14 0., a 15 55.5195, a 16 0., a 17 146.699, a 18 0. Out[519]= 0, 0, 0, 0, 0, 0, 0, 0, 0 Out[520]= 2095.54 Out[521]//TableForm= 0. 74.933 0. 25.2608 0. 375.482 0. 48.0633 0. 778.244 0. 105.54 485.803 0. 55.5195 0. 146.699 0.
  • 17. VentureFinanceProject1.nb 17 a0 - a1 bM bondMatrix.vars liabilities; simpleMatching discounts 1 bM 1 0, discounts 2 bM 1 bM 2 0, discounts 3 discounts 2 bM 1 bM 2 bM 3 0, discounts 4 discounts 3 discounts 2 bM 1 bM 2 bM 3 bM 4 0, discounts 5 discounts 4 discounts 3 discounts 2 bM 1 bM 2 bM 3 bM 4 bM 5 0, discounts 6 discounts 5 discounts 4 discounts 3 discounts 2 bM 1 bM 2 bM 3 bM 4 bM 5 bM 6 0, discounts 7 discounts 6 discounts 5 discounts 4 discounts 3 discounts 2 bM 1 bM 2 bM 3 bM 4 bM 5 bM 6 bM 7 0, discounts 8 discounts 7 discounts 6 discounts 5 discounts 4 discounts 3 discounts 2 bM 1 bM 2 bM 3 bM 4 bM 5 bM 6 bM 7 bM 8 0, discounts 9 discounts 8 discounts 7 discounts 6 discounts 5 discounts 4 discounts 3 discounts 2 bM 1 bM 2 bM 3 bM 4 bM 5 bM 6 bM 7 bM 8 bM 9 0 ; solutionSimpleMatching NMinimize vars.askPrice, Flatten simpleMatching, Thread vars 0 , vars Chop bondMatrix.vars liabilities . solutionSimpleMatching 2 vars . solutionSimpleMatching 2 Total vars . solutionSimpleMatching 2 TableForm discountRate t t a0 a1 t a2 t2 a3 t3 a4 t4 D F discountRate t , a0 t a0 a1 t a2 t2 a3 t3 a4 t4 Ft discountRate tk tk a0 a1 t k a2 t2 a3 t3 a4 t4 k k k
  • 18. 18 VentureFinanceProject1.nb n tN a0 a1 t N a2 t2 a3 t3 a4 t4 tk a0 a1 t k a2 t2 a3 t3 a4 t4 PV tN tN F N N N tk Ck k k k , a0 k 1 n a0 a1 t N a2 t2 a3 t3 a4 t4 a0 a1 t k a2 t2 a3 t3 a4 t4 PV tN tN 2 F tN N N N tk 2 Ck tk k k k , a1 k 1 n a0 a1 t N a2 t2 a3 t3 a4 t4 a0 a1 t k a2 t2 a3 t3 a4 t4 PV tN tN 3 F tN N N N tk 3 Ck tk k k k , a2 k 1 n a0 a1 t N a2 t2 a3 t3 a4 t4 a0 a1 t k a2 t2 a3 t3 a4 t4 PV tN tN 4 F tN N N N tk 4 Ck tk k k k , a3 k 1 n a0 a1 t N a2 t2 a3 t3 a4 t4 a0 a1 t k a2 t2 a3 t3 a4 t4 PV tN tN 5 F tN N N N tk 5 Ck tk k k k . a4 k 1 0., 0., 0.5, 0.5, 1., 1., 1.5, 1.5, 2., 2., 2.5, 2.5, 3., 3., 3.5, 3.5, 4., 4. modliabilities 10 000, 5000, 40 000, 7000, 80 000, 12 000, 50 000, 6000, 15 000 1., 1., 1.5, 1.5, 2., 2., 2.5, 2.5, 3., 3., 3.5, 3.5, 4., 4., 4.5, 4.5, 5., 5. It is as if appropriate powers of t are applied to the coupon and face value.
  • 19. VentureFinanceProject1.nb 19 a0 In[522]:= factor ConstantArray 1, 18 0 tis 0 tis ^ 2 0 tis ^ 3 0 tis ^ 4 ; modliabilities factor 1 ;; 18 ;; 2 10 000, 5000, 40 000, 7000, 80 000, 12 000, 50 000, 6000, 15 000 ; vars Array a, 18 ; tis Riffle Range 0, 8, 1 2., Range 0, 8, 1 2. ; modFV factor 100; modcoupons factor semiAnnualcoupons; bondMatrix modcoupons modFV 1 , modFV 2 , ConstantArray 0, 16 Flatten , Flatten 0, 0, Drop modcoupons, 2 Flatten 0, 0, modFV 3 , modFV 4 , ConstantArray 0, 14 , Flatten 0, 0, 0, 0, Drop modcoupons, 4 Flatten 0, 0, 0, 0, modFV 5 , modFV 6 , ConstantArray 0, 12 , Flatten 0, 0, 0, 0, 0, 0, Drop modcoupons, 6 Flatten 0, 0, 0, 0, 0, 0, modFV 7 , modFV 8 , ConstantArray 0, 10 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 8 Flatten 0, 0, 0, 0, 0, 0, 0, 0, modFV 9 , modFV 10 , ConstantArray 0, 8 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 10 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 11 , modFV 12 , ConstantArray 0, 6 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 12 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 13 , modFV 14 , ConstantArray 0, 4 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 14 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 15 , modFV 16 , ConstantArray 0, 2 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 16 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 17 , modFV 18 ; solSimp Minimize vars.askPrice, Thread bondMatrix.vars modliabilities ,Thread vars 0 ,vars Chop bondMatrix.vars liabilities .solSimp 2 solDeriv Minimize Total vars, Thread bondMatrix.vars modliabilities , Thread vars 0 , vars vars . solDeriv 2 TableForm
  • 20. 20 VentureFinanceProject1.nb Out[530]//TableForm= 58.8723 0. 10.2338 0. 360.458 0. 37.4415 0. 768.237 0. 103.602 0. 485.803 0. 55.5195 0. 146.699 0. Out[529]= 2026.87, a 1 58.8723, a 2 0., a 3 10.2338, a 4 0., a 5 360.458, a 6 0., a 7 37.4415, a 8 0., a 9 768.237, a 10 0., a 11 103.602, a 12 0., a 13 485.803, a 14 0., a 15 55.5195, a 16 0., a 17 146.699, a 18 0. 2026.87, a 1 58.8723, a 2 0., a 3 10.2338, a 4 0., a 5 360.458, a 6 0., a 7 37.4415, a 8 0., a 9 768.237, a 10 0., a 11 103.602, a 12 0., a 13 485.803, a 14 0., a 15 55.5195, a 16 0., a 17 146.699, a 18 0. 58.8723 0. 10.2338 0. 360.458 0. 37.4415 0. 768.237 0. 103.602 0. 485.803 0. 55.5195 0. 146.699 0.
  • 21. VentureFinanceProject1.nb 21 a0 - a1 In[531]:= factor ConstantArray 1, 18 tis 0 tis ^ 2 0 tis ^ 3 0 tis ^ 4 ; modliabilities factor 1 ;; 18 ;; 2 10 000, 5000, 40 000, 7000, 80 000, 12 000, 50 000, 6000, 15 000 ; vars Array a, 18 ; tis Riffle Range 0, 8, 1 2., Range 0, 8, 1 2. ; modFV factor 100; modcoupons factor semiAnnualcoupons; bondMatrix modcoupons modFV 1 , modFV 2 , ConstantArray 0, 16 Flatten , Flatten 0, 0, Drop modcoupons, 2 Flatten 0, 0, modFV 3 , modFV 4 , ConstantArray 0, 14 , Flatten 0, 0, 0, 0, Drop modcoupons, 4 Flatten 0, 0, 0, 0, modFV 5 , modFV 6 , ConstantArray 0, 12 , Flatten 0, 0, 0, 0, 0, 0, Drop modcoupons, 6 Flatten 0, 0, 0, 0, 0, 0, modFV 7 , modFV 8 , ConstantArray 0, 10 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 8 Flatten 0, 0, 0, 0, 0, 0, 0, 0, modFV 9 , modFV 10 , ConstantArray 0, 8 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 10 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 11 , modFV 12 , ConstantArray 0, 6 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 12 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 13 , modFV 14 , ConstantArray 0, 4 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 14 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 15 , modFV 16 , ConstantArray 0, 2 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 16 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 17 , modFV 18 ; solSimp Minimize vars.askPrice, Thread bondMatrix.vars modliabilities ,Thread vars 0 ,vars Chop bondMatrix.vars liabilities .solSimp 2 solDeriv Minimize Total vars, Thread bondMatrix.vars modliabilities , Thread vars 0 , vars vars . solDeriv 2 TableForm Out[538]= 1909.3, a 1 0., a 2 0., a 3 0., a 4 0., a 5 335.968, a 6 0., a 7 23.9821, a 8 0., a 9 762.076, a 10 0., a 11 100.558, a 12 0., a 13 484.858, a 14 0., a 15 55.1604, a 16 0., a 17 146.699, a 18 0.
  • 22. 22 VentureFinanceProject1.nb Out[539]//TableForm= 0. 0. 0. 0. 335.968 0. 23.9821 0. 762.076 0. 100.558 0. 484.858 0. 55.1604 0. 146.699 0.
  • 23. VentureFinanceProject1.nb 23 a0 - a2 In[540]:= factor ConstantArray 1, 18 tis tis ^ 2 0 tis ^ 3 0 tis ^ 4 ; modliabilities factor 1 ;; 18 ;; 2 10 000, 5000, 40 000, 7000, 80 000, 12 000, 50 000, 6000, 15 000 ; vars Array a, 18 ; tis Riffle Range 0, 8, 1 2., Range 0, 8, 1 2. ; modFV factor 100; modcoupons factor semiAnnualcoupons; bondMatrix modcoupons modFV 1 , modFV 2 , ConstantArray 0, 16 Flatten , Flatten 0, 0, Drop modcoupons, 2 Flatten 0, 0, modFV 3 , modFV 4 , ConstantArray 0, 14 , Flatten 0, 0, 0, 0, Drop modcoupons, 4 Flatten 0, 0, 0, 0, modFV 5 , modFV 6 , ConstantArray 0, 12 , Flatten 0, 0, 0, 0, 0, 0, Drop modcoupons, 6 Flatten 0, 0, 0, 0, 0, 0, modFV 7 , modFV 8 , ConstantArray 0, 10 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 8 Flatten 0, 0, 0, 0, 0, 0, 0, 0, modFV 9 , modFV 10 , ConstantArray 0, 8 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 10 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 11 , modFV 12 , ConstantArray 0, 6 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 12 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 13 , modFV 14 , ConstantArray 0, 4 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 14 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 15 , modFV 16 , ConstantArray 0, 2 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 16 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 17 , modFV 18 ; solSimp Minimize vars.askPrice, Thread bondMatrix.vars modliabilities ,Thread vars 0 ,vars Chop bondMatrix.vars liabilities .solSimp 2 solDeriv Minimize Total vars, Thread bondMatrix.vars modliabilities , Thread vars 0 , vars vars . solDeriv 2 TableForm Out[547]= 1813.7, a 1 0., a 2 0., a 3 0., a 4 0., a 5 281.354, a 6 0., a 7 0., a 8 0., a 9 751.488, a 10 0., a 11 95.9613, a 12 0., a 13 483.5, a 14 0., a 15 54.6994, a 16 0., a 17 146.699, a 18 0.
  • 24. 24 VentureFinanceProject1.nb Out[548]//TableForm= 0. 0. 0. 0. 281.354 0. 0. 0. 751.488 0. 95.9613 0. 483.5 0. 54.6994 0. 146.699 0.
  • 25. VentureFinanceProject1.nb 25 a0 - a3 In[549]:= factor ConstantArray 1, 18 tis tis ^ 2 tis ^ 3 0 tis ^ 4 ; modliabilities factor 1 ;; 18 ;; 2 10 000, 5000, 40 000, 7000, 80 000, 12 000, 50 000, 6000, 15 000 ; vars Array a, 18 ; tis Riffle Range 0, 8, 1 2., Range 0, 8, 1 2. ; modFV factor 100; modcoupons factor semiAnnualcoupons; bondMatrix modcoupons modFV 1 , modFV 2 , ConstantArray 0, 16 Flatten , Flatten 0, 0, Drop modcoupons, 2 Flatten 0, 0, modFV 3 , modFV 4 , ConstantArray 0, 14 , Flatten 0, 0, 0, 0, Drop modcoupons, 4 Flatten 0, 0, 0, 0, modFV 5 , modFV 6 , ConstantArray 0, 12 , Flatten 0, 0, 0, 0, 0, 0, Drop modcoupons, 6 Flatten 0, 0, 0, 0, 0, 0, modFV 7 , modFV 8 , ConstantArray 0, 10 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 8 Flatten 0, 0, 0, 0, 0, 0, 0, 0, modFV 9 , modFV 10 , ConstantArray 0, 8 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 10 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 11 , modFV 12 , ConstantArray 0, 6 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 12 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 13 , modFV 14 , ConstantArray 0, 4 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 14 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 15 , modFV 16 , ConstantArray 0, 2 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 16 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 17 , modFV 18 ; solSimp Minimize vars.askPrice, Thread bondMatrix.vars modliabilities ,Thread vars 0 ,vars Chop bondMatrix.vars liabilities .solSimp 2 solDeriv Minimize Total vars, Thread bondMatrix.vars modliabilities , Thread vars 0 , vars vars . solDeriv 2 TableForm Out[556]= 1651.34, a 1 0., a 2 0., a 3 0., a 4 0., a 5 146.535, a 6 0., a 7 0., a 8 0., a 9 733.167, a 10 0., a 11 89.1605, a 12 0., a 13 481.638, a 14 0., a 15 54.144, a 16 0., a 17 146.699, a 18 0.
  • 26. 26 VentureFinanceProject1.nb Out[557]//TableForm= 0. 0. 0. 0. 146.535 0. 0. 0. 733.167 0. 89.1605 0. 481.638 0. 54.144 0. 146.699 0.
  • 27. VentureFinanceProject1.nb 27 a0 - a4 In[577]:= factor ConstantArray 1, 18 tis tis ^ 2 tis ^ 3 tis ^ 4 ; modliabilities factor 1 ;; 18 ;; 2 10 000, 5000, 40 000, 7000, 80 000, 12 000, 50 000, 6000, 15 000 ; vars Array a, 18 ; tis Riffle Range 0, 8, 1 2., Range 0, 8, 1 2. ; modFV factor 100; modcoupons factor semiAnnualcoupons; bondMatrix modcoupons modFV 1 , modFV 2 , ConstantArray 0, 16 Flatten , Flatten 0, 0, Drop modcoupons, 2 Flatten 0, 0, modFV 3 , modFV 4 , ConstantArray 0, 14 , Flatten 0, 0, 0, 0, Drop modcoupons, 4 Flatten 0, 0, 0, 0, modFV 5 , modFV 6 , ConstantArray 0, 12 , Flatten 0, 0, 0, 0, 0, 0, Drop modcoupons, 6 Flatten 0, 0, 0, 0, 0, 0, modFV 7 , modFV 8 , ConstantArray 0, 10 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 8 Flatten 0, 0, 0, 0, 0, 0, 0, 0, modFV 9 , modFV 10 , ConstantArray 0, 8 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 10 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 11 , modFV 12 , ConstantArray 0, 6 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 12 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 13 , modFV 14 , ConstantArray 0, 4 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 14 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 15 , modFV 16 , ConstantArray 0, 2 , Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Drop modcoupons, 16 Flatten 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, modFV 17 , modFV 18 ; solSimp Minimize vars.askPrice, Thread bondMatrix.vars modliabilities ,Thread vars 0 ,vars Chop bondMatrix.vars liabilities .solSimp 2 solDeriv Minimize Total vars, Thread bondMatrix.vars modliabilities , Thread vars 0 , vars vars . solDeriv 2 TableForm vars . solDeriv 2 . askPrice Out[584]= 1459.58, a 1 0., a 2 0., a 3 0., a 4 0., a 5 0., a 6 0., a 7 0., a 8 0., a 9 701.08, a 10 0., a 11 79.1567, a 12 0., a 13 479.145, a 14 0., a 15 53.4955, a 16 0., a 17 146.699, a 18 0.
  • 28. 28 VentureFinanceProject1.nb Out[585]//TableForm= 0. 0. 0. 0. 0. 0. 0. 0. 701.08 0. 79.1567 0. 479.145 0. 53.4955 0. 146.699 0. Out[586]= 162 214. Part 0 : Chapter 4, Exercise 4 ClearAll "` " ; dateMonth0 11; dateDay0 5; dateYear0 2011; dateMonthAfter 2; dateDayAfter 15; dateYearAfter 2012; dateMonthBefore 8; dateDayBefore 15; dateYearBefore 2011; numberOfDaysSinceLastCoupon DateDifference 2012, 8, 15 , 2012, 10, 11 ; numberofDaysBeforeNextCoupon DateDifference 2012, 10, 11 , 2013, 2, 15 ; numberOfDaysInCurrentCouponPeriod DateDifference 2012, 8, 15 , 2013, 2, 15 ; fraction numberOfDaysSinceLastCoupon numberOfDaysInCurrentCouponPeriod ; FV 100; askPrice0 100, 100, 100, 101, 101, 101, 100, 102, 98, 102, 97, 101, 99, 109, 101, 107, 99, 103 ; askPrice1 0, 22, 24, 1, 7, 12, 26, 1, 5, 9, 13, 23, 5, 4, 13, 27, 13, 0 32; askPrice01 N askPrice0 askPrice1 ; coupons0 6, 9, 7, 8, 8, 8, 8, 8, 6, 8, 6, 8, 7, 11, 8, 10, 7, 8 ; coupons1 5 8, 1 8, 7 8, 1 4, 1 4, 3 8, 0, 3 4, 7 8, 7 8, 7 8, 5 8, 3 4, 1 4, 1 2, 1 2, 7 8, 7 8 ; coupons N coupons0 coupons1 ; couponsA coupons 1 ;; Length coupons ;; 2 ; couponsB coupons 2 ;; Length coupons ;; 2 ; deltaAsk DateDifference 2011, 8, 15 , 2011, 11, 5 DateDifference 2011, 8, 5 , 2012, 2, 15 coupons 2;
  • 29. VentureFinanceProject1.nb 29 numberofDaysBeforeNextCoupon DateDifference 2012,10,11 , 2013,2,15 ; askPrice askPrice01 deltaAsk; askPriceA askPrice 1 ;; Length coupons ;; 2 ; askPriceB askPrice 2 ;; Length coupons ;; 2 ; tillFirst numberofDaysBeforeNextCoupon 365; spotRate t_ : a0 a1 t a2 t ^ 2 a3 t ^ 3 a4 t ^ 4; discountRate t_ : Exp spotRate t t ; priceOfBondContinuous FV_, couponRate_, n_, m_: 2 : Module nterms, coupon , coupon couponRate FV m; nterms n m; FV discountRate n Total Table coupon discountRate ii , ii, 1 m, n, 1 m priceOfBondContinuous 100,6.25 100,1 2 priceOfBondContinuous 100,6.25 100,1 priceOfBondContinuous 100,6.25 100,2 modelA discountRate .275 priceOfBondContinuous 100, couponsA 100, 2 & Range 1, 9, 1 ; modelB discountRate .275 priceOfBondContinuous 100, couponsB 100, 2 & Range 1, 9, 1 ; sol NMinimize modelA askPriceA ^ 2 modelB askPriceB ^ 2 Total, a0 0 , a0, a1, a2, a3, a4 inds a0, a1, a2, a3, a4 . sol 2 ft Total inds .Table t ^ ii 1 , ii, 1, 5 pl1 ListLinePlot Table ft . t ii , ii, 0, 4, 0.5 , Frame True, PlotRange All, PlotStyle Red ; zeroCoupon couponsB couponsA askPriceA askPriceB portfolioFaceValue couponsB couponsA 1 100 spotRates Flatten Table Solve s 2 ii 1 Log portfolioFaceValue ii zeroCoupon ii ,s , ii,2,8 All,2 ; spotRates Flatten Table Solve s 2 ii 1 tillFirst Log portfolioFaceValue ii zeroCoupon ii , s , ii, 2, 9 All, 2 ; spotRates 0.30978260869565216` .01 couponsA couponsB 1 2, spotRates Flatten pl2 ListLinePlot spotRates, Frame True, PlotRange All ; Show pl1, pl2 0.237341, a0 0., a1 0.0754916, a2 0.0336651, a3 0.00720111, a4 0.000585291 0., 0.0754916, 0.0336651, 0.00720111, 0.000585291 0. 0.0754916 t 0.0336651 t2 0.00720111 t3 0.000585291 t4 37.0483, 4.51637, 1.37737, 8.23242, 24.4295, 20.4818, 34.8115, 17.4228, 9.02927 37.7358, 4.7619, 1.51515, 9.375, 29.0909, 25.4545, 45.1613, 23.5294, 12.6984 0.0243954, 0.0785483, 0.0812127, 0.0776395, 0.0803287, 0.0812861, 0.0820085, 0.0817839, 0.0816982
  • 30. 30 VentureFinanceProject1.nb 0.08 0.06 0.04 0.02 0.00 0 2 4 6 8