Skip to content

Commit 3cdc646

Browse files
author
Freddie Vargus
authored
Merge pull request #2136 from quantopian/release-1.2.0
MAINT: Update Python stub files
2 parents c079a5f + 9f889b5 commit 3cdc646

File tree

2 files changed

+32
-18
lines changed

2 files changed

+32
-18
lines changed

zipline/algorithm.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -2232,8 +2232,7 @@ def set_max_leverage(self, max_leverage):
22322232

22332233
@api_method
22342234
def set_min_leverage(self, min_leverage, grace_period):
2235-
"""
2236-
Set a limit on the minimum leverage of the algorithm.
2235+
"""Set a limit on the minimum leverage of the algorithm.
22372236
22382237
Parameters
22392238
----------

zipline/api.pyi

+31-16
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,24 @@ def get_environment(field='platform'):
198198
Raised when ``field`` is not a valid option.
199199
"""
200200

201+
def get_open_orders(asset=None):
202+
"""Retrieve all of the current open orders.
203+
204+
Parameters
205+
----------
206+
asset : Asset
207+
If passed and not None, return only the open orders for the given
208+
asset instead of all open orders.
209+
210+
Returns
211+
-------
212+
open_orders : dict[list[Order]] or list[Order]
213+
If no asset is passed this will return a dict mapping Assets
214+
to a list containing all the open orders for the asset.
215+
If an asset is passed then this will return a list of the open
216+
orders for this asset.
217+
"""
218+
201219
def get_order(order_id):
202220
"""Lookup an order based on the order id returned from one of the
203221
order functions.
@@ -267,7 +285,7 @@ def order_percent(asset, percent, limit_price=None, stop_price=None, style=None)
267285
asset : Asset
268286
The asset that this order is for.
269287
percent : float
270-
The percentage of the porfolio value to allocate to ``asset``.
288+
The percentage of the portfolio value to allocate to ``asset``.
271289
This is specified as a decimal, for example: 0.50 means 50%.
272290
limit_price : float, optional
273291
The limit price for the order.
@@ -356,7 +374,7 @@ def order_target_percent(asset, target, limit_price=None, stop_price=None, style
356374
asset : Asset
357375
The asset that this order is for.
358376
target : float
359-
The desired percentage of the porfolio value to allocate to
377+
The desired percentage of the portfolio value to allocate to
360378
``asset``. This is specified as a decimal, for example:
361379
0.50 means 50%.
362380
limit_price : float, optional
@@ -633,20 +651,6 @@ def set_max_leverage(max_leverage):
633651
be no maximum.
634652
"""
635653

636-
def set_min_leverage(min_leverage, timedelta):
637-
638-
"""
639-
Set a limit on the minimum leverage of the algorithm.
640-
641-
Parameters
642-
----------
643-
min_leverage : float
644-
The minimum leverage for the algorithm. If not provided there will
645-
be no minimum.
646-
timedelta : pd.Timedelta
647-
The offset from the start date used to enforce a minimum leverage
648-
"""
649-
650654
def set_max_order_count(max_count, on_error='fail'):
651655
"""Set a limit on the number of orders that can be placed in a single
652656
day.
@@ -699,6 +703,17 @@ def set_max_position_size(asset=None, max_shares=None, max_notional=None, on_err
699703
The maximum value to hold for an asset.
700704
"""
701705

706+
def set_min_leverage(min_leverage, grace_period):
707+
"""Set a limit on the minimum leverage of the algorithm.
708+
709+
Parameters
710+
----------
711+
min_leverage : float
712+
The minimum leverage for the algorithm.
713+
grace_period : pd.Timedelta
714+
The offset from the start date used to enforce a minimum leverage.
715+
"""
716+
702717
def set_slippage(us_equities=None, us_futures=None):
703718
"""Set the slippage models for the simulation.
704719

0 commit comments

Comments
 (0)