@@ -15,7 +15,7 @@ Supported statistics/indicators are:
1515
1616* change (in percent)
1717* delta
18- * permutation (zero based)
18+ * permutation (zero- based)
1919* log return
2020* max in range
2121* min in range
@@ -61,7 +61,7 @@ Supported statistics/indicators are:
6161
6262## Compatibility
6363
64- The build checks the compatibility for the last two major release of python3 and
64+ The build checks the compatibility for the last two major releases of python3 and
6565the last release of python2.
6666
6767## License
@@ -73,14 +73,14 @@ the last release of python2.
7373### Initialization
7474
7575` StockDataFrame ` works as a wrapper for the ` pandas.DataFrame ` . You need to
76- Initialize the ` StockDataFrame ` with ` wrap ` or ` retype ` .
76+ Initialize the ` StockDataFrame ` with ` wrap ` or ` StockDataFrame. retype` .
7777
7878``` python
7979import pandas as pd
80- from stockstats import StockDataFrame
80+ from stockstats import wrap
8181
82- df = pd.read_csv(' stock.csv' )
83- stock = StockDataFrame. wrap(df )
82+ data = pd.read_csv(' stock.csv' )
83+ df = wrap(data )
8484```
8585
8686Formalize your data. This package takes for granted that your data is sorted by
@@ -137,56 +137,54 @@ of `pandas.DataFrame` should work the same as before.
137137#### Retrieve the data with symbol
138138
139139We allow the user to access the statistics directly with some specified column
140- name, such as: ` kdjk ` , ` macd ` , ` rsi ` .
140+ name, such as ` kdjk ` , ` macd ` , ` rsi ` .
141141
142- Note that the value of these columns are calculated the first time you access
143- them from the data frame. You need to delete those columns first if you want the
144- lib to re-evaluate the value .
142+ The values of these columns are calculated the first time you access
143+ them from the data frame. Please delete those columns first if you want the
144+ lib to re-evaluate them .
145145
146146#### Retrieve the Series
147147
148- If you need the ` Series ` , you can use ` macd = stock['macd'] `
149- or ` rsi = stock.get('rsi') ` .
148+ Use ` macd = stock['macd'] ` or ` rsi = stock.get('rsi') ` to retrieve the ` Series ` .
150149
151150#### Retrieve the symbol with 2 arguments
152151
153- For some statistics, we allow the user to supply the column name and the window,
154- such as: delta, shift, simple moving average, etc. You can use the following
155- patter to calculate them: ` <columnName>_<windowSize>_<statistics> `
152+ Some statistics need the column name and the window size ,
153+ such as delta, shift, simple moving average, etc. Use this patter to retrieve
154+ them: ` <columnName>_<windowSize>_<statistics> `
156155
157- Here are some examples for the pattern :
156+ Examples :
158157
159158* 5 periods simple moving average of the high price: ` high_5_sma `
160159* 10 periods exponential moving average of the close: ` close_10_ema `
161- * 1 period delta of the high price: ` high_-1_d `
162- The ` - ` symbol stands for looking backwards .
160+ * 1 period delta of the high price: ` high_-1_d ` .
161+ The minus symbol means looking backward .
163162
164- #### Retrieve the symbol with 1 arguments
163+ #### Retrieve the symbol with 1 argument
165164
166- Some statistics allows the user to specify the window but not the column. Use
167- following patter to specify your window: ` <statistics>_<windowSize> `
165+ Some statistics require the window size but not the column name . Use
166+ this patter to specify your window: ` <statistics>_<windowSize> `
168167
169- For example :
168+ Examples :
170169
171170* 6 periods RSI: ` rsi_6 `
172171* 10 periods CCI: ` cci_10 `
173172* 13 periods ATR: ` atr_13 `
174173
175- Normally, these statistics have default windows.
176- Check their document for detail.
174+ Some of them have default windows. Check their document for detail.
177175
178176#### Initialize all indicators with shortcuts
179177
180- Some indicators, such as: KDJ, BOLL, MFI, have shortcuts. Use ` df.init_all() `
181- to initialize the series of all these indicators.
178+ Some indicators, such as KDJ, BOLL, MFI, have shortcuts. Use ` df.init_all() `
179+ to initialize all these indicators.
182180
183181This operation generates lots of columns. Please use it with caution.
184182
185183### Statistics/Indicators
186184
187- Some statistics has configurable parameters. They are class level fields. Change
188- of these fields are global. And they won't affect the existing results. Removing
189- existing results to trigger the re-calculation of these columns .
185+ Some statistics have configurable parameters. They are class- level fields. Change
186+ of these fields is global. And they won't affect the existing results. Removing
187+ existing columns so that they will be re-evaluated the next time you access them .
190188
191189#### Change of the Close
192190
@@ -198,10 +196,9 @@ Using pattern `<column>_<window>_d` to retrieve the delta between different peri
198196
199197You can also use ` <column>_delta ` as a shortcut to ` <column>_-1_d `
200198
201-
202- For example:
199+ Examples:
203200* ` df['close_-1_d'] ` retrieves the close price delta between current and prev. period.
204- * ` df['close_delta'] ` is the save as ` df['close_-1_d'] `
201+ * ` df['close_delta'] ` is the same as ` df['close_-1_d'] `
205202* ` df['high_2_d'] ` retrieves the high price delta between current and 2 days later
206203
207204#### Shift Periods
@@ -255,11 +252,11 @@ Use `df['log-ret']` to access this column.
255252
256253#### Count of Non-Zero Value
257254
258- Count non-zero value of a specific range. It requires a column and a window.
255+ Count non-zero values of a specific range. It requires a column and a window.
259256
260257Examples:
261258
262- * count how many typical price are larger than close in the past 10 periods
259+ * Count how many typical prices are larger than close in the past 10 periods
263260
264261``` python
265262In [22 ]: tp = df[' middle' ]
@@ -358,7 +355,7 @@ Wave trend uses two parameters. You can tune them with
358355
359356#### SMMA - Smoothed Moving Average
360357
361- It takes two parameters, column and window.
358+ It requires column and window.
362359
363360For example, use ` df['close_7_smma'] ` to retrieve the 7 periods smoothed moving
364361average of the close price.
@@ -376,7 +373,7 @@ TripleEMA = EMA of EMA of EMA
376373LastTripleEMA = TripleEMA of the last period
377374```
378375
379- It takes two parameters, column and window. By default, the column is ` close ` ,
376+ It requires column and window. By default, the column is ` close ` ,
380377the window is 12.
381378
382379Use ` StockDataFrame.TRIX_EMA_WINDOW ` to change the default window.
@@ -406,7 +403,7 @@ Examples:
406403
407404#### [ VR - Volume Variation Index] ( https://help.eaglesmarkets.com/hc/en-us/articles/900002867026-Summary-of-volume-variation-index )
408405
409- It is the strength index of trading volume.
406+ It is the strength index of the trading volume.
410407
411408It has a default window of 26. Change it with ` StockDataFrame.VR ` .
412409
@@ -442,7 +439,7 @@ Examples:
442439
443440#### TR - True Range of Trading
444441
445- TR is a measure of volatility of a High-Low-Close series. It is used for
442+ TR is a measure of the volatility of a High-Low-Close series. It is used for
446443calculating the ATR.
447444
448445#### [ ATR - Average True Range] ( https://en.wikipedia.org/wiki/Average_true_range )
@@ -473,7 +470,7 @@ It has 2 parameters:
473470
474471#### DMA - Difference of Moving Average
475472
476- ` df['dma'] ` retreives the difference of 10 periods SMA of the close price and
473+ ` df['dma'] ` retrieves the difference of 10 periods SMA of the close price and
477474the 50 periods SMA of the close price.
478475
479476#### [ DMI - Directional Movement Index] ( https://www.investopedia.com/terms/d/dmi.asp )
@@ -510,7 +507,7 @@ It includes three lines:
510507The default window is 9. Use ` StockDataFrame.KDJ_WINDOW ` to change it.
511508Use ` df['kdjk_6'] ` to retrieve the K series of 6 periods.
512509
513- KDJ also has two configurable parameter named ` StockDataFrame.KDJ_PARAM ` .
510+ KDJ also has two configurable parameters named ` StockDataFrame.KDJ_PARAM ` .
514511The default value is ` (2.0/3.0, 1.0/3.0) `
515512
516513#### [ CR - Energy Index] ( https://support.futunn.com/en/topic167/?lang=en-us )
@@ -545,7 +542,7 @@ The default period of the Bollinger Band can be changed with
545542#### [ MACD - Moving Average Convergence Divergence] ( https://en.wikipedia.org/wiki/MACD )
546543
547544We use the close price to calculate the MACD lines.
548- * ` df['macd'] ` is the difference between two exponential moving average .
545+ * ` df['macd'] ` is the difference between two exponential moving averages .
549546* ` df['macds] ` is the signal line.
550547* ` df['macdh'] ` is he histogram line.
551548
@@ -573,7 +570,7 @@ The period of the signal line can be tuned with
573570
574571#### [ Simple Moving Average] ( https://www.investopedia.com/terms/m/mean.asp )
575572
576- Follow the pattern ` <columnName>_<window>_sma ` to retrieve simple moving average.
573+ Follow the pattern ` <columnName>_<window>_sma ` to retrieve a simple moving average.
577574
578575#### [ Moving Standard Deviation] ( https://www.investopedia.com/terms/s/standarddeviation.asp )
579576
@@ -622,7 +619,7 @@ Examples:
622619Kaufman's Adaptive Moving Average is designed to account for market noise or
623620volatility.
624621
625- It has 2 optional parameter and 2 required parameter
622+ It has 2 optional parameters and 2 required parameters
626623* fast - optional, the parameter for fast EMA smoothing, default to 5
627624* slow - optional, the parameter for slow EMA smoothing, default to 34
628625* column - required, the column to calculate
@@ -645,9 +642,9 @@ Use the pattern `<A>_xd_<B>` to check when A crosses down B.
645642Use the pattern ` <A>_x_<B> ` to check when A crosses B.
646643
647644Examples:
648- * ` kdjk_x_kdjd ` returns a series marks the cross of KDJK and KDJD
649- * ` kdjk_xu_kdjd ` returns a series marks where KDJK crosses up KDJD
650- * ` kdjk_xd_kdjd ` returns a series marks where KDJD crosses down KDJD
645+ * ` kdjk_x_kdjd ` returns a series that marks the cross of KDJK and KDJD
646+ * ` kdjk_xu_kdjd ` returns a series that marks where KDJK crosses up KDJD
647+ * ` kdjk_xd_kdjd ` returns a series that marks where KDJD crosses down KDJD
651648
652649## Issues
653650
@@ -664,4 +661,4 @@ cryptowatch, tradingview, etc.
664661
665662## Contact author:
666663
667- - Cedric Zhuang < jealous@163.com >
664+ * Cedric Zhuang < jealous@163.com >
0 commit comments