Skip to content

Commit a7d1d4f

Browse files
committed
MNT: Adapt examples for updated jupytext behavior
1 parent 76465a4 commit a7d1d4f

File tree

5 files changed

+15
-5
lines changed

5 files changed

+15
-5
lines changed

doc/examples/Multiple Time Frames.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# extension: .py
66
# format_name: light
77
# format_version: '1.3'
8-
# jupytext_version: 0.8.6
8+
# jupytext_version: 1.0.2
99
# kernelspec:
1010
# display_name: Python 3
1111
# language: python
@@ -51,6 +51,8 @@ def RSI(array, n):
5151
loss[loss > 0] = 0
5252
rs = gain.ewm(n).mean() / loss.abs().ewm(n).mean()
5353
return 100 - 100 / (1 + rs)
54+
55+
5456
# -
5557

5658
# The strategy roughly goes like this:

doc/examples/Parameter Heatmap.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# extension: .py
77
# format_name: light
88
# format_version: '1.3'
9-
# jupytext_version: 0.8.6
9+
# jupytext_version: 1.0.2
1010
# kernelspec:
1111
# display_name: Python 3
1212
# language: python
@@ -83,6 +83,8 @@ def next(self):
8383
crossover(self.data.Close, self.sma_exit)):
8484

8585
self.position.close()
86+
87+
8688
# -
8789

8890
# It's not a robust strategy, but we can optimize it. Let's optimize our strategy on Google stock data.

doc/examples/Quick Start User Guide.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# extension: .py
77
# format_name: light
88
# format_version: '1.3'
9-
# jupytext_version: 0.8.6
9+
# jupytext_version: 1.0.2
1010
# kernelspec:
1111
# display_name: Python 3
1212
# language: python
@@ -58,6 +58,8 @@ def SMA(values, n):
5858
each step taking into account `n` previous values.
5959
"""
6060
return pd.Series(values).rolling(n).mean()
61+
62+
6163
# -
6264

6365
# Note, this is the exact same helper function as the one used in the project unit tests, so we could just import that instead.
@@ -99,6 +101,8 @@ def next(self):
99101
# Else, if sma1 crosses below sma2, sell it
100102
elif crossover(self.sma2, self.sma1):
101103
self.sell()
104+
105+
102106
# -
103107

104108
# In `init()` as well as in `next()`, the data the strategy is simulated on is available as an instance variable

doc/examples/Strategies Library.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# extension: .py
66
# format_name: light
77
# format_version: '1.3'
8-
# jupytext_version: 0.8.6
8+
# jupytext_version: 1.0.2
99
# kernelspec:
1010
# display_name: Python 3
1111
# language: python
@@ -79,6 +79,8 @@ def init(self):
7979
# Set trailing stop-loss to 4x ATR
8080
# using the method provided by TrailingStrategy
8181
self.set_trailing_sl(4)
82+
83+
8284
# -
8385

8486
# Note, since the strategies in _lib_ may require their own intialization and next-tick logic, be sure to **always call `super().init()` and `super().next()` in your overridden methods**.

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
extras_require={
3939
'doc': [
4040
'pdoc3',
41-
'jupytext >= 0.7.0',
41+
'jupytext >= 1.0.2',
4242
'nbconvert',
4343
'ipykernel', # for nbconvert
4444
'jupyter_client', # for nbconvert

0 commit comments

Comments
 (0)