Iterate over a set of timesteps to integrate the pricing differential equation
Iterate over a set of timesteps to integrate the pricing differential equation
Timestep an implicit integration scheme to numerically integrate the pricing differential equation for each of the given instruments, backwardating from time Tmax to time 0.
starting_time_step: The index into time_pts of the first timestep to be emplyed. This must be no larger than the length of time_pts, minus one
time_pts: Time nodes to be treated on the grid
z: Space grid value morphable to stock prices using stock_level_fcn
S0: Time zero price of the base equity
instruments: A list of instruments to be priced. Each one must have a strike and a optionality_fcn, as with GridPricedInstrument and its subclasses.
stock_level_fcn: A function for changing space grid value to stock prices, with arguments z and t
discount_factor_fcn: A function for computing present values to time t of various cashflows occurring during this timestep, with arguments T, t
default_intensity_fcn: A function for computing default intensity occurring during this timestep, dependent on time and stock price, with arguments t, S.
variance_cumulation_fcn: A function for computing total stock variance occurring during this timestep, with arguments T, t. E.g. with a constant volatility s this takes the form (T−t)s2.
dividends: A data.frame with columns time, fixed, and proportional. Dividend size at the given time is then expected to be equal to fixed + proportional * S / S0
grid: An optional grid into which results at each timestep will be written. Its size should be at least (1+starting_time_step, length(z), length(instruments))
original_grid_values: Grid values to timestep from
Returns
Either a populated grid of present values of derivative prices, or a matrix of values at the first time point, adapted to z at each timestep. Time zero value will appear in the first index of any grid.