Week 4 While Loops
Rock, Paper, Scissors
import random
userplay = input( R, P, or S)
computer_number = random.randint(1,30
if computer_number =1:
computer_play = R
if computer_number =2:
computer_play = P
else:
computer_play = S
if userplay = computer_pla
H27
Example of Immunization, B01.2311
Prof. Stijn Van Nieuwerburgh
1
The Problem
The idea behind immunization is to eliminate interest rate risk. Most companies balance
sheets are subject to interest rate risk because the duration of their assets and liab
H25
William L. Silber
Foundations of Finance (B01.2311)
Equilibrium Term Structure under the Expectations Theory
PART I
R1 = .02; and Expected
R1 = .04
Given:
t
To Prove:
Equilibrium tR2 = [(l .02)(1.04)]1/2 1 = .02995 .03
Approach:
Assume tR2 = .02995 =
H24
Note on Forward Rates
Professors Otto Van Hemert and Stijn Van Nieuwerburgh
Setting
Suppose that
A oneyear zero has a YTM of y1 = 2%
A twoyear zero has a YTM of y2 = 3%
What is the forward rate for period 2?
Assuming a face value of $1000, the pri
H19
Equity Valuation Formulas
William L. Silber and Jessica Wachter
I. The Dividend Discount Model
Suppose a stock with price P0 pays dividend D1 one year from now, D2 two years from
now, and so on, for the rest of time. P0 is then equal to the discounted
H18
Arbitraging Away MisPricing How could you make an arbitrage prot if the coupon
bond were trading at $100 instead of its fair value of $121.7? Because the coupon bond is
undervalued, you will buy the coupon bond (buy low) and sell short the portfolio
H18
Arbitrage handout, B01.2311
Prof. Stijn Van Nieuwerburgh
1
Introduction
Our working denition so far was: Arbitrage is the transaction of selling something at a
high price and simultaneously buying that same thing at a low price, without cash outlay.
T
H16
Cov[Ri , Rj ] = V ar[Ri ].
Now we are ready to attack our problem. Lets x the expected portfolio return to be a number
r. Now nd the portfolio weights of the portfolio that has an expected return r and the lowest
possible portfolio variance. That is,
H17
Excess Returns and Beta: Deriving the
Security Market Line, B01.2311
Prof. William L. Silber and Prof. Stijn Van Nieuwerburgh
1
A First RewardtoRisk Relationship
We showed that market forces combined with a search by investors for ecient portfolios
H15
Portfolio Variance with Many Risky Securities
William L Silber and Jessica A. Wachter
Case 1: Unsystematic risk only.
Recall that when the correlation between two securities equals zero, the portfolio variance is given by:
2
2 2
2 2
p = w1 1 + w2 2
A
H19
P0 =
E1 (1 b )
k ROE b
This gives us:
(6)
P0
1 b
=
E1 k ROE b
Thus, the priceearnings ratio is determined by the market capitalization rate k,
the plowback ratio b, and the return on equity ROE.
When ROE = k , something interesting happens:
P0 1
=
E1
H21
Calculating the Annual Return (Realized Compound Yield) on a Coupon Bond
William L. Silber
Objective:
To show that the annual return actually earned on a couponbearing bond will equal its
yield to maturity only if you can and do reinvest the coupons
H31
CashFutures Arbitrage, B01.2311
Prof. Stijn Van Nieuwerburgh
1
Terminology
If an investor enters in a long future position, he assumes the obligation to take delivery
of the underlying at settlement date (date T ) at a price agreed upon when he enter
January 8, 2016


a sequence structure is sequential and isnt useful when different inputs based on different
circumstances (linear flow chart)
we can do a selection statement (to ask yes and no questions) ae true or false (deviate from a
linear flow ch
Week 2
February 1, 2016 Day 3
for a variable we need: an identifier, value stored in the variable, and the data type
can figure out the type using the type function ae type (variable)
4 diff variables: float and int, string, and boolean
data type dictates
Day 12 Module 5
Count Controlled Loops: for
for (name of accumulator variable or target variable) in (iterable ae sequence)
example:
word = python
for char in word:
print(char)
output:
p
y
t
h
o
n
example:
for counter in [1,2,3]:
print(counter)
output:
1
Class 2
Designing software is the most important phase
Most projects begin with an interview with the end user  you need to understand the task
algorithms  a series of well defined steps that must be taken in order to perform a task
pseudocode  techniq
Oleksandra Kayola (ok515)
Problem Set 1
Intro to Finance T/Th 9:30 AM
1A.
4000 shares * $102.25 = $409,000 (price shares bought at)
4000 shares * $102.50 = $410,000 (price shares sold at)
Answer: Earned $1,000 on the 4,000 shares bought and sold
10,000 4,
H29
6. Evaluate what happens at the end if S > E and S # E
S>E
Exercise long C
Deliver against short S
Receive proceeds of investment
Net
Cash Flow
$100
!
+$106.18
+$6.18
S# E (e.g., S = 98)
Leave call unexercised
Buy S in market
Deliver S against short
H25
With P 2 = 92.49 and tR2 = .0398 oneyear investors are also indifferent between
both of their strategies, as shown in the following 2 possibilities:
1. Buy tR1 and earn .02
2. Buy tR2 and sell after one year. The expected selling price of tR2 after o
H22
3.
Yield to Maturity = internal rate of return.
Implicitly includes all effects of P, C, and F on yields.
a) Annual pay bonds
IRR using number of periods = number of years
b) Semiannual pay bonds
Double IRR using number of periods = twice the number
H13
H14
Gains from Diversication: A TwoSecurity
Example, B01.2311
Prof. William L. Silber and Prof. Stijn Van Nieuwerburgh
The nice thing about diversication is that it almost always produces gains to a portfolio
in the form of increased return that exce
H11
Zero (Very Low) Correlation
In case 2(c) we see that the stock fund and the Russian bond fund do not move
in a reliable relationship relative to their means across the different scenarios. In
particular, in recession the stock fund is below its mean a
H10
Expected Value The expected value of R1 , E[R1 ] or 1 , tells you what the most likely
outcome of the random variable R1 is.
+
1 = E[R1 ] =
R1 (s)f (R1 (s) ds
s=
Note the similarity with the denition of expected value for a discretely distributed rand
H7
Notice that project B is better (has a higher NPV) than project A when the cost of
capital is above 10% (above 20% both have negative NPVs, but B is less bad), while
project A is better when the cost of capital is below 8%. In fact, you can calculate t
H9
EXAMPLE:
A sample was taken of 20 suburban families, and each sampled family was asked how
many cars it owned. The data were these:
2 2 1 2 3 2 2 1 2 2 2 1 2 2 1 0 2 2 1 2
You can get x by simply adding these numbers and then dividing by 20. However, t
H9
n
1
written as
n
n
xi =
x
i
i =1
n
i =1
. The symbol i is nothing but a
counting convenience. You should note that
n
x
=
i
i =1
n
x
j
n
x
=
u
j =1
.
u =1
In nearly every case youll encounter, the entire list of n values
will be added, and its burdenso
H3
P .05 = $10
P=
$10
= $200.
.05
Investing $200 at 5 percent generates $10 in interest per year and continues to do so
forever. Thus, if an annuity promises to pay $10 forever and the annual interest rate is
5 percent, the value of that infinite stream o
H7
NPV Versus IRR
W.L. Silber
I.
Our favorite project A has the following cash flows:
1000
0
0
+300
+600
+900
0
1
2
3
4
5
We know that if the cost of capital is 18 percent we reject the project because the
net present value is negative:
 1000 +
300
600