Skip to content

Commit 29b6438

Browse files
committed
test/ma+boll: more test cases for ma on boll
1 parent 36753de commit 29b6438

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

docs/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,13 @@ stock['ma:5']
493493
stock['ma:10,open']
494494
```
495495

496+
Advanced usage
497+
498+
```py
499+
# The 5-period moving average for the upper bollinger band
500+
stock['ma:5,(boll.upper:21,2)']
501+
```
502+
496503
### `ema`, Exponential Moving Average
497504

498505
```

test/test_commands.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ def test_boll(stock):
8888
assert stock['column:open > boll.u']['2020-01-14']
8989
assert stock['column:close > boll']['2020-02-05']
9090

91+
boll = stock['boll.upper']
92+
maboll = stock['ma:2,boll.upper']
93+
assert maboll.iloc[-1] == (boll.iloc[-1] + boll.iloc[-2]) / 2
94+
9195

9296
def test_donchian(stock):
9397
assert stock['donchian.upper:20'].equals(stock['hhv:20'])

0 commit comments

Comments
 (0)