"System trade starting with Python3" reading memo

System trade starting with Python 3

A memo of the stumbling point in the book "System Trade Starting with Python 3".

1. 1. ez_setup.py not found

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.

2. Error in data acquisition from US Yahoo Finance

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

3. 3. Calculation of annual rate of return

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?

4. Calculation of volatility

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)

5. The pandas.core.datetools module will be discontinued in the future

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

6. Is dropna () double?

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?

Give up

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

"System trade starting with Python3" reading memo
System trade starting with Python3: Get the latest program code
System trading starting with Python3: long-term investment
Python starting with Windows 7
GRPC starting with Python
Reading and writing fits files with Python (memo)
System trading starting with Python 3: Investment and risk
Twitter graphing memo with Python
Reinforcement learning starting with Python
Introduction to Mathematics Starting with Python Study Memo Vol.1
Reading .txt files with Python
System Trade Beginning with Python 3: Hedge Funds and CTA
Presentation Support System with Python3
Python starting with Hello world!
System trade starting with Python3: Bio-health stocks to look at in the new Corona
python memo --Specify options with getopt
Input / output with Python (Python learning memo ⑤)
Make a recommender system with python
Reading and writing NetCDF with Python
Multi-line size specification reading with python
Reading and writing CSV with Python
Data analysis starting with python (data visualization 1)
"Scraping & machine learning with Python" Learning memo
Data analysis starting with python (data visualization 2)
[Memo] Tweet on twitter with python
Python memo
python memo
[System trade] I tried playing with Stochastic Oscillator by decomposing with python ♬
Python memo
python memo
Python memo
Python memo
Python memo
Convert memo at once with Python 2to3
Memo to ask for KPI with python
A memo with Python2.7 and Python3 on CentOS
Business efficiency starting from scratch with Python
Reading and writing JSON files with Python
[Easy Python] Reading Excel files with openpyxl
Data analysis starting with python (data preprocessing-machine learning)
"First Elasticsearch" starting with a python client
[Easy Python] Reading Excel files with pandas
Memo of troubles about coexistence of Python 2/3 system
FizzBuzz with Python3
Scraping with Python
Machine learning starting with Python Personal memorandum Part2
python beginner memo (9.2-10)
Investment quest: Make a system trade with pyhton (2)
Statistics with python
Scraping with Python
Python with Go
python beginner memo (9.1)
Machine learning starting with Python Personal memorandum Part1
Investment quest: Make a system trade with pyhton (1)
Twilio with Python
Integrate with Python
Play with 2016-Python
AES256 with python
Tested with Python
★ Memo ★ Python Iroha
python starts with ()