Skip to content

Commit fecdfc3

Browse files
committed
autoformat documentation configuration, restore logo file, add tests for child strategy regression
1 parent f2baa5a commit fecdfc3

File tree

6 files changed

+155
-96
lines changed

6 files changed

+155
-96
lines changed

Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ pages:
3131
git clone -b gh-pages [email protected]:pmorissette/bt.git $(TMPREPO)
3232
rm -rf $(TMPREPO)/*
3333
cp -r docs/build/html/* $(TMPREPO)
34-
cd $(TMPREPO); \
35-
git add -A ; \
36-
git commit -a -m 'auto-updating docs' ; \
34+
cd $(TMPREPO);\
35+
git add -A ;\
36+
git commit -a -m 'auto-updating docs' ;\
3737
git push
3838

3939
serve:

bt/core.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ class StrategyBase(Node):
381381
_last_fee = cy.declare(cy.double)
382382
_paper_trade = cy.declare(cy.bint)
383383
bankrupt = cy.declare(cy.bint)
384+
_last_chk = cy.declare(cy.bint)
384385

385386
def __init__(self, name, children=None, parent=None):
386387
Node.__init__(self, name, children=children, parent=parent)
@@ -396,6 +397,8 @@ def __init__(self, name, children=None, parent=None):
396397
self._last_price = PAR
397398
self._last_fee = 0
398399

400+
self._last_chk = 0
401+
399402
# default commission function
400403
self.commission_fn = self._dflt_comm_fn
401404

@@ -595,8 +598,6 @@ def setup(self, universe, **kwargs):
595598
self._paper = paper
596599

597600
# setup universe
598-
# TODO: a copy is made here to avoid polluting the universes
599-
# of substrategies. is this desired?
600601
funiverse = universe.copy()
601602

602603
# filter only if the node has any children specified as input,

docs/source/_static/logo.png

2.54 KB
Loading

docs/source/conf.py

+80-78
Original file line numberDiff line numberDiff line change
@@ -11,228 +11,224 @@
1111
# All configuration values have a default; values that are commented out
1212
# serve to show the default.
1313

14-
import sys, os
15-
import bt
14+
import sys
15+
import os
1616

1717
# If extensions (or modules to document with autodoc) are in another directory,
1818
# add these directories to sys.path here. If the directory is relative to the
1919
# documentation root, use os.path.abspath to make it absolute, like shown here.
20-
sys.path.insert(0, os.path.abspath('../../bt'))
21-
sys.path.insert(0, os.path.abspath('_themes/klink'))
20+
sys.path.insert(0, os.path.abspath("../../"))
21+
sys.path.insert(0, os.path.abspath("../../bt"))
22+
sys.path.insert(0, os.path.abspath("_themes/klink"))
23+
24+
import bt # noqa: E402
25+
import klink # noqa: E402
2226

23-
import klink
2427
klink.convert_notebooks()
2528

26-
html_theme_path = ['_themes/klink']
27-
html_theme = 'klink'
28-
html_theme_options = {
29-
'github': 'pmorissette/bt',
30-
'analytics_id': 'UA-52308448-3'
31-
}
29+
html_theme_path = ["_themes/klink"]
30+
html_theme = "klink"
31+
html_theme_options = {"github": "pmorissette/bt", "analytics_id": "UA-52308448-3"}
3232

3333
# -- General configuration -----------------------------------------------------
3434

3535
# If your documentation needs a minimal Sphinx version, state it here.
36-
#needs_sphinx = '1.0'
36+
# needs_sphinx = '1.0'
3737

3838
# Add any Sphinx extension module names here, as strings. They can be extensions
3939
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
40-
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinx.ext.intersphinx']
40+
extensions = ["sphinx.ext.autodoc", "sphinx.ext.viewcode", "sphinx.ext.intersphinx"]
4141

42-
intersphinx_mapping = {'ffn': ('http://pmorissette.github.io/ffn', None)}
42+
intersphinx_mapping = {"ffn": ("http://pmorissette.github.io/ffn", None)}
4343

4444
# Add any paths that contain templates here, relative to this directory.
45-
templates_path = ['_templates']
45+
templates_path = ["_templates"]
4646

4747
# The suffix of source filenames.
48-
source_suffix = '.rst'
48+
source_suffix = ".rst"
4949

5050
# The encoding of source files.
51-
#source_encoding = 'utf-8-sig'
51+
# source_encoding = 'utf-8-sig'
5252

5353
# The master toctree document.
54-
master_doc = 'index'
54+
master_doc = "index"
5555

5656
# General information about the project.
57-
project = 'bt'
58-
copyright = 'bt was created by Philippe Morissette. If you find a bug, please <a href="https://github.com/pmorissette/bt/issues/new" title="Open a new issue on Github">submit an issue</a> on Github.'
57+
project = "bt"
58+
copyright = """bt was created by Philippe Morissette.
59+
If you find a bug, please <a href="https://github.com/pmorissette/bt/issues/new" title="Open a new issue on Github">submit an issue</a> on Github.
60+
"""
5961

6062
# The version info for the project you're documenting, acts as replacement for
6163
# |version| and |release|, also used in various other places throughout the
6264
# built documents.
6365
#
6466
# The short X.Y version.
65-
version = '.'.join([str(x) for x in bt.__version__])
67+
version = ".".join([str(x) for x in bt.__version__])
6668
# The full version, including alpha/beta/rc tags.
6769
release = version
6870

6971
# The language for content autogenerated by Sphinx. Refer to documentation
7072
# for a list of supported languages.
71-
#language = None
73+
# language = None
7274

7375
# There are two options for replacing |today|: either, you set today to some
7476
# non-false value, then it is used:
75-
#today = ''
77+
# today = ''
7678
# Else, today_fmt is used as the format for a strftime call.
77-
#today_fmt = '%B %d, %Y'
79+
# today_fmt = '%B %d, %Y'
7880

7981
# List of patterns, relative to source directory, that match files and
8082
# directories to ignore when looking for source files.
8183
exclude_patterns = []
8284

8385
# The reST default role (used for this markup: `text`) to use for all documents.
84-
#default_role = None
86+
# default_role = None
8587

8688
# If true, '()' will be appended to :func: etc. cross-reference text.
87-
#add_function_parentheses = True
89+
# add_function_parentheses = True
8890

8991
# If true, the current module name will be prepended to all description
9092
# unit titles (such as .. function::).
91-
#add_module_names = True
93+
# add_module_names = True
9294

9395
# If true, sectionauthor and moduleauthor directives will be shown in the
9496
# output. They are ignored by default.
95-
#show_authors = False
97+
# show_authors = False
9698

9799
# The name of the Pygments (syntax highlighting) style to use.
98-
pygments_style = 'sphinx'
100+
pygments_style = "sphinx"
99101

100102
# A list of ignored prefixes for module index sorting.
101-
#modindex_common_prefix = []
103+
# modindex_common_prefix = []
102104

103105

104106
# -- Options for HTML output ---------------------------------------------------
105107

106108
# The theme to use for HTML and HTML Help pages. See the documentation for
107109
# a list of builtin themes.
108-
#html_theme = 'default'
110+
# html_theme = 'default'
109111

110112
# Theme options are theme-specific and customize the look and feel of a theme
111113
# further. For a list of options available for each theme, see the
112114
# documentation.
113-
#html_theme_options = {}
115+
# html_theme_options = {}
114116

115117
# Add any paths that contain custom themes here, relative to this directory.
116-
#html_theme_path = []
118+
# html_theme_path = []
117119

118120
# The name for this set of Sphinx documents. If None, it defaults to
119121
# "<project> v<release> documentation".
120-
#html_title = None
122+
# html_title = None
121123

122124
# A shorter title for the navigation bar. Default is the same as html_title.
123-
#html_short_title = None
125+
# html_short_title = None
124126

125127
# The name of an image file (relative to this directory) to place at the top
126128
# of the sidebar.
127-
#html_logo = None
129+
# html_logo = None
128130

129131
# The name of an image file (within the static path) to use as favicon of the
130132
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
131133
# pixels large.
132-
html_favicon = 'favicon.ico'
134+
html_favicon = "favicon.ico"
133135

134136
# Add any paths that contain custom static files (such as style sheets) here,
135137
# relative to this directory. They are copied after the builtin static files,
136138
# so a file named "default.css" will overwrite the builtin "default.css".
137-
html_static_path = ['_static']
139+
html_static_path = ["_static"]
138140

139141
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
140142
# using the given strftime format.
141-
#html_last_updated_fmt = '%b %d, %Y'
143+
# html_last_updated_fmt = '%b %d, %Y'
142144

143145
# If true, SmartyPants will be used to convert quotes and dashes to
144146
# typographically correct entities.
145-
#html_use_smartypants = True
147+
# html_use_smartypants = True
146148

147149
# Custom sidebar templates, maps document names to template names.
148-
#html_sidebars = {}
150+
# html_sidebars = {}
149151

150152
# Additional templates that should be rendered to pages, maps page names to
151153
# template names.
152-
#html_additional_pages = {}
154+
# html_additional_pages = {}
153155

154156
# If false, no module index is generated.
155-
#html_domain_indices = True
157+
# html_domain_indices = True
156158

157159
# If false, no index is generated.
158-
#html_use_index = True
160+
# html_use_index = True
159161

160162
# If true, the index is split into individual pages for each letter.
161-
#html_split_index = False
163+
# html_split_index = False
162164

163165
# If true, links to the reST sources are added to the pages.
164-
#html_show_sourcelink = True
166+
# html_show_sourcelink = True
165167

166168
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
167-
#html_show_sphinx = True
169+
# html_show_sphinx = True
168170

169171
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
170-
#html_show_copyright = True
172+
# html_show_copyright = True
171173

172174
# If true, an OpenSearch description file will be output, and all pages will
173175
# contain a <link> tag referring to it. The value of this option must be the
174176
# base URL from which the finished HTML is served.
175-
#html_use_opensearch = ''
177+
# html_use_opensearch = ''
176178

177179
# This is the file name suffix for HTML files (e.g. ".xhtml").
178-
#html_file_suffix = None
180+
# html_file_suffix = None
179181

180182
# Output file base name for HTML help builder.
181-
htmlhelp_basename = 'btdoc'
183+
htmlhelp_basename = "btdoc"
182184

183185

184186
# -- Options for LaTeX output --------------------------------------------------
185187

186188
latex_elements = {
187-
# The paper size ('letterpaper' or 'a4paper').
188-
#'papersize': 'letterpaper',
189-
190-
# The font size ('10pt', '11pt' or '12pt').
191-
#'pointsize': '10pt',
192-
193-
# Additional stuff for the LaTeX preamble.
194-
#'preamble': '',
189+
# The paper size ('letterpaper' or 'a4paper').
190+
# 'papersize': 'letterpaper',
191+
# The font size ('10pt', '11pt' or '12pt').
192+
# 'pointsize': '10pt',
193+
# Additional stuff for the LaTeX preamble.
194+
# 'preamble': '',
195195
}
196196

197197
# Grouping the document tree into LaTeX files. List of tuples
198198
# (source start file, target name, title, author, documentclass [howto/manual]).
199199
latex_documents = [
200-
('index', 'bt.tex', 'bt Documentation',
201-
'Philippe Morissette', 'manual'),
200+
("index", "bt.tex", "bt Documentation", "Philippe Morissette", "manual"),
202201
]
203202

204203
# The name of an image file (relative to this directory) to place at the top of
205204
# the title page.
206-
#latex_logo = None
205+
# latex_logo = None
207206

208207
# For "manual" documents, if this is true, then toplevel headings are parts,
209208
# not chapters.
210-
#latex_use_parts = False
209+
# latex_use_parts = False
211210

212211
# If true, show page references after internal links.
213-
#latex_show_pagerefs = False
212+
# latex_show_pagerefs = False
214213

215214
# If true, show URL addresses after external links.
216-
#latex_show_urls = False
215+
# latex_show_urls = False
217216

218217
# Documents to append as an appendix to all manuals.
219-
#latex_appendices = []
218+
# latex_appendices = []
220219

221220
# If false, no module index is generated.
222-
#latex_domain_indices = True
221+
# latex_domain_indices = True
223222

224223

225224
# -- Options for manual page output --------------------------------------------
226225

227226
# One entry per manual page. List of tuples
228227
# (source start file, name, description, authors, manual section).
229-
man_pages = [
230-
('index', 'bt', 'bt Documentation',
231-
['Philippe Morissette'], 1)
232-
]
228+
man_pages = [("index", "bt", "bt Documentation", ["Philippe Morissette"], 1)]
233229

234230
# If true, show URL addresses after external links.
235-
#man_show_urls = False
231+
# man_show_urls = False
236232

237233

238234
# -- Options for Texinfo output ------------------------------------------------
@@ -241,16 +237,22 @@
241237
# (source start file, target name, title, author,
242238
# dir menu entry, description, category)
243239
texinfo_documents = [
244-
('index', 'bt', 'bt Documentation',
245-
'Philippe Morissette', 'bt', 'One line description of project.',
246-
'Miscellaneous'),
240+
(
241+
"index",
242+
"bt",
243+
"bt Documentation",
244+
"Philippe Morissette",
245+
"bt",
246+
"One line description of project.",
247+
"Miscellaneous",
248+
),
247249
]
248250

249251
# Documents to append as an appendix to all manuals.
250-
#texinfo_appendices = []
252+
# texinfo_appendices = []
251253

252254
# If false, no module index is generated.
253-
#texinfo_domain_indices = True
255+
# texinfo_domain_indices = True
254256

255257
# How to display URL addresses: 'footnote', 'no', or 'inline'.
256-
#texinfo_show_urls = 'footnote'
258+
# texinfo_show_urls = 'footnote'

examples/Strategy_Combination.ipynb

+6-6
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)