mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-08 04:48:35 +08:00
Merge pull request #1211 from quantopian/api-doc-update
DOC: document limit and stop price args
This commit is contained in:
+30
-25
@@ -19,10 +19,11 @@ ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) sou
|
||||
# the i18n builder cannot share the environment and doctrees with the others
|
||||
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
|
||||
|
||||
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext
|
||||
.PHONY: help build clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext
|
||||
|
||||
help:
|
||||
@echo "Please use \`make <target>' where <target> is one of"
|
||||
@echo " build to build the C and Cython extensions for zipline"
|
||||
@echo " html to make standalone HTML files"
|
||||
@echo " dirhtml to make HTML files named index.html in directories"
|
||||
@echo " singlehtml to make a single large HTML file"
|
||||
@@ -51,38 +52,42 @@ help:
|
||||
clean:
|
||||
rm -rf $(BUILDDIR)/*
|
||||
|
||||
html:
|
||||
|
||||
build:
|
||||
cd .. && python setup.py build_ext --inplace
|
||||
|
||||
html: build
|
||||
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
||||
|
||||
dirhtml:
|
||||
dirhtml: build
|
||||
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
|
||||
|
||||
singlehtml:
|
||||
singlehtml: build
|
||||
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
|
||||
@echo
|
||||
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
|
||||
|
||||
pickle:
|
||||
pickle: build
|
||||
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
|
||||
@echo
|
||||
@echo "Build finished; now you can process the pickle files."
|
||||
|
||||
json:
|
||||
json: build
|
||||
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
|
||||
@echo
|
||||
@echo "Build finished; now you can process the JSON files."
|
||||
|
||||
htmlhelp:
|
||||
htmlhelp: build
|
||||
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
|
||||
@echo
|
||||
@echo "Build finished; now you can run HTML Help Workshop with the" \
|
||||
".hhp project file in $(BUILDDIR)/htmlhelp."
|
||||
|
||||
qthelp:
|
||||
qthelp: build
|
||||
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
|
||||
@echo
|
||||
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
|
||||
@@ -91,7 +96,7 @@ qthelp:
|
||||
@echo "To view the help file:"
|
||||
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/zipline.qhc"
|
||||
|
||||
applehelp:
|
||||
applehelp: build
|
||||
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
|
||||
@echo
|
||||
@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
|
||||
@@ -99,7 +104,7 @@ applehelp:
|
||||
"~/Library/Documentation/Help or install it in your application" \
|
||||
"bundle."
|
||||
|
||||
devhelp:
|
||||
devhelp: build
|
||||
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
|
||||
@echo
|
||||
@echo "Build finished."
|
||||
@@ -108,85 +113,85 @@ devhelp:
|
||||
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/zipline"
|
||||
@echo "# devhelp"
|
||||
|
||||
epub:
|
||||
epub: build
|
||||
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
|
||||
@echo
|
||||
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
|
||||
|
||||
latex:
|
||||
latex: build
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo
|
||||
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
|
||||
@echo "Run \`make' in that directory to run these through (pdf)latex" \
|
||||
"(use \`make latexpdf' here to do that automatically)."
|
||||
|
||||
latexpdf:
|
||||
latexpdf: build
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo "Running LaTeX files through pdflatex..."
|
||||
$(MAKE) -C $(BUILDDIR)/latex all-pdf
|
||||
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
||||
|
||||
latexpdfja:
|
||||
latexpdfja: build
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo "Running LaTeX files through platex and dvipdfmx..."
|
||||
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
|
||||
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
||||
|
||||
text:
|
||||
text: build
|
||||
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
|
||||
@echo
|
||||
@echo "Build finished. The text files are in $(BUILDDIR)/text."
|
||||
|
||||
man:
|
||||
man: build
|
||||
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
|
||||
@echo
|
||||
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
|
||||
|
||||
texinfo:
|
||||
texinfo: build
|
||||
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||
@echo
|
||||
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
|
||||
@echo "Run \`make' in that directory to run these through makeinfo" \
|
||||
"(use \`make info' here to do that automatically)."
|
||||
|
||||
info:
|
||||
info: build
|
||||
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||
@echo "Running Texinfo files through makeinfo..."
|
||||
make -C $(BUILDDIR)/texinfo info
|
||||
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
|
||||
|
||||
gettext:
|
||||
gettext: build
|
||||
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
|
||||
@echo
|
||||
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
|
||||
|
||||
changes:
|
||||
changes: build
|
||||
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
|
||||
@echo
|
||||
@echo "The overview file is in $(BUILDDIR)/changes."
|
||||
|
||||
linkcheck:
|
||||
linkcheck: build
|
||||
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
|
||||
@echo
|
||||
@echo "Link check complete; look for any errors in the above output " \
|
||||
"or in $(BUILDDIR)/linkcheck/output.txt."
|
||||
|
||||
doctest:
|
||||
doctest: build
|
||||
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
|
||||
@echo "Testing of doctests in the sources finished, look at the " \
|
||||
"results in $(BUILDDIR)/doctest/output.txt."
|
||||
|
||||
coverage:
|
||||
coverage: build
|
||||
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
|
||||
@echo "Testing of coverage in the sources finished, look at the " \
|
||||
"results in $(BUILDDIR)/coverage/python.txt."
|
||||
|
||||
xml:
|
||||
xml: build
|
||||
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
|
||||
@echo
|
||||
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
|
||||
|
||||
pseudoxml:
|
||||
pseudoxml: build
|
||||
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
|
||||
@echo
|
||||
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
|
||||
|
||||
+54
-2
@@ -1074,7 +1074,7 @@ class TradingAlgorithm(object):
|
||||
@api_method
|
||||
@preprocess(symbol=ensure_upper_case)
|
||||
def future_symbol(self, symbol):
|
||||
""" Lookup a futures contract with a given symbol.
|
||||
"""Lookup a futures contract with a given symbol.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
@@ -1218,6 +1218,10 @@ class TradingAlgorithm(object):
|
||||
The amount of shares to order. If ``amount`` is positive, this is
|
||||
the number of shares to buy or cover. If ``amount`` is negative,
|
||||
this is the number of shares to sell or short.
|
||||
limit_price : float, optional
|
||||
The limit price for the order.
|
||||
stop_price : float, optional
|
||||
The stop price for the order.
|
||||
style : ExecutionStyle, optional
|
||||
The execution style for the order.
|
||||
|
||||
@@ -1226,6 +1230,16 @@ class TradingAlgorithm(object):
|
||||
order_id : str
|
||||
The unique identifier for this order.
|
||||
|
||||
Notes
|
||||
-----
|
||||
The ``limit_price`` and ``stop_price`` arguments provide shorthands for
|
||||
passing common execution styles. Passing ``limit_price=N`` is
|
||||
equivalent to ``style=LimitOrder(N)``. Similarly, passing
|
||||
``stop_price=M`` is equivalent to ``style=StopOrder(M)``, and passing
|
||||
``limit_price=N`` and ``stop_price=M`` is equivalent to
|
||||
``style=StopLimitOrder(N, M)``. It is an error to pass both a ``style``
|
||||
and ``limit_price`` or ``stop_price``.
|
||||
|
||||
See Also
|
||||
--------
|
||||
:class:`zipline.finance.execution.ExecutionStyle`
|
||||
@@ -1298,7 +1312,6 @@ class TradingAlgorithm(object):
|
||||
This function assumes that either style == None or (limit_price,
|
||||
stop_price) == (None, None).
|
||||
"""
|
||||
# TODO_SS: DeprecationWarning for usage of limit_price and stop_price.
|
||||
if style:
|
||||
assert (limit_price, stop_price) == (None, None)
|
||||
return style
|
||||
@@ -1334,6 +1347,10 @@ class TradingAlgorithm(object):
|
||||
|
||||
value > 0 :: Buy/Cover
|
||||
value < 0 :: Sell/Short
|
||||
limit_price : float, optional
|
||||
The limit price for the order.
|
||||
stop_price : float, optional
|
||||
The stop price for the order.
|
||||
style : ExecutionStyle
|
||||
The execution style for the order.
|
||||
|
||||
@@ -1342,6 +1359,11 @@ class TradingAlgorithm(object):
|
||||
order_id : str
|
||||
The unique identifier for this order.
|
||||
|
||||
Notes
|
||||
-----
|
||||
See :func:`zipline.api.order` for more information about
|
||||
``limit_price``, ``stop_price``, and ``style``
|
||||
|
||||
See Also
|
||||
--------
|
||||
:class:`zipline.finance.execution.ExecutionStyle`
|
||||
@@ -1548,6 +1570,10 @@ class TradingAlgorithm(object):
|
||||
percent : float
|
||||
The percentage of the porfolio value to allocate to ``asset``.
|
||||
This is specified as a decimal, for example: 0.50 means 50%.
|
||||
limit_price : float, optional
|
||||
The limit price for the order.
|
||||
stop_price : float, optional
|
||||
The stop price for the order.
|
||||
style : ExecutionStyle
|
||||
The execution style for the order.
|
||||
|
||||
@@ -1556,6 +1582,11 @@ class TradingAlgorithm(object):
|
||||
order_id : str
|
||||
The unique identifier for this order.
|
||||
|
||||
Notes
|
||||
-----
|
||||
See :func:`zipline.api.order` for more information about
|
||||
``limit_price``, ``stop_price``, and ``style``
|
||||
|
||||
See Also
|
||||
--------
|
||||
:class:`zipline.finance.execution.ExecutionStyle`
|
||||
@@ -1591,6 +1622,10 @@ class TradingAlgorithm(object):
|
||||
The asset that this order is for.
|
||||
target : int
|
||||
The desired number of shares of ``asset``.
|
||||
limit_price : float, optional
|
||||
The limit price for the order.
|
||||
stop_price : float, optional
|
||||
The stop price for the order.
|
||||
style : ExecutionStyle
|
||||
The execution style for the order.
|
||||
|
||||
@@ -1614,6 +1649,9 @@ class TradingAlgorithm(object):
|
||||
call to ``order_target`` will not have been filled when the second
|
||||
``order_target`` call is made.
|
||||
|
||||
See :func:`zipline.api.order` for more information about
|
||||
``limit_price``, ``stop_price``, and ``style``
|
||||
|
||||
See Also
|
||||
--------
|
||||
:class:`zipline.finance.execution.ExecutionStyle`
|
||||
@@ -1659,6 +1697,10 @@ class TradingAlgorithm(object):
|
||||
The asset that this order is for.
|
||||
target : float
|
||||
The desired total value of ``asset``.
|
||||
limit_price : float, optional
|
||||
The limit price for the order.
|
||||
stop_price : float, optional
|
||||
The stop price for the order.
|
||||
style : ExecutionStyle
|
||||
The execution style for the order.
|
||||
|
||||
@@ -1681,6 +1723,9 @@ class TradingAlgorithm(object):
|
||||
call to ``order_target_value`` will not have been filled when the
|
||||
second ``order_target_value`` call is made.
|
||||
|
||||
See :func:`zipline.api.order` for more information about
|
||||
``limit_price``, ``stop_price``, and ``style``
|
||||
|
||||
See Also
|
||||
--------
|
||||
:class:`zipline.finance.execution.ExecutionStyle`
|
||||
@@ -1715,6 +1760,10 @@ class TradingAlgorithm(object):
|
||||
The desired percentage of the porfolio value to allocate to
|
||||
``asset``. This is specified as a decimal, for example:
|
||||
0.50 means 50%.
|
||||
limit_price : float, optional
|
||||
The limit price for the order.
|
||||
stop_price : float, optional
|
||||
The stop price for the order.
|
||||
style : ExecutionStyle
|
||||
The execution style for the order.
|
||||
|
||||
@@ -1737,6 +1786,9 @@ class TradingAlgorithm(object):
|
||||
because the first call to ``order_target_percent`` will not have been
|
||||
filled when the second ``order_target_percent`` call is made.
|
||||
|
||||
See :func:`zipline.api.order` for more information about
|
||||
``limit_price``, ``stop_price``, and ``style``
|
||||
|
||||
See Also
|
||||
--------
|
||||
:class:`zipline.finance.execution.ExecutionStyle`
|
||||
|
||||
Reference in New Issue
Block a user