Computational Finance: Midterm Examination

April 12, 1999
Philip H. Dybvig

This is a closed-book examination. Answer all questions as directed. Mark your answers directly on the examination. On the valuation question, make sure your answer is clearly indicated. There are no trick questions on the exam. Good luck!
A. General Concepts Very Short Answer: 20 points

  1. Which of the following is the conceptual basis for option pricing: capital asset pricing model (CAPM), absence of arbitrage, or the weighted-average cost-of capital (WACC)?

    
    
    
    
  2. Name three examples of derivative securities that can be priced by a binomial model.

     
     
     
    
    
  3. Suppose you have a simple option pricing task. Assuming the problem is simple enough so that either can be used, which would be faster, a single-variable binomial model or a simulation?

     
    
    
    
    
  4. Suppose you have a complex option pricing task that involves many sources of noise and stochastic volatility. Which approach is probably more appropriate, Black-Scholes, binomial, or simulation?

     
    
    
    
    
  5. Name two common uses of simulations in finance.

     
    
    
    
    
    
    
    
    
B. Financial Computation 40 points

A Simple Option Pricing Problem in One Period

Riskless bond (interest rate is 50%):

100 --- 150

Stock:

    |- 125
50 -|
    |-  50

Derivative security (call option with a strike of 80):

    |- 45
 ? -|
    |-  0
  1. What is the portfolio of the stock and the bond that replicates the option?

        
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
  2. What is the price of the portfolio?

        
    
    
    
    
    
    
    
    
    
    
    
    
    
    
  3. What are the risk-neutral probabilities of the two states? (I recommend that you verify that your answer gives the correct price for the stock, the bond, and the option.)

        
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
  4. (thought question - answer in a sentence or two of ordinary length) Suppose we have inherited many shares of the stock and would like to trade them to diversify but we are precluded from trading the stock due to terms of an inheritence. If the inheritence does not preclude trading the option, how can this help us? (Note: do not perform any computations in this answer.)

        
    
    
    
    
    
    
    
    
    
    
C. Computer Implementation Short Answer: 40 points

The questions in this section are based on the asset-allocation simulation in Homework 4. You should not need to use the complete program listings, but they are included at the end of the exam in case you would like to have a look at them. All of the references in this section are to classes defined in the file AssetAlloc.java.

  1. The TextField inrisky appears in the following statements in the class ValuePlotFrame: near the start of the class definition and not in any method:
          TextField r,mu,sigma,inrisky;
    
    in the class constructor ValuePlotFrame():
          inputs.add(inrisky = new TextField("70",10));
    
    in the "start simulation" method startSimu():
          ir = text2double(inrisky)/100.0;
    
    in the method reset()
          inrisky.setText("70");
    
    What is the TextField inrisky? Briefly, how is it used?
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
  2. The method stockTotRet in AssetAllocEngine is defined by
      double stockTotRet() {
        return mean1per + std1persqrt12 * (Math.random()-0.5);}
    
    where the constandt std1persqrt12 would be set previously by the method newPars in the line
        std1persqrt12 = sigma * Math.sqrt(12.0 * tinc);
    
    of code. What is the point of the 0.5 and the square root of 12.0 in these lines?
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
  3. In the method fixProps of the class AssetAllocEngine, the following lines are within a for loop that steps through the periods of the investment problem:
          wealth = stock + cash;
          stock = wealth * inrisky;
          cash = wealth - stock;
    
    What do these lines do?

    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
D. Advanced Questions Short Answer: up to 20 make-up points

These questions are intended to be more challenging conceptual questions. Answering these questions correctly can give you up to 20 points to substitute for points missed in Parts A-C.

  1. In the binomial stock option pricing program (Crr in Homework 1), the expressions for up and down returns are based on a mean total stock return of one plus the interest rate, while in the corresponding expression in the binomial futures option pricing program (FutOp in Homework 3) the mean is one. Why are the two different?

    
    
    
    
    
    
    
    
    
    
  2. In the asset allocation simulation (AssetAllocEngine in Homework 4), the mean return of the stock is a parameter supplied to the program, while in the stochastic volatility option pricing simulation (SVPriceEngine in Homework 5), the mean is taken equal to the interest rate. Why are the two different?

    
    
    
    
    
    
    
    
    
    
    
    

Supplemental Information

Although you will probably not need to see the complete program files to answer the questions in part C, they are included for your reference.

Exhibit A: HTML file AssetAlloc.html

<HTML>
<HEAD>
<TITLE>Asset Allocation Simulation</TITLE>
</HEAD>
<BODY>
<APPLET CODE=AssetAlloc.class WIDTH=300 HEIGHT=50>
</APPLET>
</BODY>
</HTML>
Exhibit B: Asset Allocation Applet file AssetAlloc.java
//
// Asset Allocation Applet
//
// This applet simulates asset allocation between risky and riskless
// assets.  The horizon is fixed at 10 years and initial wealth is
// normalized to be 100.  The interest rate is constant and stock
// returns are i.i.d. over time.
//

import java.applet.*;
import java.awt.*;

public class AssetAlloc extends Applet {
  ValuePlotFrame valuePlotFrame;
  Button startASimu;
    public AssetAlloc() {
      setLayout(new GridLayout(1,1));
      add(startASimu = new Button("Start a Simulation"));
      valuePlotFrame = new ValuePlotFrame();
      valuePlotFrame.setTitle("Asset Allocation Simulation");
      valuePlotFrame.pack();
      valuePlotFrame.resize(500,400);}
    public boolean action(Event e, Object arg) {
      if(e.target == startASimu) {
        valuePlotFrame.reset();
        return true;}
      return false;}}

class ValuePlotFrame extends Frame {
  BasicLinePlot blp;
  TextField r,mu,sigma,inrisky;
  Button newRandomDraws,resetInputs;
  double ttm = 10.0,ir;
  double[] times,values;
  int nper = 1200;
  int i;
  AssetAllocEngine vroom;
  double[] xgrid,ygrid;
  public ValuePlotFrame() {
    setLayout(new BorderLayout());
    blp = new BasicLinePlot();
    add("Center",blp);
    Panel inputs = new Panel();
    inputs.setLayout(new GridLayout(6,2));
      inputs.add(new Label("interest rate (%/yr)"));
      inputs.add(r = new TextField("5",10));
      inputs.add(new Label("mean stock return (%/yr)"));
      inputs.add(mu = new TextField("15",10));
      inputs.add(new Label("std dev of stock return (%/yr)"));
      inputs.add(sigma = new TextField("30",10));
      inputs.add(new Label("allocation to risky asset (%)"));
      inputs.add(inrisky = new TextField("70",10));
      inputs.add(newRandomDraws = new Button("Simulate again"));
      inputs.add(new Label(""));
      inputs.add(resetInputs = new Button("Reset and simulate again"));
    add("South",inputs);
    vroom = new AssetAllocEngine(nper);
    times = new double[nper + 1];
    for(i=0;i<=nper;i++) times[i] = ((double) i) * ttm / ((double) nper);
    xgrid = new double[6];
    for(i=0;i<6;i++) xgrid[i] = ((double) i) * 2.0;
    ygrid = new double[6];
    for(i=0;i<6;i++) ygrid[i] = ((double) i) * 100.0;}
  public void startSimu() {
    vroom.newPars(text2double(r)/100.0,
        text2double(mu)/100.0,text2double(sigma)/100.0,ttm);
    ir = text2double(inrisky)/100.0;
    values = vroom.fixProps(ir,ir * 100.0,(1.0-ir)*100.0);
    blp.newXY(times,values,xgrid,ygrid,
      "Simulated Wealth, Fixed Proportions Startegy: 0-10 years out");
    show();}
  public void reset() {
    r.setText("5");
    mu.setText("15");
    sigma.setText("30");
    inrisky.setText("70");
    startSimu();}
  public boolean action(Event e, Object arg) {
    if(e.target == newRandomDraws) {
      startSimu();
      return true;}
    if(e.target == resetInputs) {
      reset();
      return true;}
    return false;}
  public boolean handleEvent(Event event) {
    if(event.id == Event.WINDOW_DESTROY) {
      dispose();}
    return super.handleEvent(event);}
  double text2double(TextField tf) {
    return Double.valueOf(tf.getText()).doubleValue();}}

class AssetAllocEngine {
  int nper;
  double tinc,r1per,mean1per,std1persqrt12;
  double[] values;
  public AssetAllocEngine(int nper) {
    values = new double[nper+1];
    this.nper = nper;}
  public void newPars(double r,double mu,double sigma,double ttm) {
    tinc = ttm/((double) nper);
    r1per = 1.0 + r * tinc;
    mean1per = 1.0 + mu * tinc;
    std1persqrt12 = sigma * Math.sqrt(12.0 * tinc);}
  public double[] fixProps(double inrisky,double initstock,
      double initcash) {
    double stock,cash,wealth,stockret;
    int i;
    stock = initstock;
    cash = initcash;
    for(i=1,values[0]=stock + cash;i<=nper;i++) {
      wealth = stock + cash;
      stock = wealth * inrisky;
      cash = wealth - stock;
      stockret = stockTotRet();
      stock *= stockret;
      cash *= r1per;
      values[i] = cash + stock;}
    return values;}
  double stockTotRet() {
    return mean1per + std1persqrt12 * (Math.random()-0.5);}}
Exhibit C: Line Plot program file BasicLinePlot.java
import java.awt.*;
      
public class BasicLinePlot extends Canvas {
  double[] x,y,xgrid,ygrid;
  int i,nper;
  int ixleft,ixright,iytop,iybottom,ih,iw,ihalftic,iRise,fmHeight;
  double xleft,xright,ytop,ybottom;
  double lmarg = 0.10,rmarg = 0.05,tmarg = 0.10,bmarg = 0.10,halftic = 0.0035;
  double ixintercept,ixslope,iyintercept,iyslope;
  String thingy;
  public BasicLinePlot() {}
  String mainTitle;
  public void newXY(double[] x,double[] y,double[] xgrid,double[] ygrid,
    String mainTitle) {
    if(x.length != y.length) {
      System.err.println("Error: x and y must have the same length");
      System.exit(-1);}
    this.x = new double[x.length];
    this.y = new double[x.length];
    for(i=0;i<x.length;i++) {
      this.x[i] = x[i];
      this.y[i] = y[i];}
    this.xgrid = new double[xgrid.length];
    this.ygrid = new double[ygrid.length];
    for(i=0;i<xgrid.length;i++)
      this.xgrid[i] = xgrid[i];
    for(i=0;i<ygrid.length;i++)
      this.ygrid[i] = ygrid[i];
    this.mainTitle = mainTitle;
    repaint();}
  public void paint(Graphics g) {
    if(xgrid != null) {
      xleft = xgrid[0];
      xright = xgrid[xgrid.length - 1];
      ybottom = ygrid[0];
      ytop = ygrid[ygrid.length - 1];
  
      Rectangle r = bounds();
      ih = r.height;
      iw = r.width;
      iytop = (int) (tmarg * ((double) ih));
      iybottom = (int) ((1.0-bmarg) * ((double) ih));
      ixleft = (int) (lmarg * ((double) iw));
      ixright = (int) ((1.0-rmarg) * ((double) iw));
      ihalftic = (int) (halftic * ((double) iw));
  
      ixslope = ((double) (ixright - ixleft))/(xright - xleft);
      ixintercept = 0.5 + (((double) ixright) * xleft - ((double) ixleft) *
        xright)
        /(xleft - xright);
      iyslope = ((double) (iybottom - iytop))/(ybottom - ytop);
      iyintercept = 0.5 + (((double) iybottom) * ytop - ((double) iytop) *
        ybottom)/(ytop - ybottom);
  
//
//  white background
//
      g.setColor(Color.white);
      g.fillRect(0,0,iw,ih);
  
//
//  draw the axes
//
      g.setColor(Color.black);
      g.drawLine(ixleft,iytop,ixleft,iybottom);
      g.drawLine(ixleft,iybottom,ixright,iybottom);
  
//
//  add tick marks
//
      g.setColor(Color.black);
      for(i=0;i<ygrid.length;i++)
        g.drawLine(ixleft-ihalftic,y2iy(ygrid[i]),
          ixleft+ihalftic,y2iy(ygrid[i]));
      for(i=0;i<xgrid.length;i++)
        g.drawLine(x2ix(xgrid[i]),iybottom-ihalftic,
          x2ix(xgrid[i]),iybottom+ihalftic);
  
//
//  add axis numbers
//
      g.setColor(Color.black);
      FontMetrics fm = g.getFontMetrics();
      iRise = fm.getAscent()/2;
      fmHeight = fm.getHeight();
      for(i=0;i<ygrid.length;i++) {
        thingy = Double.toString(ygrid[i]);
        g.drawString(thingy,ixleft - ihalftic -fm.stringWidth(thingy),
          y2iy(ygrid[i]) + iRise);}
      for(i=0;i<xgrid.length;i++) {
        thingy = Double.toString(xgrid[i]);
        g.drawString(thingy,x2ix(xgrid[i]) - fm.stringWidth(thingy)/2,
          iybottom + ihalftic + fmHeight);}
  
//
//  plot lines
//
      g.setColor(Color.blue);
      for(i=1;i<x.length;i++)
        g.drawLine(x2ix(x[i-1]),y2iy(y[i-1]),
          x2ix(x[i]),y2iy(y[i]));
  
//
//  add the mainTitle
//
      g.drawString(mainTitle,(ixright + ixleft)/2 -
        fm.stringWidth(mainTitle)/2,fmHeight);}}
  int x2ix(double x) {return (int) Math.floor(ixintercept + ixslope * x);}
  int y2iy(double y) {return (int) Math.floor(iyintercept + iyslope * y);}}