Chapter 4. Optimality and Equilibrium
Much of economic theory is based on the premise: given two alternatives, an agent can, and will if able, choose a preferred one.
Darrell Duffie (1988)
A portfolio analysis starts with information concerning individual securities. It ends with conclusions concerning portfolios as a whole. The purpose of the analysis is to find portfolios which best meet the objectives of the investor.
Harry Markowitz (1959)
This chapter is about the modeling of agents and their optimization problems. It presents some of the fundamental building blocks of microeconomic theory (see Varian (1992)) and financial economics (see Eichberger and Harper (1997)). At the core of this chapter is the expected utility maximization paradigm, which is the dominant way of modeling an agent’s preferences in financial economics. Based on this paradigm, two central topics are discussed.
First, we discuss how an agent chooses an optimal investment portfolio given their preferences and the initial wealth. This type of problem is typically called optimal portfolio choice. The approach presented here does not rely on any form of simplification as seen with the mean-variance portfolio (MVP) approach and the Capital Asset Pricing Model (CAPM) that, for example, reduce the problem of choosing investment portfolios to the first and second moments of the return distributions of financial assets as well as their covariance.
Second, while prices for financial assets in the previous two chapters have been given a priori, this chapter derives them from fundamental principles in that it analyzes the pricing of financial assets based on the optimization problem of a so-called representative agent in addition to equilibrium arguments. Loosely speaking, a representative agent can be thought of as the aggregation of (infinitely) many agents acting independently in (financial) markets. Conditions for the existence of such a representative agent are well-known (see chapter 6 in Milne (1995))—however, they are not discussed in this chapter because financial theory in general simply postulates the existence.
The current chapter mainly covers the following topics from finance, mathematics, and Python programming. On the Python side, not that many new elements are introduced. The basic mathematical and Python tool sets for doing finance in discrete models are already introduced and developed in the previous two chapters:
Finance | Mathematics | Python |
---|---|---|
Preferences and utility |
Utility function |
|
Utility maximization |
Objective function, budget constraint, Theorem of Lagrange |
|
Indifference curves, budget line |
Function |
|
Logarithmic utility |
Natural logarithm |
|
Time-additive utility |
Utility function |
|
(time-additive) expected utility |
Probability measure, Theorem of Lagrange |
|
Optimal investment portfolio |
Theorem of Lagrange, first-order conditions |
|
Equilibrium pricing, representative agent |
Theorem of Lagrange, first-order conditions |
|
Martingale measures in incomplete markets |
Set of probability measures |
|
Market completion by contingent claims |
Theorem of Lagrange, first-order conditions |
|
Utility Maximization
Formally, an agent is modeled by a utility function, which orders a set of choices the agent is faced with and which is a representation of the agent’s preferences (see chapter 7 in Varian (1992)). Consider the static economy without uncertainty from Chapter 2. In addition, assume that an agent is endowed with some initial wealth, . The agent can decide how much of this wealth to spend today, , and how much to save—via bank deposits—for future consumption. One can think of an agent faced with the question of how much to save for retirement.
The agent receives utility from money today, , and in one year, , according to the utility function:
As an example, assume —expressing the idea that money today and in one year are substitutes, although not perfect ones (if either one is zero, utility is zero as well). What is the optimal consumption-saving plan for the agent? Their constrained optimization problem formally is:
According to the Theorem of Lagrange (see chapter 5 in Sundaram (1996)), the constrained optimization problem can be transformed into an unconstrained one of the form:
The first-order necessary conditions for optimality are:
From these, one easily derives as the optimal consumption-saving plan.
This optimization problem can be modeled and solved in Python numerically, for which shall hold:
In
[
1
]
:
def
u
(
c
)
:
return
-
c
[
0
]
*
c
[
1
]
In
[
2
]
:
w
=
10
In
[
3
]
:
from
scipy.optimize
import
minimize
In
[
4
]
:
cons
=
(
{
'
type
'
:
'
eq
'
,
'
fun
'
:
lambda
c
:
c
[
0
]
+
c
[
1
]
-
w
}
)
In
[
5
]
:
opt
=
minimize
(
u
,
(
1
,
1
)
,
constraints
=
cons
)
In
[
6
]
:
opt
Out
[
6
]
:
fun
:
-
24.999999999999996
jac
:
array
(
[
-
5.
,
-
5.
]
)
message
:
'
Optimization terminated successfully
'
nfev
:
6
nit
:
2
njev
:
2
status
:
0
success
:
True
x
:
array
(
[
5.
,
5.
]
)
In
[
7
]
:
opt
[
'
x
'
]
Out
[
7
]
:
array
(
[
5.
,
5.
]
)
In
[
8
]
:
-
opt
[
'
fun
'
]
Out
[
8
]
:
24.999999999999996
The utility function with a negative sign to accomplish a maximization through minimization.
The initial wealth of the agent to be distributed between today and the future.
The budget constraint as an equality constraint for the
minimize
function.The optimization with initial guess and budget constraint.
The optimal consumption-saving plan.
Indifference Curves
The optimal solution from the previous section can be visualized by the means of indifference curves. An indifference curve is formed by all such combinations that give the same utility . The equation describing such a curve in space is:
The equation describing the line representing the budget constraint is:
The optimization problem is visualized in Figure 4-1, where the optimal plan is given by the dot—this is where the indifference curve for is tangent to the line representing the budget constraint.
In Python, this translates into the following code:
In
[
9
]
:
def
iu
(
u
,
c0
)
:
return
u
/
c0
In
[
10
]
:
def
c1
(
c0
)
:
return
w
-
c0
In
[
11
]
:
import
numpy
as
np
np
.
set_printoptions
(
precision
=
5
)
In
[
12
]
:
from
pylab
import
mpl
,
plt
plt
.
style
.
use
(
'
seaborn
'
)
mpl
.
rcParams
[
'
savefig.dpi
'
]
=
300
mpl
.
rcParams
[
'
font.family
'
]
=
'
serif
'
In
[
13
]
:
c0
=
np
.
linspace
(
1
,
w
)
In
[
14
]
:
plt
.
figure
(
figsize
=
(
10
,
6
)
)
plt
.
plot
(
c0
,
c1
(
c0
)
,
label
=
'
budget constraint
'
,
lw
=
3.0
)
plt
.
plot
(
c0
,
iu
(
15
,
c0
)
,
'
--
'
,
label
=
'
$u=15$
'
)
plt
.
plot
(
c0
,
iu
(
25
,
c0
)
,
label
=
'
$u=25$
'
)
plt
.
plot
(
c0
,
iu
(
35
,
c0
)
,
'
-.
'
,
label
=
'
$u=35$
'
)
plt
.
plot
(
opt
[
'
x
'
]
[
0
]
,
opt
[
'
x
'
]
[
1
]
,
'
ro
'
,
label
=
'
$c=(5, 5)$
'
)
plt
.
legend
(
loc
=
0
)
;
Appropriate Utility Functions
In finance, the utility that an agent gains from money they have available at a certain point in time—as a substitute for any other real asset that might be bought with the money, for instance—is typically expressed as a function , which is assumed to satisfy three conditions:
-
is twice differentiable
The first condition is a technical prerequisite for the other two. The second condition formalizes the idea that more money—everything else being equal—is better than less money. Agents are assumed to be insatiable. The third condition states that the marginal utility from an additional unit of money is smaller (or the same at the maximum) than the marginal utility of the previous marginal unit of money. The function is therewith assumed to be increasing and (quasi-)concave.
Logarithmic Utility
This section introduces a type of function that is well suited for financial analyses based on a utility maximizing agent. Such a function—that satisfies the three conditions of the previous section and that is regularly used in finance to model the utility an agent receives from money (or consumption)—is the natural logarithm . For it, one gets:
-
for
Python allows us to visualize the three relevant functions. NumPy
is used in combination with vectorized calculations. Figure 4-2 shows the plot as generated by the following code:
In
[
15
]
:
x
=
np
.
linspace
(
0.5
,
10
,
50
)
In
[
16
]
:
x
[
:
5
]
Out
[
16
]
:
array
(
[
0.5
,
0.69388
,
0.88776
,
1.08163
,
1.27551
]
)
In
[
17
]
:
u
=
np
.
log
(
x
)
In
[
18
]
:
u1
=
1
/
x
In
[
19
]
:
u2
=
-
1
/
x
*
*
2
In
[
20
]
:
plt
.
figure
(
figsize
=
(
10
,
6
)
)
plt
.
plot
(
x
,
u
,
label
=
'
$u$
'
)
plt
.
plot
(
x
,
u1
,
'
--
'
,
label
=
'
$du/dx$
'
)
plt
.
plot
(
x
,
u2
,
'
-.
'
,
label
=
'
$d^2u/dx^2$
'
)
plt
.
legend
(
loc
=
0
)
;
Creates an
ndarray
object with floating point numbers between 0.5 and 10 and a homogeneous spacing to get 50 values.Shows a selection of the resulting numbers.
Calculates the values for the utility function.
And for its first derivative as well as…
…for its second derivative.
Creates a new canvas for plotting and provides sizing parameters.
Plots the utility function.
Plots the first derivative.
Plots the second derivative.
Time-Additive Utility
Using the natural logarithm as a function to model utility of an agent from money, the preferences of an agent over consumption-saving plans can be described as a time-additive function of the following form:
is assumed to take on values and represents the time preference of the agent. It embodies the idea that money and consumption today are valued higher than in one year. At least weakly, 100 USD now is preferred to 100 USD in one year—no matter what exact function describes utility (assuming consistency of preferences over time). It can be thought of as a nonmonetary discount factor. It is easily verified that this function satisfies the three conditions described previously—it is twice differentiable, increasing, and concave—based on the partial derivatives with regard to both and .
If the agent has initial wealth of , their constrained optimization problem is:
or
The first-order necessary conditions for optimality are:
From these, one obtains:
The optimal consumption-saving plan now reflects the time preference in that consumption in one year is set to . It also holds
and
The budget constraint is binding:
The following code solves the optimization problem numerically for . The optimal plan reflects the time preference:
In
[
21
]
:
import
math
In
[
22
]
:
from
scipy.optimize
import
minimize
In
[
23
]
:
kappa
=
10
/
11
In
[
24
]
:
def
U
(
c
)
:
return
-
(
math
.
log
(
c
[
0
]
)
+
kappa
*
math
.
log
(
c
[
1
]
)
)
In
[
25
]
:
w
=
10
In
[
26
]
:
cons
=
(
{
'
type
'
:
'
eq
'
,
'
fun
'
:
lambda
c
:
c
[
0
]
+
c
[
1
]
-
w
}
)
In
[
27
]
:
opt
=
minimize
(
U
,
(
1
,
1
)
,
constraints
=
cons
)
In
[
28
]
:
opt
Out
[
28
]
:
fun
:
-
3.0747286083026886
jac
:
array
(
[
-
0.19091
,
-
0.19091
]
)
message
:
'
Optimization terminated successfully
'
nfev
:
18
nit
:
6
njev
:
6
status
:
0
success
:
True
x
:
array
(
[
5.23811
,
4.76189
]
)
In
[
29
]
:
opt
[
'
x
'
]
Out
[
29
]
:
array
(
[
5.23811
,
4.76189
]
)
In
[
30
]
:
-
opt
[
'
fun
'
]
Out
[
30
]
:
3.0747286083026886
The utility function with a negative sign to accomplish a maximization through minimization.
The budget constraint as an equality constraint for the
minimize
function.The optimal consumption-saving plan, reflecting the time preference in that is higher than —by exactly 10%.
The maximum utility gained through the optimal plan.1
Expected Utility
Now consider the static two-state economy with uncertainty. Assume that an agent, endowed with some initial wealth, , gains utility only through money available in one year—but now distinguished in the two states that are possible then. This shall represent a pure investment problem where all available initial wealth shall be optimally invested in the traded financial assets.
Assume that two financial assets are traded, a risk-less bond with price process
and a risky stock with price process
Financial assets are a means to transfer the initial wealth from today to a later point in time. The major decision problem of the agent is to decide what to consume in either one of the future states.
A model for the investment problem the agent is faced with under uncertainty is given by the expected utility of the agent that is to be maximized given . The expected utility function is given by:
With the price vector , the agent can distribute their initial wealth according to
where represents the portfolio consisting of the risk-less bond and the risky stock as composed by the agent. This budget constraint will always be binding due to the agent being insatiable. Short selling shall not be allowed.
The market payoff matrix is as follows:
How much money does the agent have available in either state one year from today? This is determined by the portfolio the agent chooses to compose:
This leads to
or
The complete decision-making problem—with regard to optimal portfolio choice—of the agent can then be represented as the following constrained optimization problem:
or after substituting for
According to the Theorem of Lagrange, one can transform this problem into an unconstrained optimization problem of the form
where the agent chooses and to maximize expected utility given the budget constraint.
Expected Utility Theory
Decades after its formulation and introduction, expected utility theory (EUT) is still the dominant decision-making paradigm in finance. One of its major assumptions—that agents have full knowledge of possible future states and their probabilities—is hardly ever fulfilled in reality. However, EUT is, to many, intellectually appealing and leads to “nice” results that are often easy to understand and interpret. For more on the problems with this central paradigm in finance, see Hilpisch (2020, chapters 3 and 4).
Optimal Investment Portfolio
What does an optimal solution for the expected utility maximizing agent look like? In general terms, the answer can be given based on the first-order conditions that are necessary and sufficient here for an optimal solution:
or
and
with the usual notation as well as
Assume logarithmic utility and for the price processes of the two traded financial assets and , respectively. With , it holds such that the portfolio positions represent percent values.
In Python, the minimize
function from the scipy.optimize
subpackage is also appropriate to solve the investment problem of the agent:
In
[
31
]
:
B
=
(
10
,
(
11
,
11
)
)
In
[
32
]
:
S
=
(
10
,
(
20
,
5
)
)
In
[
33
]
:
M0
=
np
.
array
(
(
B
[
0
]
,
S
[
0
]
)
)
In
[
34
]
:
M
=
np
.
array
(
(
B
[
1
]
,
S
[
1
]
)
)
.
T
In
[
35
]
:
p
=
0.5
In
[
36
]
:
P
=
np
.
array
(
(
p
,
1
-
p
)
)
In
[
37
]
:
def
U
(
phi
)
:
c1
=
np
.
dot
(
M
,
phi
)
return
-
np
.
dot
(
P
,
np
.
log
(
c1
)
)
In
[
38
]
:
-
U
(
(
1
,
0
)
)
Out
[
38
]
:
2.3978952727983707
In
[
39
]
:
-
U
(
(
0
,
1
)
)
Out
[
39
]
:
2.3025850929940455
In
[
40
]
:
-
U
(
(
0.5
,
0.5
)
)
Out
[
40
]
:
2.410140782802518
In
[
41
]
:
w
=
10
In
[
42
]
:
cons
=
(
{
'
type
'
:
'
eq
'
,
'
fun
'
:
lambda
phi
:
np
.
dot
(
M0
,
phi
)
-
w
}
)
In
[
43
]
:
opt
=
minimize
(
U
,
(
1
,
1
)
,
constraints
=
cons
)
In
[
44
]
:
opt
Out
[
44
]
:
fun
:
-
2.4183062699261972
jac
:
array
(
[
-
1.
,
-
0.99999
]
)
message
:
'
Optimization terminated successfully
'
nfev
:
15
nit
:
5
njev
:
5
status
:
0
success
:
True
x
:
array
(
[
0.69442
,
0.30558
]
)
In
[
45
]
:
opt
[
'
x
'
]
Out
[
45
]
:
array
(
[
0.69442
,
0.30558
]
)
In
[
46
]
:
-
opt
[
'
fun
'
]
Out
[
46
]
:
2.4183062699261972
In
[
47
]
:
-
U
(
opt
[
'
x
'
]
)
Out
[
47
]
:
2.4183062699261972
In
[
48
]
:
np
.
dot
(
M
,
opt
[
'
x
'
]
)
Out
[
48
]
:
array
(
[
13.75022
,
9.16652
]
)
The bond price process and…
…the stock price process.
The price vector of the two traded financial assets.
The market payoff matrix of the two traded financial assets.
The physical probability measure for the economy.
The expected utility function with logarithmic utility.
Some example values for total portfolio weights of 1—diversification pays off.
The budget constraint based on the dot product of the price and portfolio vectors.
The expected utility maximization problem as a minimization.
The optimal allocation between the bond and the stock.
The optimal expected utility value.
Time-Additive Expected Utility
It is possible to formulate the decision-making problem of the agent to include utility from money today as well:
With initial wealth , the optimization problem in unconstrained form becomes:
With the assumptions from before, the optimal solution is derived with Python according to the following code:
In
[
49
]
:
M0
=
np
.
array
(
(
1
,
B
[
0
]
,
S
[
0
]
)
)
In
[
50
]
:
kappa
=
10
/
11
In
[
51
]
:
def
U
(
phi
)
:
c0
=
phi
[
0
]
c1
=
np
.
dot
(
M
,
phi
[
1
:
]
)
return
-
(
np
.
log
(
c0
)
+
kappa
*
np
.
dot
(
P
,
np
.
log
(
c1
)
)
)
In
[
52
]
:
opt
=
minimize
(
U
,
(
1
,
1
,
1
)
,
constraints
=
cons
)
In
[
53
]
:
opt
Out
[
53
]
:
fun
:
-
3.1799295980286093
jac
:
array
(
[
-
0.19088
,
-
1.90932
,
-
1.90974
]
)
message
:
'
Optimization terminated successfully
'
nfev
:
32
nit
:
8
njev
:
8
status
:
0
success
:
True
x
:
array
(
[
5.23899
,
0.33087
,
0.14523
]
)
In
[
54
]
:
-
opt
[
'
fun
'
]
Out
[
54
]
:
3.1799295980286093
In
[
55
]
:
opt
[
'
x
'
]
[
0
]
Out
[
55
]
:
5.23898714830318
In
[
56
]
:
np
.
dot
(
M
,
opt
[
'
x
'
]
[
1
:
]
)
Out
[
56
]
:
array
(
[
6.54422
,
4.36571
]
)
The price vector including the price of 1 for consumption today.
The time preference factor.
The expected utility function taking into account consumption today and the time preference.
This is what the agent consumes today from .
This is the state-contingent payoff from the bond and the stock position.
Pricing in Complete Markets
In this section, the analysis is changed to a pricing setting based on optimization principles. Assume that the two Arrow-Debreu securities are traded in the economy with two future states and that the net supply for both is one. The two payoff vectors form a standard basis for , and the market payoff matrix is:
Assume now that there is a representative agent in the economy that is the only one trading the two securities. In an equilibrium, the representative agent needs to hold the net supply of both securities because there is nobody else. The mechanism that ensures equilibrium is the prices of the two securities today, that is, the price vector:
The idea of equilibrium pricing is that this price vector needs to be adjusted in a way that the representative agent holds the net supply of all available financial assets. This is because otherwise there would be no equilibrium.
With the investment portfolio , the problem of the expected utility maximizing, representative agent is
or
Due to the special market payoff matrix, this translates into
and
The three first-order conditions for the unconstrained problem are:
What consequences for the prices follow from these optimality conditions? The first is with regard to the relative price of the two Arrow-Debreu securities:
The relative price is fully determined by the probabilities for the two states to occur and the marginal utilities gained from consumption in the two states. Factoring in that in equilibrium must hold, the relative price is determined by the probability measure only:
With this additional condition, one also obtains:
While the relative price is determined by the probability measure in this case, the absolute prices are determined by the initial wealth available. This is intuitively appealing in that the prices should be higher the more initial wealth there is, given that the net supply for two securities is fixed.
Normalizing initial wealth to , for instance, fixes the prices via
to finally arrive at the equilibrium prices of
or the equilibrium price vector .
Arbitrage Pricing
What about arbitrage prices of contingent claims given the equilibrium price vector ? In complete markets, in which every contingent claim is attainable, the price of any such attainable contingent claim is then given by:
This is because the replication portfolio is simply the state-contingent payoff itself in the special case of two Arrow-Debreu securities. The prices of Arrow-Debreu securities are therefore also called state prices because they represent the price for one unit of currency (consumption) in a certain state.
Martingale Pricing
How does the unique martingale measure look for the current economy? The condition for the martingale measure is that it makes all discounted price processes of traded financial assets a martingale. In matrix form, the conditions are:
More explicitly, one gets:
From these, follows and also . The physical probability measure makes all probabilities already a martingale. The other way around, the prices for the two Arrow-Debreu securities are set in equilibrium in a way such that the discounted price processes are martingales.
Every attainable contingent claim can be priced by simply taking the expectation under the physical probability measure in this special kind of representative agent economy. Formally, this translates into:
Risk-Less Interest Rate
Why is the equilibrium risk-less interest rate zero? The answer is quite simple: because there is no risk-less financial asset traded that fixes another interest rate. Consider a risk-less financial asset paying 1 in every state . The arbitrage price for this financial asset is
implying a risk-less interest rate of . Any other price , implying a positive risk-less interest rate, would also imply arbitrage opportunities.
A Numerical Example (I)
The equilibrium pricing analysis so far rests on a number of simplifying assumptions allowing for elegant solutions and simple relations. Consider now a case with the somehow more realistic numerical assumptions as used multiple times before.
Specifically, assume expected utility maximization based on logarithmic utility for the representative agent. Assume further price processes for the risk-less bond of
and for the risky stock of
The market payoff matrix accordingly is:
The physical probability measure is given by with . The net supply of the risk-less bond is , and it is for the risky stock. The initial wealth the agent has available shall be .
The problem of the representative agent is
or
The three first-order conditions are:
The relative price for the two financial assets according to the optimality conditions—and taking into account the net supply of one for both financial assets as well as the logarithmic utility—is:
Adding the budget constraint to the mix fixes not only the relative price but also the absolute price levels:
In Python, these considerations translate into simple vectorized operations using NumPy
:
In
[
57
]
:
p
=
1
/
3
In
[
58
]
:
P
=
np
.
array
(
(
p
,
(
1
-
p
)
)
)
In
[
59
]
:
B1
=
np
.
array
(
(
11
,
11
)
)
In
[
60
]
:
S1
=
np
.
array
(
(
20
,
5
)
)
In
[
61
]
:
zeta
=
np
.
dot
(
S1
/
(
B1
+
S1
)
,
P
)
/
np
.
dot
(
B1
/
(
B1
+
S1
)
,
P
)
In
[
62
]
:
zeta
Out
[
62
]
:
0.7342657342657343
In
[
63
]
:
w
=
15
In
[
64
]
:
B0
=
w
/
(
1
+
zeta
)
In
[
65
]
:
B0
Out
[
65
]
:
8.649193548387098
In
[
66
]
:
S0
=
zeta
*
B0
In
[
67
]
:
S0
Out
[
67
]
:
6.350806451612904
In
[
68
]
:
B0
+
S0
Out
[
68
]
:
15.000000000000002
In
[
69
]
:
i
=
B1
.
mean
(
)
/
B0
-
1
In
[
70
]
:
i
Out
[
70
]
:
0.2717948717948717
In
[
71
]
:
mu
=
np
.
dot
(
S1
,
P
)
/
S0
-
1
In
[
72
]
:
mu
Out
[
72
]
:
0.5746031746031743
The probability measure.
The price ratio
zeta
given optimality conditions.The initial wealth.
The equilibrium price level of the risk-less bond given the price ratio
zeta
and initial wealthw
.The resulting equilibrium price level of the risky stock.
The budget constraint is binding.
The equilibrium interest rate given the price level for the risk-less bond.
The equilibrium expected rate of return of the risky stock.
Equilibrium pricing does not lead in this case to the discounted price processes being martingales under the physical probability measure. The martingale measure is easily derived, however. The analysis uses the SymPy
package for symbolic computations with Python:
In
[
73
]
:
import
sympy
as
sy
In
[
74
]
:
q
=
sy
.
Symbol
(
'
q
'
)
In
[
75
]
:
eq
=
(
q
*
20
+
(
1
-
q
)
*
5
)
/
(
1
+
i
)
-
S0
In
[
76
]
:
eq
Out
[
76
]
:
11.7943548387097
*
q
-
2.41935483870968
In
[
77
]
:
q
=
sy
.
solve
(
eq
)
[
0
]
In
[
78
]
:
q
Out
[
78
]
:
0.205128205128205
In
[
79
]
:
Q
=
np
.
array
(
(
q
,
1
-
q
)
)
In
[
80
]
:
np
.
dot
(
B1
,
Q
)
/
(
1
+
i
)
Out
[
80
]
:
8.64919354838710
In
[
81
]
:
np
.
dot
(
S1
,
Q
)
/
(
1
+
i
)
Out
[
81
]
:
6.35080645161290
Pricing in Incomplete Markets
How does representative agent pricing work in incomplete markets? The answer fortunately is: exactly the same way as in complete markets.
Assume the two date, three-state economy in which a risk-less bond with price process
and a risky stock with price process
are traded. The physical probability measure is , with . Everything else shall be as in the previous section.
Formally, the optimization problem of the representative agent does not change:
Nor does the formula for the relative price change:
In Python, only the future price vectors of the financial assets and the vector representing the probability measure need to be adjusted:
In
[
82
]
:
p
=
1
/
3
In
[
83
]
:
P
=
np
.
array
(
(
p
,
p
,
p
)
)
In
[
84
]
:
B1
=
np
.
array
(
(
11
,
11
,
11
)
)
In
[
85
]
:
S1
=
np
.
array
(
(
20
,
10
,
5
)
)
In
[
86
]
:
zeta
=
np
.
dot
(
S1
/
(
B1
+
S1
)
,
P
)
/
np
.
dot
(
B1
/
(
B1
+
S1
)
,
P
)
In
[
87
]
:
zeta
Out
[
87
]
:
0.9155274934101636
In
[
88
]
:
w
=
15
In
[
89
]
:
B0
=
w
/
(
1
+
zeta
)
In
[
90
]
:
B0
Out
[
90
]
:
7.8307411674347165
In
[
91
]
:
S0
=
zeta
*
B0
In
[
92
]
:
S0
Out
[
92
]
:
7.169258832565284
In
[
93
]
:
B0
+
S0
Out
[
93
]
:
15.0
In
[
94
]
:
i
=
B1
.
mean
(
)
/
B0
-
1
In
[
95
]
:
i
Out
[
95
]
:
0.40472016183411985
In
[
96
]
:
mu
=
np
.
dot
(
S1
,
P
)
/
S0
-
1
In
[
97
]
:
mu
Out
[
97
]
:
0.6273183796451287
The probability measure.
The relative price
zeta
given optimality conditions.The initial wealth.
The equilibrium price level of the risk-less bond given the price ratio
zeta
and initial wealthw
.The resulting equilibrium price level of the risky stock.
The budget constraint is binding.
The equilibrium interest rate given the price level for the risk-less bond.
The equilibrium expected rate of return of the risky stock.
Representative Agent Pricing
The pricing of securities based on the optimization calculus of a representative agent is one approach that applies to both complete and incomplete markets. Instead of adjusting markets—for example, via market completion based on additional securities—additional assumptions are made with regard to the representative agent. For example, the initial wealth of the agent is required to arrive at specific, absolute prices for the securities instead of only relative prices.
Martingale Measures
Although representative agent pricing works in incomplete markets the same way as in complete ones, it unfortunately does not directly solve the problem of pricing contingent claims that are not attainable. There are still infinitely many martingale measures that are consistent with the market.
The Python code that follows shows that there are infinitely many martingale measures that are consistent with the equilibrium price processes as derived in the previous section:
In
[
98
]
:
qu
=
sy
.
Symbol
(
'
qu
'
)
qm
=
sy
.
Symbol
(
'
qm
'
)
In
[
99
]
:
eq
=
(
qu
*
20
+
qm
*
10
+
(
1
-
qu
-
qm
)
*
5
)
/
(
1
+
i
)
-
S0
In
[
100
]
:
eq
Out
[
100
]
:
3.55942780337942
*
qm
+
10.6782834101383
*
qu
-
3.60983102918587
In
[
101
]
:
Q
=
sy
.
solve
(
eq
,
set
=
True
)
In
[
102
]
:
Q
Out
[
102
]
:
(
[
qm
]
,
{
(
1.01416048550236
-
3.00000000000001
*
qu
,
)
}
)
Defining the symbols
qu
andqm
.Formulating the equation for
qu
andqm
given the martingale condition.The equation simplified.
This solves the equation numerically, providing a set of solutions as the result; this does not take into account the conditions .
The relationship between
qu
andqm
as the solution—indicating infinitely many solutions.
Martingale Measure in Incomplete Markets
Martingale pricing is a convenient and elegant approach in complete markets to value contingent claims. In incomplete markets, there are in general infinitely many martingale measures that are consistent with the market. In practice, one often solves this issue by relying on publicly observed market prices for liquidly trading contingent claims, such as plain vanilla European put or call options. These prices are used to calibrate model parameters or the martingale measure directly to be consistent with the market. For more background information and details about model calibration, see Hilpisch (2015).
Equilibrium Pricing
What about pricing contingent claims? If they are attainable through replication portfolios composed of traded financial assets, their price can be fixed by the usual arbitrage argument. What if a contingent claim is not attainable? In the simple incomplete market setting currently under investigation, this can only mean that the payoff vector is linearly independent of the two future price vectors of the traded financial assets. This in turn implies that the introduction of a contingent claim with such a payoff vector is market completing—because three linearly independent vectors form in any case a basis of .
Consider the market payoff matrix from the first two Arrow-Debreu securities, each available at a net supply of one:
This market is obviously incomplete because the two securities do not span . Introducing a contingent claim with net supply of one that pays one unit of currency in the state—that is, a contingent claim that pays exactly what the third Arrow-Debreu security would pay—completes the market as seen by the resulting payoff matrix:
The three payoff vectors now form a standard basis of the .
Formally, the optimization problem of the representative agent is the same as before:
Here, as the state price vector and as the market portfolio.
In explicit form, the unconstrained optimization problem according to the Theorem of Lagrange is:
The four first-order conditions for the unconstrained problem are:
For the relative prices, one gets:
Through these, the third relative price is fixed as well. With logarithmic utility and an initial wealth fixed at , one finally arrives in this special case at:
The equilibrium price vector is , which equals the vector representing the probability measure. This in turn implies that all discounted price processes are martingales under the physical probability measure.
A Numerical Example (II)
Getting back to the numerical example from before: assume expected utility maximization based on logarithmic utility for the representative agent. Assume further price processes for the risk-less bond of
and for the risky stock of
The market payoff matrix is:
The physical probability measure is given by , with . The net supply of the risk-less bond is , and it is for the risky stock. The initial wealth the agent has available shall be .
A contingent claim is introduced with payoff and a net supply of .
Consequently, the problem of the representative agent is:
or
The four first-order conditions are:
The relative prices for the three financial assets are fixed through:
Adding the budget constraint to the mix fixes not only the relative prices and but also the absolute price levels:
The adjustments to the Python code are only minor compared to the complete markets case:
In
[
103
]
:
p
=
1
/
3
In
[
104
]
:
P
=
np
.
array
(
(
p
,
p
,
p
)
)
In
[
105
]
:
B1
=
np
.
array
(
(
11
,
11
,
11
)
)
In
[
106
]
:
S1
=
np
.
array
(
(
20
,
10
,
5
)
)
In
[
107
]
:
C1
=
np
.
array
(
(
5
,
0
,
0
)
)
In
[
108
]
:
zeta_1
=
(
np
.
dot
(
S1
/
(
B1
+
S1
+
C1
)
,
P
)
/
np
.
dot
(
B1
/
(
B1
+
S1
+
C1
)
,
P
)
)
In
[
109
]
:
zeta_1
Out
[
109
]
:
0.8862001308044474
In
[
110
]
:
zeta_2
=
(
np
.
dot
(
C1
/
(
B1
+
S1
+
C1
)
,
P
)
/
np
.
dot
(
B1
/
(
B1
+
S1
+
C1
)
,
P
)
)
In
[
111
]
:
zeta_2
Out
[
111
]
:
0.09156311314584695
In
[
112
]
:
w
=
15
In
[
113
]
:
B0
=
w
/
(
1
+
zeta_1
+
zeta_2
)
In
[
114
]
:
B0
Out
[
114
]
:
7.584325396825396
In
[
115
]
:
S0
=
zeta_1
*
B0
In
[
116
]
:
S0
Out
[
116
]
:
6.721230158730158
In
[
117
]
:
C0
=
zeta_2
*
B0
In
[
118
]
:
C0
Out
[
118
]
:
0.6944444444444443
In
[
119
]
:
B0
+
S0
+
C0
Out
[
119
]
:
14.999999999999998
In
[
120
]
:
i
=
B1
.
mean
(
)
/
B0
-
1
In
[
121
]
:
i
Out
[
121
]
:
0.45035971223021587
In
[
122
]
:
muS
=
np
.
dot
(
S1
,
P
)
/
S0
-
1
In
[
123
]
:
muS
Out
[
123
]
:
0.7357933579335794
In
[
124
]
:
muC
=
np
.
dot
(
C1
,
P
)
/
C0
-
1
In
[
125
]
:
muC
Out
[
125
]
:
1.4000000000000004
The probability measure.
The payoff vectors.
The first relative price.
The second relative price.
The initial wealth…
…and the resulting price for the risk-less bond.
The equilibrium price for the risky stock.
The equilibrium price for the contingent claim.
The budget constraint is binding.
The risk-less interest rate.
The equilibrium expected rate of return for the risky stock.
The equilibrium expected rate of return for the contingent claim.
That the introduction of the contingent claim—as a third traded financial asset—is market completing can be seen by the fact that there is now a unique martingale measure:
In
[
126
]
:
M
=
np
.
array
(
(
B1
,
S1
,
C1
)
)
.
T
In
[
127
]
:
M
Out
[
127
]
:
array
(
[
[
11
,
20
,
5
]
,
[
11
,
10
,
0
]
,
[
11
,
5
,
0
]
]
)
In
[
128
]
:
M0
=
np
.
array
(
(
B0
,
S0
,
C0
)
)
In
[
129
]
:
Q
=
np
.
linalg
.
solve
(
M
.
T
/
(
1
+
i
)
,
M0
)
In
[
130
]
:
Q
Out
[
130
]
:
array
(
[
0.20144
,
0.34532
,
0.45324
]
)
In
[
131
]
:
sum
(
Q
)
Out
[
131
]
:
1.0
In
[
132
]
:
np
.
allclose
(
np
.
dot
(
M
.
T
,
Q
)
,
M0
*
(
1
+
i
)
)
Out
[
132
]
:
True
The new market payoff matrix including the contingent claim.
The vector with the prices of the three financial assets/contingent claims.
This solves for the vector
Q
representing the martingale measure (note the use of the transpose operator.T
).The solution vector whose components add up to 1.
A final check whether all discounted price processes are indeed martingales.
Conclusions
This chapter is concerned with the modeling of agents and their optimization problems, mainly on the basis of the expected utility maximization approach. Two central topics are discussed: optimal portfolio choice and equilibrium pricing of financial assets and contingent claims in complete and incomplete markets. While in the first case the prices are given and the quantities in the investment portfolio are chosen, in the latter case the quantities to be held in the investment portfolio are fixed, and the prices are adjusted for this to be optimal for the representative agent. Python proves once again a powerful ecosystem with helpful packages to model and solve the related optimization problems.
Although the model economies in this and the previous two chapters are admittedly simplistic, the techniques and methods introduced carry over to general static model economies, that is, those having many more—even countably infinite—different future states (instead of two or three only). With some additional formalism, they even carry over to dynamic economies with many—potentially countably infinite—relevant points in time (instead of just two).
Further Resources
Books cited in this chapter:
1 Utility is only to be understood in ordinal terms, that is, in terms of bringing different plans into a certain order. A comparison of this numerical value with the optimal one from before does not make any sense because the utility functions are different.
Get Financial Theory with Python now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.