Finance
DynamicPortfolio
create new dynamic portfolio
Calling Sequence
Parameters
Description
Examples
Compatibility
DynamicPortfolio(update, weights, components, updates)
update
-
procedure; procedure for determining how the weights should be updated
weights
list or Vector; initial weights
components
stochastic process, list or Vector of stochastic processes; components of the portfolio
updates
(optional) continuous or positive integer; indicates how often the portfolio should be updated
The DynamicPortfolio command creates new dynamically updated portfolio.
The parameter update is a procedure used for calculating the updated weights of the portfolio. This procedure will be called every time the portfolio is rebalanced. The following five arguments will be passed to the procedure: W, W0, X, X0 and t, where W is the vector of new weights, X is the vector of new values, W0 is the vector of old weights, X0 is the vector old values and t is the current time.
The parameter weights is the vector of initial weights.
The parameter components is either a multi-dimensional stochastic process or a vector of one-dimensional stochastic processes.
Finally, the (optional) parameter updates controls how often the portfolio should be updated. Possible values are continuous or any positive integer. This integer value will specify the number of updates per year. If the value of this parameter is continuous, then the portfolio will be updated at every point in the discretization time grid.
with⁡Finance:
Consider two processes. The first process is a geometric Brownian motion. The second process is a deterministic process with constant value 1.0.
X1≔GeometricBrownianMotion⁡1,0.05,0.3:
X2≔DeterministicProcess⁡1.0:
Value≔t↦t1⋅t3+t2⋅t4
U := proc(w, w0, x, x0, t) if x[1] < 1.05 then w[1] := 0; w[2] := 1; else w[1] := 1; w[2] := 0; end if; end proc;
U ≔ procw,w0,x,x0,tifx[1]<1.05thenw[1] ≔ 0;w[2] ≔ 1elsew[1] ≔ 1;w[2] ≔ 0end ifend proc
W≔1.0,0.
W≔1.00.
X≔X1,X2
X≔_X0_P
P≔DynamicPortfolio⁡U,W,X:
AP≔SamplePath⁡P⁡t,t=0..1,timesteps=50,replications=10
PathPlot⁡AP,1,thickness=3,color=red..blue,axes=BOXED,gridlines=true
PathPlot⁡AP,2,thickness=3,color=red..blue,axes=BOXED,gridlines=true
PathPlot⁡Value⁡P⁡t,t=0..1,thickness=3,markers=false,timesteps=50,replications=10,color=red..blue,axes=BOXED,gridlines=true
Q := DynamicPortfolio(proc() end, W, X):
AQ≔SamplePath⁡Q⁡t,t=0..1,timesteps=50,replications=10
PathPlot⁡AQ,1,thickness=3,color=red..blue,axes=BOXED,gridlines=true
PathPlot⁡AQ,2,thickness=3,color=red..blue,axes=BOXED,gridlines=true
PathPlot⁡Value⁡Q⁡t,t=0..1,thickness=3,markers=false,timesteps=50,replications=10,color=red..blue,axes=BOXED,gridlines=true
R := DynamicPortfolio(proc() end, <0.0, 1.0>, X):
AR≔SamplePath⁡R⁡t,t=0..1,timesteps=50,replications=10
PathPlot⁡AR,1,thickness=3,color=red..blue,axes=BOXED,gridlines=true
PathPlot⁡AR,2,thickness=3,color=red..blue,axes=BOXED,gridlines=true
PathPlot⁡Value⁡R⁡t,t=0..1,thickness=3,markers=false,timesteps=50,replications=10,color=red..blue,axes=BOXED,gridlines=true
Value≔t,u↦t1⋅t3+t2⋅t4−max⁡u,0
ExpectedValue⁡Value⁡P⁡1,X1⁡1−1.05,timesteps=50,replications=104,output=value,standarddeviation
value=1.021297741,standarddeviation=0.3242635701
ExpectedValue⁡Value⁡Q⁡1,X1⁡1−1.05,timesteps=50,replications=104,output=value,standarddeviation
value=0.9307660907,standarddeviation=0.3878610911
ExpectedValue⁡Value⁡R⁡1,X1⁡1−1.05,timesteps=50,replications=104,output=value,standarddeviation
value=0.8736073177,standarddeviation=0.2214176439
ExpectedValue⁡max⁡X1⁡1−1.05,0,timesteps=50,replications=104,output=value,standarddeviation
value=0.1246581605,standarddeviation=0.2178360124
The Finance[DynamicPortfolio] command was introduced in Maple 15.
For more information on Maple 15 changes, see Updates in Maple 15.
See Also
Finance[BlackScholesProcess]
Finance[CEVProcess]
Finance[Diffusion]
Finance[Drift]
Finance[ExpectedValue]
Finance[GeometricBrownianMotion]
Finance[ItoProcess]
Finance[PathPlot]
Finance[SamplePath]
Finance[SampleValues]
Finance[StochasticProcesses]
Finance[WienerProcess]
Download Help Document