1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| Sub CPPI()
Dim Garantie As Integer, PF As Integer, T As Integer, m As Integer, i As Integer, Pas As Integer
Dim R As Double, S As Double, So As Double, Mu As Double, Sigm As Double, dT As Double, Cash As Double
Dim Coussin As Double, Exposition As Double, Eps As Double, Sminus1 As Double, Sigma As Double
Dim tPrix() As Double, tCoussin() As Double, tExposition() As Double, tCash() As Double, tPorteFeuille() As Double
Garantie = 100: PF = 100: So = 100: T = 1: m = 3
R = 0.05: Mu = 0.1: Sigma = 0.2: Pas = 52
dT = T / Pas
ReDim tPrix(1 To Pas, 1 To 1): ReDim tCoussin(1 To Pas, 1 To 1): ReDim tExposition(1 To Pas, 1 To 1)
ReDim tCash(1 To Pas, 1 To 1): ReDim tPorteFeuille(1 To Pas, 1 To 1)
S = So
For i = 1 To Pas
Coussin = PF - (Garantie * Exp(-R * (T - i * dT)))
tCoussin(i, 1) = Coussin
Exposition = Coussin * m
tExposition(i, 1) = Exposition
Cash = PF - Exposition
tCash(i, 1) = Cash
Sminus1 = S
Eps = Application.NormSInv(Rnd)
S = S + (Mu * S * dT) + (Sigma * S * Eps * Sqr(dT))
tPrix(i, 1) = S
PF = (Exposition * (S / Sminus1)) + (Cash * Exp(R / Pas))
tPorteFeuille(i, 1) = PF
Next i
With Sheets("Feuil1")
.Range("prix") = So
.Range("prix").Offset(1, 0).Resize(Pas, 1).Value = tPrix
.Range("coussin").Offset(1, 0).Resize(Pas, 1).Value = tCoussin
.Range("exposition").Offset(1, 0).Resize(Pas, 1).Value = tExposition
.Range("cash").Offset(1, 0).Resize(Pas, 1).Value = tCash
.Range("portefeuille").Offset(1, 0).Resize(Pas, 1).Value = tPorteFeuille
End With
End Sub |
Partager