Errata

Python for Algorithmic Trading

Errata for Python for Algorithmic Trading

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
Printed Page 11
Table 1-0

Regarding to the original paper "Man vs. Machine: Comparing Discretionary and Systematic Hedge Fund Performance", https://www.readcube.com/articles/10.2139%2Fssrn.2880641, at the column for Systematic macro in the table on page2, the adjusted return volatility is 10.93%.

So it has to be corrected from 0.93% to 10.93%.

Sumet Ketsri  Dec 18, 2021 
Printed Page 12, 191
URL for Quantopian

The link to Quantopian is broken.
Can you give the new link?
It seems that quantopian's resources such as source code have been moved to github.

github.com/quantopian

Ryoko  Dec 20, 2021 
Printed Page 33
Code at top of page

The wim configuration file is not found.

wget url/.vimrc #Vim confguration

gives error:
#8 123.7 Executing transaction: ...working... done
#8 125.2 --2021-12-13 15:08:49-- url/.vimrc
#8 125.2 Resolving hilpisch.com (hilpisch.com)... 167.172.171.144
#8 125.3 Connecting to hilpisch.com (hilpisch.com)|167.172.171.144|:80... connected.
#8 125.3 HTTP request sent, awaiting response... 404 Not Found
#8 125.4 2021-12-13 15:08:50 ERROR 404: Not Found.

perre39  Dec 13, 2021 
Printed Page 61
Enumeration after the code block at the top

Item 6 says "Prints three data rows from every DataFrame object", however the output provided on pages 60-61 show 5 lines printed from every data frame.

Artem  Dec 30, 2021 
Printed Page 71
Middle of the page

The explanation for item 1 says "This generates a sample financial data set with 2,500,000 rows and five columns with a one second frequency; the sample data is rounded to two digits."
It should probably say "... the sample data is rounded to four decimal places".

Artem  Dec 30, 2021 
Printed Page 98
The first paragraph below the enumeration

The text says "The gross performance of the strategy with the original parameterization is 1.24 or 124%. The optimized strategy yields an absolute return of 1.44 or 144%...", whereas the output and plots suggest the performance of the original strategy is 1.29 and of the optimised strategy - 1.50.

Artem  Dec 30, 2021 
Printed Page 147
Top paragraph

The paragraph says "Logistic regression improves the hit ratio compared to linear regression by more than a percentage point to about 54.5%".
However the examples below show the hit ratios of 53.4% and 53.1%, so it's not clear where the value 54.5% is coming from.

The paragraph then states "Although the hit ratio is higher, the performance is worse than with linear regression"
However the example of linear regression for GLD earlier in the chapter used 7 lags, out-of-sample data and included transaction costs, whereas the example of logistic regression uses 3 or 5 lags in-sample and without transaction costs, so the conclusion about one out-performing the other is not self-evident.

Artem  Dec 31, 2021 
Printed Page 157
Import statement at bottom of page

Adam and RMSprop cannot be imported directly from keras.optimizers. It must be imported indirectly via tensorflow.keras.optimizers

Arthur DaVega  Feb 27, 2022 
Printed Page 164
The first paragraph below the plot

The paragraph says "The classifier also performs significantly better, ceteris paribus, when compared to the case without the additional features".
However, ceteris does not appear to be quite paribus in this case, as the number of neurons in the hidden layer changed from 64 to 32 and the number of epochs went from 50 to 25 between the two cases - the impact of these changes on the performance of the classifier is not clarified.

Artem  Dec 31, 2021 
Printed Page 177
last paragraph

The 1st sentence:
With regard to the special method __main__,

__main__ should be __init__?

Ryoko  Dec 18, 2021 
Printed Page 177
__init__ method at the bottom of the page

There is no private _amount variable as mentioned in the preceding paragraph. Instead it is called initial_amount and is public.

Arthur Goodell  Feb 21, 2022 
Printed Page 178
Definition of the plot_data function

The argument cols does not appear to be used when selecting the columns to plot in the plot_data function (it always plots the price).

Artem  Dec 31, 2021 
Printed Page 198
The code fragment

The SMA and momentum strategies use all the cash available when going long or short, whereas the mean-reversion strategy only seems to use the initial_amount, which might put it at a disadvantage when comparing its performance to the other strategies?

Artem  Dec 31, 2021 
PDF Page 211
4th paragraph

The code fragment:
"FigureWidget({
'data': [{'type': 'scatter', 'uid':
'e1a65f25-287d-4021-a210-c2f41f32426a'}], 'layout': {'t…"

'layout' field is incomplete.

Anonymous  May 16, 2022 
Printed Page 232
Footnote at the bottom of the page

Typo in the word "implicitely"

Artem  Dec 31, 2021 
Printed Page 241
Enumeration at the top of the page

Item 13 says "...a buy order for 0 is initiated"
Should it be instead "...a buy order for self.units * 2 is initiated"?

Similarly for item 19.

Artem  Dec 31, 2021 
Printed Page 242
Enumeration at the top of the page

Item 6 says "This starts the streaming and therewith the trading; it stops after 100 ticks", whereas the code on page 241 seems to suggest the streaming stops after 500 ticks?

Artem  Dec 31, 2021 
Printed Page 297
Last paragraph

Typos in the fourth line: "sbased" and "son".

Artem  Dec 31, 2021 
Printed Page 299
The first paragraph in the "Visual Step-by-Step Overview" section

The paragraph says "While the previous sections are based on the FXCM trading platform...", but it seems that the preceding sections in this chapter are based on Oanda?

Artem  Dec 31, 2021 
Printed Page 311
top code snippet and its description

The code and the description of 3 and 4 seem to be reversed.

(3) Addition.
(4) Difference.

should be

(3) Difference.
(4) Addition.

Ryoko  Dec 18, 2021 
Printed Page 313
The explanation in (6)

The correct name is f-strings, not f-string?

Ryoko  Dec 18, 2021 
Printed Page 318
The code example at the top

The logic of the example suggests it's meant to demonstrate using a variable-length argument, however the list is passed as a single argument, so the args variable in f will only contain a single value (which is the list object) and will print only one line.

For the list to be interpreted as separate arguments, it has to be passed as:
f(*l)
This will print five lines with one letter in each line.

Artem  Dec 31, 2021 
Printed Page 322
First enumeration from the top

Item 2 says "Selects the third row and fifth (final) row."
Should presumably be "... and fifth (final) column."

Artem  Dec 31, 2021