problem formulation writeup for quantlib examples

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

problem formulation writeup for quantlib examples

svangipu
hi

i am trying to present quantlib examples to some of my friends who are
not much of programmers. I found the problem forumation document for
DiscreteHedging Example written by Derman and kamal very useful for
making a presentation like this. Are there similar documents like this
for the other examples?.  perhaps the originator of these examples
might have some links or writeups.

thanks


Reply | Threaded
Open this post in threaded view
|

Another tree question...

Luca Berardi
Hi

I have another question regarding how trinomial trees are constructed.
The following piece of code writes to the output for each time
of the tree the corresponding number of nodes:

        std::vector<Time> times = swaption.mandatoryTimes();
        std::sort(times.begin(),times.end());
        TimeGrid timeGrid(times.begin(), times.end(), timeSteps_);
        // model_ is a shared ptr to a Hull-White model
        lattice = model_->tree(timeGrid);

        std::ofstream out("c:/temp/debugLattice.txt");
        out << "Hull-White parameters:   "
              << hwModel->params() << "\n" << std::endl;
        for( Size i=0; i < timeGrid.size(); i++ )
          out   << "i = " << i << "\t\t"
                << "t = " << timeGrid[i] << "\t\t"
                << "size(i) = " << lattice->size(i)
                << std::endl;

I expect that if we are at time indexed by the integer variable i, the
corresponding number of nodes is 2*i+1. However the output of the code
above shows that the trinomial tree is not constructed in this way
(see below).
Why is that so? Is there some kind of error?

Ciao,
Luca

The output of the preceding section of code follows:

Hull-White parameters:   [ 0.015259 ; 0.006385 ]

i = 0 t = 0 size(i) = 1
i = 1 t = 0.0947945 size(i) = 3
i = 2 t = 0.189589 size(i) = 5
i = 3 t = 0.284384 size(i) = 7
i = 4 t = 0.379178 size(i) = 9
i = 5 t = 0.473973 size(i) = 11
i = 6 t = 0.568767 size(i) = 13
i = 7 t = 0.663562 size(i) = 15
i = 8 t = 0.758356 size(i) = 17
i = 9 t = 0.853151 size(i) = 19
i = 10 t = 0.947945 size(i) = 21
i = 11 t = 1.06986 size(i) = 21
i = 12 t = 1.19178 size(i) = 23
i = 13 t = 1.2758 size(i) = 29
i = 14 t = 1.35982 size(i) = 31
i = 15 t = 1.44384 size(i) = 33
i = 16 t = 1.52785 size(i) = 35
i = 17 t = 1.61187 size(i) = 37
i = 18 t = 1.69589 size(i) = 39
i = 19 t = 1.80137 size(i) = 37
i = 20 t = 1.90685 size(i) = 39
i = 21 t = 1.94795 size(i) = 63
i = 22 t = 2.06986 size(i) = 39
i = 23 t = 2.19178 size(i) = 41
i = 24 t = 2.2758 size(i) = 51
i = 25 t = 2.35982 size(i) = 53
i = 26 t = 2.44384 size(i) = 55
i = 27 t = 2.52785 size(i) = 57
i = 28 t = 2.61187 size(i) = 59
i = 29 t = 2.69589 size(i) = 61
i = 30 t = 2.80137 size(i) = 57
i = 31 t = 2.90685 size(i) = 59
i = 32 t = 2.94795 size(i) = 95
i = 33 t = 2.95342 size(i) = 261
i = 34 t = 3.07397 size(i) = 59
i = 35 t = 3.19452 size(i) = 61
i = 36 t = 3.28037 size(i) = 73
i = 37 t = 3.36621 size(i) = 75
i = 38 t = 3.45205 size(i) = 77
i = 39 t = 3.53516 size(i) = 81
i = 40 t = 3.61826 size(i) = 83
i = 41 t = 3.70137 size(i) = 85
i = 42 t = 3.80685 size(i) = 77
i = 43 t = 3.91233 size(i) = 79
i = 44 t = 3.95068 size(i) = 133
i = 45 t = 4.03379 size(i) = 93
i = 46 t = 4.11689 size(i) = 95
i = 47 t = 4.2 size(i) = 97
i = 48 t = 4.28311 size(i) = 99
i = 49 t = 4.36621 size(i) = 101
i = 50 t = 4.44932 size(i) = 103
i = 51 t = 4.53242 size(i) = 105
i = 52 t = 4.61553 size(i) = 107
i = 53 t = 4.69863 size(i) = 109
i = 54 t = 4.80411 size(i) = 99
i = 55 t = 4.90959 size(i) = 101
i = 56 t = 4.95068 size(i) = 163
i = 57 t = 5.07397 size(i) = 97
i = 58 t = 5.19726 size(i) = 99
i = 59 t = 5.28037 size(i) = 123
i = 60 t = 5.36347 size(i) = 125
i = 61 t = 5.44658 size(i) = 127
i = 62 t = 5.53059 size(i) = 129
i = 63 t = 5.61461 size(i) = 131
i = 64 t = 5.69863 size(i) = 133
i = 65 t = 5.80411 size(i) = 121
i = 66 t = 5.90959 size(i) = 123
i = 67 t = 5.95068 size(i) = 199
i = 68 t = 6.0726 size(i) = 117
i = 69 t = 6.19452 size(i) = 119
i = 70 t = 6.27854 size(i) = 145
i = 71 t = 6.36256 size(i) = 147
i = 72 t = 6.44658 size(i) = 149
i = 73 t = 6.53059 size(i) = 151
i = 74 t = 6.61461 size(i) = 153
i = 75 t = 6.69863 size(i) = 155
i = 76 t = 6.80411 size(i) = 141
i = 77 t = 6.90959 size(i) = 143
i = 78 t = 6.95068 size(i) = 231
i = 79 t = 7.07397 size(i) = 135
i = 80 t = 7.19726 size(i) = 137
i = 81 t = 7.28128 size(i) = 167
i = 82 t = 7.3653 size(i) = 169
i = 83 t = 7.44932 size(i) = 171
i = 84 t = 7.53333 size(i) = 173
i = 85 t = 7.61735 size(i) = 175
i = 86 t = 7.70137 size(i) = 177
i = 87 t = 7.80685 size(i) = 159
i = 88 t = 7.91233 size(i) = 161
i = 89 t = 7.95342 size(i) = 259
i = 90 t = 7.9589 size(i) = 709
i = 91 t = 8.07808 size(i) = 155
i = 92 t = 8.19726 size(i) = 157
i = 93 t = 8.28128 size(i) = 189
i = 94 t = 8.3653 size(i) = 191
i = 95 t = 8.44932 size(i) = 193
i = 96 t = 8.53516 size(i) = 193
i = 97 t = 8.621 size(i) = 195
i = 98 t = 8.70685 size(i) = 197
i = 99 t = 8.81233 size(i) = 179
i = 100 t = 8.91781 size(i) = 181
i = 101 t = 8.95342 size(i) = 313
i = 102 t = 8.95616 size(i) = 1127
i = 103 t = 9.07671 size(i) = 173
i = 104 t = 9.19726 size(i) = 175
i = 105 t = 9.28311 size(i) = 209
i = 106 t = 9.36895 size(i) = 211
i = 107 t = 9.45479 size(i) = 213
i = 108 t = 9.5379 size(i) = 219
i = 109 t = 9.621 size(i) = 221
i = 110 t = 9.70411 size(i) = 223
i = 111 t = 9.78721 size(i) = 225
i = 112 t = 9.87032 size(i) = 227
i = 113 t = 9.95342 size(i) = 229



__________________________________________________________________
Tiscali Adsl 3 Mega Flat con 3 MESI GRATIS!
Con Tiscali Adsl 3 Mega Flat navighi con la supervelocita'
a soli 29.95 euro al mese, senza limiti di tempo. E se attivi
entro il 15 Marzo, 3 MESI sono GRATIS!
Scopri come su http://abbonati.tiscali.it/adsl/