def set_do_not_order_list(self, restricted_list, on_error='fail'): """Set a restriction on which assets can be ordered. Parameters ---------- restricted_list : container[Asset], SecurityList The assets that cannot be ordered. """ if isinstance(restricted_list, SecurityList): warnings.warn( "`set_do_not_order_list(security_lists.leveraged_etf_list)` " "is deprecated. Use `set_asset_restrictions(" "security_lists.restrict_leveraged_etfs)` instead.", category=DeprecationWarning, stacklevel=2) restrictions = SecurityListRestrictions(restricted_list) else: warnings.warn( "`set_do_not_order_list(container_of_assets)` is deprecated. " "Create a zipline.finance.asset_restrictions." "StaticRestrictions object with a container of assets and use " "`set_asset_restrictions(StaticRestrictions(" "container_of_assets))` instead.", category=DeprecationWarning, stacklevel=2) restrictions = StaticRestrictions(restricted_list) self.set_asset_restrictions(restrictions, on_error)
def restrict_leveraged_etfs(self): return SecurityListRestrictions(self.leveraged_etf_list)