A memo of the stumbling point in the book "System Trade Starting with Python 3".
p26
First ez_setup.Download py. You can download it from the next page.
http://trac.edgewall.org/wiki/TracPlugins
-The target file was not found on the specified page. ・ Currently (2017/07/08), easy_install can be used without ez_setup.py. -Therefore, skip "2.2.1.1 easy_install settings" on pages 26-27.
p62
price=pdr.DataReader("N225","yahoo","1984/1/4",end)
price.head(1)
・ The following error occurred
ConnectionError: HTTPConnectionPool(host='ichart.finance.yahoo.com', port=80): Max retries exceeded with url: /table.csv?s=N225&a=0&b=4&c=1984&d=6&e=7&f=2017&g=d&ignore=.csv (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x000002A7A3C4F5F8>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',))
-The downloaded readme.txt has the following description, is this the cause?
readme.txt
July 4, 2017 Suspension of download service for US stock prices, etc. using Yahoo Finance API
p77
ave=n225[dates[i]:dates[i+1]].pct_change().mean()*250
・ Does this mean that "250 times the average daily change rate is the one-year change rate"? ・ I think it's okay to calculate with 1 year = 250 days, -The truth is, the Harmonic Mean (https://ja.wikipedia.org/wiki/%E8%AA%BF%E5%92%8C%E5%B9%B3%E5%9D%87) or something is correct I feel like ・ Is the book method correct? Actually it is not correct, but is it OK as a simple calculation?
p77
vol=np.log(n225[dates[i]:dates[i+1]]).diff().std()*np.sqrt(250)
・ Because the average standard deviation was "root ((sum of standard deviation ^ 2) ÷ n)" ・ The addition of standard deviation is "root (sum of standard deviation ^ 2)", that is, ・ Does the multiplication of standard deviation mean "root (standard deviation ^ 2 x 250)" = "standard deviation x route (250)"? (I thought ... but it's not, I'm confused about understanding the calculation)
When I executed the command on p97 "6.4.9 Static analysis", a red message appeared and I was surprised. But now it looks like there is no problem.
message
The pandas.core.datetools module is deprecated and will be removed in a future version. Please use the pandas.tseries module instead.
from pandas.core import datetools
google translate
pandas.core.The datetools module has been deprecated and will be removed in a future version. Instead pandas.Use the tseries module.
pandas.Import from core datetools
p97
n225 = pdr.DataReader("NIKKEI225", 'fred',"1949/5/16",end).dropna()
lnn225=np.log(n225.dropna())
It looks like dropna () is doubled. Does it make any sense?
After downloading the materials, I could carry out the exercises as they were, so it was easy to try, but ... It was not a book that I could enjoy reading and understanding, such as explaining statistics. But it's an interesting field, so I'll try something again somewhere.
This is the end of the book. Thank you very much.
Recommended Posts