def exit(self, stop_price=None, limit_price=None, good_till_canceled=None): # Deprecated in v0.15. if stop_price is None and limit_price is None: warninghelpers.deprecation_warning("exit will be deprecated in the next version. Please use exit_market instead.", stacklevel=2) elif stop_price is None and limit_price is not None: warninghelpers.deprecation_warning("exit will be deprecated in the next version. Please use exit_limit instead.", stacklevel=2) elif stop_price is not None and limit_price is None: warninghelpers.deprecation_warning("exit will be deprecated in the next version. Please use exit_stop instead.", stacklevel=2) elif stop_price is not None and limit_price is not None: warninghelpers.deprecation_warning("exit will be deprecated in the next version. Please use exit_stop_limit instead.", stacklevel=2) self.__state.exit(self, stop_price, limit_price, good_till_canceled)
def get_unrealized_net_profit(self, price=None): # Deprecated in v0.15. warninghelpers.deprecation_warning("get_unrealized_net_profit will be deprecated in the next version. Please use get_PnL instead.", stacklevel=2) if price is not None: raise Exception("Setting the price to get_unrealized_net_profit is no longer supported") return self.get_PnL(False)
def quantity(self): # Deprecated in v0.15. warninghelpers.deprecation_warning("quantity will be deprecated in the next version. Please use abs(self.shares()) instead.", stacklevel=2) return abs(self.shares())
def get_net_profit(self, including_commissions=True): # Deprecated in v0.15. warninghelpers.deprecation_warning("get_net_profit will be deprecated in the next version. Please use get_PnL instead.", stacklevel=2) return self.get_PnL(including_commissions)