DynamicPortfolio - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Finance

  

DynamicPortfolio

  

create new dynamic portfolio

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

DynamicPortfolio(update, weights, components, updates)

Parameters

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

Description

• 

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.

Examples

withFinance:

Consider two processes. The first process is a geometric Brownian motion. The second process is a deterministic process with constant value 1.0.

X1GeometricBrownianMotion1,0.05,0.3:

X2DeterministicProcess1.0:

Valuett1t3+t2t4

Valuett1t3+t2t4

(1)

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;

Uprocw&comma;w0&comma;x&comma;x0&comma;tifx&lsqb;1&rsqb;<1.05thenw&lsqb;1&rsqb;0&semi;w&lsqb;2&rsqb;1elsew&lsqb;1&rsqb;1&semi;w&lsqb;2&rsqb;0end ifend proc

(2)

W1.0&comma;0.

W1.00.

(3)

XX1&comma;X2

X_X0_P

(4)

PDynamicPortfolioU&comma;W&comma;X&colon;

APSamplePathPt&comma;t=0..1&comma;timesteps=50&comma;replications=10

PathPlotAP&comma;1&comma;thickness=3&comma;color=red..blue&comma;axes=BOXED&comma;gridlines=true

PathPlotAP&comma;2&comma;thickness=3&comma;color=red..blue&comma;axes=BOXED&comma;gridlines=true

PathPlotValuePt&comma;t=0..1&comma;thickness=3&comma;markers=false&comma;timesteps=50&comma;replications=10&comma;color=red..blue&comma;axes=BOXED&comma;gridlines=true

Q := DynamicPortfolio(proc() end, W, X):

AQSamplePathQt&comma;t=0..1&comma;timesteps=50&comma;replications=10

PathPlotAQ&comma;1&comma;thickness=3&comma;color=red..blue&comma;axes=BOXED&comma;gridlines=true

PathPlotAQ&comma;2&comma;thickness=3&comma;color=red..blue&comma;axes=BOXED&comma;gridlines=true

PathPlotValueQt&comma;t=0..1&comma;thickness=3&comma;markers=false&comma;timesteps=50&comma;replications=10&comma;color=red..blue&comma;axes=BOXED&comma;gridlines=true

R := DynamicPortfolio(proc() end, <0.0, 1.0>, X):

ARSamplePathRt&comma;t=0..1&comma;timesteps=50&comma;replications=10

PathPlotAR&comma;1&comma;thickness=3&comma;color=red..blue&comma;axes=BOXED&comma;gridlines=true

PathPlotAR&comma;2&comma;thickness=3&comma;color=red..blue&comma;axes=BOXED&comma;gridlines=true

PathPlotValueRt&comma;t=0..1&comma;thickness=3&comma;markers=false&comma;timesteps=50&comma;replications=10&comma;color=red..blue&comma;axes=BOXED&comma;gridlines=true

Valuet&comma;ut1t3+t2t4maxu&comma;0

Valuet&comma;ut1t3+t2t4maxu&comma;0

(5)

ExpectedValueValueP1&comma;X111.05&comma;timesteps=50&comma;replications=104&comma;output=value&comma;standarddeviation

value=1.021297741&comma;standarddeviation=0.3242635701

(6)

ExpectedValueValueQ1&comma;X111.05&comma;timesteps=50&comma;replications=104&comma;output=value&comma;standarddeviation

value=0.9307660907&comma;standarddeviation=0.3878610911

(7)

ExpectedValueValueR1&comma;X111.05&comma;timesteps=50&comma;replications=104&comma;output=value&comma;standarddeviation

value=0.8736073177&comma;standarddeviation=0.2214176439

(8)

ExpectedValuemaxX111.05&comma;0&comma;timesteps=50&comma;replications=104&comma;output=value&comma;standarddeviation

value=0.1246581605&comma;standarddeviation=0.2178360124

(9)

Compatibility

• 

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]