Errata

Python for Finance

Errata for Python for Finance

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
PDF, ePub, Mobi United Kingdom

Where do we find the source code for the book or the iPYNB Notebooks Pyhton for Finance - Yves Hipisch.
Amit Nandi

Amit Nandi  Sep 28, 2014 
in references section of Chapter 16

just a nit, but...

Merton(1976) is in

Volume 3, Issues 1–2

not

Volume 3, No. 3

John Aiello  Dec 03, 2015 
Printed Page 1
403

In the code below

plt.hist(log_returns.flatten(), bins = 70, normed = True,
label = 'frequency', color = 'b')


'normed' should be 'density'

Yuntaek Pae  Jul 05, 2020 
ePub Page 17 - 18
3rd paragraph

Incorrect Formula - ST = S0 * exp ( r * T + sigma * sqrt ( T ) * z )

Should be ST = S0 * exp ( (r - 0.5*sigma^2) * T + sigma * sqrt ( T ) * z )

Anonymous  May 05, 2014 
Mobi Page 44
United States

In the section "Writing a Python function without saving it", the first code example given

>>>def pv_f(pv, r, n):
>>> return fv/(1+r)**n

Has pv as the first argument, should be fv

>>>def pv_f(fv, r, n):
>>> return fv/(1+r)**n

Anonymous  May 18, 2014 
Printed Page 53
Middle of page, vega = s0...

Believe the cdf function should be changed to the pdf function as highlighted below:

what has been printed:
vega = s0*stats.norm.cdf(d1, 0.0, 1.0)*sqrt(t)

Suggestion:
vega = s0*stats.norm.pdf(d1, 0.0, 1.0)*sqrt(t)


Anonymous  Aug 10, 2017 
ePub Page 91
bsm_vega

d1 in the definition of bsm_vega is incorrect (dimensional analysis suffices to confirm this) and should be the same as d1 as defined for bsm_call_value.

Anonymous  Oct 28, 2014 
PDF, ePub Page 107
United Kingdom

Formulae for d1 and vega are incorrect

d1 and vega should be given by

d1 = (log(S0 / K) + (r + 0.5 * sigma ** 2) * T) / (sigma * sqrt(T))

vega = S0 * stats.norm.pdf(d1, 0.0, 1.0) * sqrt(T)

This can be easily validated by taking numerical derivatives of bsm_call_value.

Jonathan Coe  Aug 15, 2014 
PDF, ePub Page 108
United Kingdom

bsm_call_imp_vol as defined shows poor convergence compared to scipy.optimize.fsolve and does not allow early exit in the cases where it does converge. The Newton-Raphson method is understood to converge quickly if at all.

I think that a better numerical algorithm could be employed here.

Anonymous  Aug 15, 2014 
Printed Page 116
1st paragraph

Line "but rather access the two data subsets separately (y[:, 0] and y[:, 0]), which allows" shuld say "... (y[:, 0] and y[:, 1])...".

Jose Luis Fernandez Barros  Dec 21, 2016 
Printed Page 171
2nd paragraph

Book reference:
"• McKinney, Wes (2012): Data Analysis with Python. O’Reilly, Sebastopol, CA."
may want to refer to "Python for Data Analysis" book.

Jose Luis Fernandez Barros  Jan 03, 2017 
Printed Page 324
last paragraph

Quotation mark in "“In what follows, we assume that an investor is not allowed to set up short positions in" opens but never closes.

Jose Luis Fernandez Barros  Jan 03, 2017 
Printed Page 325
last paragraph

"σij = σji = E(ri – μi)(rj – μj))" lacks one parenthesis: E((ri – μi)(rj – μj))

Jose Luis Fernandez Barros  Jan 03, 2017 
PDF Page 333
bottom paragraph

The call to scipy is written incorrectly. It should be scipy.optimize.minimize, and the importation should be from scipy import optimize.

Christopher Pimentel   Mar 05, 2021 
342
BAYES’S FORMULA Calculation

The calculation of the normalizing constant is incorrect. Rather than:

Normalizing constant: p(D) = 0.5 · 0.2 + 0.5 · 0.4 = 0.3

It should be:

Normalizing constant: p(D) = 0.5 · 20/90 + 0.5 · 40/90 = 0.3333333333333333

Anonymous  Jan 28, 2018 
Printed Page 404
Bottom

sm.qqplot(log_returns.flatten()[::500], line = 's')

--> sm.qqplot(log_returns.flatten()[:500], line = 's')

Yuntaek Pae  Jul 05, 2020 
Printed Page 432
bottom

trace = pm.sample(100, tune = 1000, start = start,
progressbar = True, verbose = False)

--> trace = pm.sample(100, tune = 1000, start = start,
progressbar = True)


'verbose = False' causes error. Without it, program runs fine.

Yuntaek Pae  Jul 05, 2020 
Printed Page 435
bottom

data.ix[-1] / data.ix[0] - 1

->
data.iloc[-1] / data.iloc[0] - 1

There is no .ix.

Yuntaek Pae  Jul 05, 2020