Ejemplo n.º 1
0
 def getAdjLow(self):
     # Deprecated in 0.15
     warninghelpers.deprecation_warning(
         "The getAdjLow method will be deprecated in the next version. Please use the getLow(True) instead.",
         stacklevel=2,
     )
     return self.getLow(True)
Ejemplo n.º 2
0
    def getValue(self, deprecated=None):
        if deprecated != None:
            warninghelpers.deprecation_warning(
                "The bars parameter is no longer used and will be removed in the next version.", stacklevel=2
            )

        return self.getEquityWithBars(self.__barFeed.getCurrentBars())
Ejemplo n.º 3
0
 def order(self, instrument, quantity, onClose=False, goodTillCanceled=False, allOrNone=False):
     # Deprecated since v0.15
     warninghelpers.deprecation_warning(
         "The order method will be deprecated in the next version. Please use the marketOrder method instead.",
         stacklevel=2,
     )
     return self.marketOrder(instrument, quantity, onClose, goodTillCanceled, allOrNone)
Ejemplo n.º 4
0
 def getQuantity(self):
     # Deprecated in v0.15.
     warninghelpers.deprecation_warning(
         "getQuantity will be deprecated in the next version. Please use abs(self.getShares()) instead.",
         stacklevel=2,
     )
     return abs(self.getShares())
Ejemplo n.º 5
0
 def __init__(self, *args, **kwargs):
     # Deprecated since v0.13
     warninghelpers.deprecation_warning(
         "Strategy class will be deprecated in the next version. Please use BaseStrategy or BacktestingStrategy instead.",
         stacklevel=2,
     )
     BacktestingStrategy.__init__(self, *args, **kwargs)
Ejemplo n.º 6
0
 def getAdjLow(self):
     # Deprecated in 0.15
     warninghelpers.deprecation_warning(
         "The getAdjLow method will be deprecated in the next version. "
         "Please use the getLow(True) instead.",
         stacklevel=2)
     return self.getLow(True)
Ejemplo n.º 7
0
 def appendValueWithDatetime(self, dateTime, value):
     # Deprecated since 0.13
     warninghelpers.deprecation_warning(
         "appendValueWithDatetime will be deprecated in the next version. Please use appendWithDateTime instead.",
         stacklevel=2,
     )
     self.appendWithDateTime(dateTime, value)
Ejemplo n.º 8
0
    def getValue(self, deprecated=None):
        if deprecated != None:
            warninghelpers.deprecation_warning(
                "The bars parameter is no longer used and will be removed in the next version.",
                stacklevel=2)

        return self.getEquityWithBars(self.__barFeed.getCurrentBars())
Ejemplo n.º 9
0
 def __init__(self, skipWarning=False):
     if not skipWarning:
         warninghelpers.deprecation_warning(
             "pyalgotrade.barfeed.csvfeed.YahooFeed will be deprecated in the next version. Please use pyalgotrade.barfeed.yahoofeed.Feed instead.",
             stacklevel=2,
         )
     BarFeed.__init__(self)
Ejemplo n.º 10
0
 def setUseAdjustedValues(self, useAdjusted, deprecationCheck=None):
     # Deprecated since v0.15
     if not self.__barFeed.barsHaveAdjClose():
         raise Exception("The barfeed doesn't support adjusted close values")
     if deprecationCheck is None:
         warninghelpers.deprecation_warning("setUseAdjustedValues will be deprecated in the next version. Please use setUseAdjustedValues on the strategy instead.", stacklevel=2)
     self.__useAdjustedValues = useAdjusted
Ejemplo n.º 11
0
 def exitPosition(self, position, stopPrice=None, limitPrice=None, goodTillCanceled=None):
     # Deprecated since v0.13
     warninghelpers.deprecation_warning(
         "exitPosition will be deprecated in the next version. Please use the exit method in the position class instead.",
         stacklevel=2,
     )
     position.exit(limitPrice, stopPrice, goodTillCanceled)
Ejemplo n.º 12
0
    def buildFigure(self, fromDateTime=None, toDateTime=None):
        # Deprecated in v0.18.
        warninghelpers.deprecation_warning(
            "buildFigure will be deprecated in the next version. Use buildFigureAndSubplots.",
            stacklevel=2)

        fig, _ = self.buildFigureAndSubplots(fromDateTime, toDateTime)
        return fig
Ejemplo n.º 13
0
 def getUnrealizedNetProfit(self, price=None):
     # Deprecated in v0.15.
     warninghelpers.deprecation_warning(
         "getUnrealizedNetProfit will be deprecated in the next version. Please use getPnL instead.", stacklevel=2
     )
     if price is not None:
         raise Exception("Setting the price to getUnrealizedNetProfit is no longer supported")
     return self.getPnL(False)
Ejemplo n.º 14
0
	def getValue(self, valuesAgo = 0):
		# Deprecated since 0.12
		warninghelpers.deprecation_warning("getValue will be deprecated in the next version. Please use [] instead.", stacklevel=2)
		ret = None
		absolutePos = self.__mapRelativeToAbsolute(valuesAgo)
		if absolutePos != None:
			ret = self.getValueAbsolute(absolutePos)
		return ret
Ejemplo n.º 15
0
	def __init__(self, timezone = None, skipWarning=False):
		if type(timezone) == types.IntType:
			raise Exception("timezone as an int parameter is not supported anymore. Please use a pytz timezone instead.")

		if not skipWarning:
			warninghelpers.deprecation_warning("pyalgotrade.barfeed.csvfeed.YahooFeed will be deprecated in the next version. Please use pyalgotrade.barfeed.yahoofeed.Feed instead.", stacklevel=2)

		BarFeed.__init__(self, barfeed.Frequency.DAY)
		self.__timezone = timezone
Ejemplo n.º 16
0
 def exitPosition(self,
                  position,
                  stopPrice=None,
                  limitPrice=None,
                  goodTillCanceled=None):
     # Deprecated since v0.13
     warninghelpers.deprecation_warning(
         "exitPosition will be deprecated in the next version. Please use the exit method in the position class instead.",
         stacklevel=2)
     position.exit(limitPrice, stopPrice, goodTillCanceled)
Ejemplo n.º 17
0
 def getValue(self, valuesAgo=0):
     # Deprecated since 0.12
     warninghelpers.deprecation_warning(
         "getValue will be deprecated in the next version. Please use [] instead.",
         stacklevel=2)
     ret = None
     absolutePos = self.__mapRelativeToAbsolute(valuesAgo)
     if absolutePos != None:
         ret = self.getValueAbsolute(absolutePos)
     return ret
Ejemplo n.º 18
0
 def getUnrealizedNetProfit(self, price=None):
     # Deprecated in v0.15.
     warninghelpers.deprecation_warning(
         "getUnrealizedNetProfit will be deprecated in the next version. Please use getPnL instead.",
         stacklevel=2)
     if price is not None:
         raise Exception(
             "Setting the price to getUnrealizedNetProfit is no longer supported"
         )
     return self.getPnL(False)
Ejemplo n.º 19
0
	def getValuesAbsolute(self, firstPos, lastPos, includeNone = False):
		# Deprecated since 0.13
		warninghelpers.deprecation_warning("getValuesAbsolute will be deprecated in the next version. Please use [] instead.", stacklevel=2)
		ret = []
		for i in xrange(firstPos, lastPos+1):
			value = self.getValueAbsolute(i)
			if value is None and not includeNone:
				return None
			ret.append(value)
		return ret
Ejemplo n.º 20
0
 def order(self,
           instrument,
           quantity,
           onClose=False,
           goodTillCanceled=False,
           allOrNone=False):
     # Deprecated since v0.15
     warninghelpers.deprecation_warning(
         "The order method will be deprecated in the next version. Please use the marketOrder method instead.",
         stacklevel=2)
     return self.marketOrder(instrument, quantity, onClose,
                             goodTillCanceled, allOrNone)
Ejemplo n.º 21
0
 def getValuesAbsolute(self, firstPos, lastPos, includeNone=False):
     # Deprecated since 0.13
     warninghelpers.deprecation_warning(
         "getValuesAbsolute will be deprecated in the next version. Please use [] instead.",
         stacklevel=2)
     ret = []
     for i in xrange(firstPos, lastPos + 1):
         value = self.getValueAbsolute(i)
         if value is None and not includeNone:
             return None
         ret.append(value)
     return ret
Ejemplo n.º 22
0
    def __init__(self, timezone=None, skipWarning=False):
        if type(timezone) == types.IntType:
            raise Exception(
                "timezone as an int parameter is not supported anymore. Please use a pytz timezone instead."
            )

        if not skipWarning:
            warninghelpers.deprecation_warning(
                "pyalgotrade.barfeed.csvfeed.YahooFeed will be deprecated in the next version. Please use pyalgotrade.barfeed.yahoofeed.Feed instead.",
                stacklevel=2)

        BarFeed.__init__(self, barfeed.Frequency.DAY)
        self.__timezone = timezone
Ejemplo n.º 23
0
    def getPnL(self, includeCommissions=True):
        """
        Calculates PnL up to this point.
        If the position is not closed, these will be unrealized PnL.
        """

        # Deprecated in v0.18.
        if includeCommissions is False:
            warninghelpers.deprecation_warning("includeCommissions will be deprecated in the next version.", stacklevel=2)

        ret = 0
        price = self.getLastPrice()
        if price is not None:
            ret = self.__posTracker.getPnL(price=price, includeCommissions=includeCommissions)
        return ret
Ejemplo n.º 24
0
    def getPnL(self, includeCommissions=True):
        """
        Calculates PnL up to this point.
        If the position is not closed, these will be unrealized PnL.
        """

        # Deprecated in v0.18.
        if includeCommissions is False:
            warninghelpers.deprecation_warning("includeCommissions will be deprecated in the next version.", stacklevel=2)

        ret = 0
        price = self.getLastPrice()
        if price is not None:
            ret = self.__posTracker.getPnL(price=price, includeCommissions=includeCommissions)
        return ret
Ejemplo n.º 25
0
	def getValues(self, count, valuesAgo = 0, includeNone = False):
		# Deprecated since 0.12
		warninghelpers.deprecation_warning("getValues will be deprecated in the next version. Please use [] instead.", stacklevel=2)
		if count <= 0:
			return None

		absolutePos = self.__mapRelativeToAbsolute(valuesAgo + (count - 1))
		if absolutePos == None:
			return None

		ret = []
		for i in xrange(count):
			value = self.getValueAbsolute(absolutePos + i)
			if value is None and not includeNone:
				return None
			ret.append(value)
		return ret
Ejemplo n.º 26
0
    def getValues(self, count, valuesAgo=0, includeNone=False):
        # Deprecated since 0.12
        warninghelpers.deprecation_warning(
            "getValues will be deprecated in the next version. Please use [] instead.",
            stacklevel=2)
        if count <= 0:
            return None

        absolutePos = self.__mapRelativeToAbsolute(valuesAgo + (count - 1))
        if absolutePos == None:
            return None

        ret = []
        for i in xrange(count):
            value = self.getValueAbsolute(absolutePos + i)
            if value is None and not includeNone:
                return None
            ret.append(value)
        return ret
Ejemplo n.º 27
0
    def exit(self, stopPrice=None, limitPrice=None, goodTillCanceled=None):
        # Deprecated in v0.15.
        if stopPrice is None and limitPrice is None:
            warninghelpers.deprecation_warning("exit will be deprecated in the next version. Please use exitMarket instead.", stacklevel=2)
        elif stopPrice is None and limitPrice is not None:
            warninghelpers.deprecation_warning("exit will be deprecated in the next version. Please use exitLimit instead.", stacklevel=2)
        elif stopPrice is not None and limitPrice is None:
            warninghelpers.deprecation_warning("exit will be deprecated in the next version. Please use exitStop instead.", stacklevel=2)
        elif stopPrice is not None and limitPrice is not None:
            warninghelpers.deprecation_warning("exit will be deprecated in the next version. Please use exitStopLimit instead.", stacklevel=2)

        self.__state.exit(self, stopPrice, limitPrice, goodTillCanceled)
Ejemplo n.º 28
0
    def exit(self, stopPrice=None, limitPrice=None, goodTillCanceled=None):
        # Deprecated in v0.15.
        if stopPrice is None and limitPrice is None:
            warninghelpers.deprecation_warning("exit will be deprecated in the next version. Please use exitMarket instead.", stacklevel=2)
        elif stopPrice is None and limitPrice is not None:
            warninghelpers.deprecation_warning("exit will be deprecated in the next version. Please use exitLimit instead.", stacklevel=2)
        elif stopPrice is not None and limitPrice is None:
            warninghelpers.deprecation_warning("exit will be deprecated in the next version. Please use exitStop instead.", stacklevel=2)
        elif stopPrice is not None and limitPrice is not None:
            warninghelpers.deprecation_warning("exit will be deprecated in the next version. Please use exitStopLimit instead.", stacklevel=2)

        self._state.exit(self, stopPrice, limitPrice, goodTillCanceled)
Ejemplo n.º 29
0
 def appendValue(self, value):
     # Deprecated since 0.13
     warninghelpers.deprecation_warning(
         "appendValue will be deprecated in the next version. Please use append instead.",
         stacklevel=2)
     self.append(value)
Ejemplo n.º 30
0
 def getPendingOrders(self):
     warninghelpers.deprecation_warning(
         "getPendingOrders will be deprecated in the next version. Please use getActiveOrders instead.",
         stacklevel=2
     )
     return self.getActiveOrders()
Ejemplo n.º 31
0
 def __init__(self, *args, **kwargs):
     # Deprecated since v0.15
     warninghelpers.deprecation_warning("Slope was moved in the pyalgotrade.technical.linreg package", stacklevel=2)
     linreg.Slope.__init__(self, *args, **kwargs)
Ejemplo n.º 32
0
 def appendValueWithDatetime(self, dateTime, value):
     # Deprecated since 0.13
     warninghelpers.deprecation_warning(
         "appendValueWithDatetime will be deprecated in the next version. Please use appendWithDateTime instead.",
         stacklevel=2)
     self.appendWithDateTime(dateTime, value)
Ejemplo n.º 33
0
 def getQuantity(self):
     # Deprecated in v0.15.
     warninghelpers.deprecation_warning(
         "getQuantity will be deprecated in the next version. Please use abs(self.getShares()) instead.",
         stacklevel=2)
     return abs(self.getShares())
Ejemplo n.º 34
0
	def appendValue(self, value):
		# Deprecated since 0.13
		warninghelpers.deprecation_warning("appendValue will be deprecated in the next version. Please use append instead.", stacklevel=2)
		self.append(value)
Ejemplo n.º 35
0
 def getNetProfit(self, includeCommissions=True):
     # Deprecated in v0.15.
     warninghelpers.deprecation_warning(
         "getNetProfit will be deprecated in the next version. Please use getPnL instead.",
         stacklevel=2)
     return self.getPnL(includeCommissions)
Ejemplo n.º 36
0
 def getResult(self):
     warninghelpers.deprecation_warning("getResult will be deprecated in the next version. Please use getReturn instead.", stacklevel=2)
     return self.getReturn(False)
Ejemplo n.º 37
0
 def setExitOnSessionClose(self, exitOnSessionClose):
     # Deprecated since v0.15
     warninghelpers.deprecation_warning("Auto exit on session close will be deprecated in the next version.", stacklevel=2)
     self.__exitOnSessionClose = exitOnSessionClose
Ejemplo n.º 38
0
 def __init__(self, *args, **kwargs):
     # Deprecated since v0.13
     warninghelpers.deprecation_warning("Strategy class will be deprecated in the next version. Please use BaseStrategy or BacktestingStrategy instead.", stacklevel=2)
     ForexBacktestingStrategy.__init__(self, *args, **kwargs)
Ejemplo n.º 39
0
 def placeOrder(self, order):
     # Deprecated since v0.16
     warninghelpers.deprecation_warning(
         "placeOrder will be deprecated in the next version. Please use submitOrder instead.",
         stacklevel=2)
     return self.submitOrder(order)
Ejemplo n.º 40
0
 def __init__(self, skipWarning=False):
     if not skipWarning:
         warninghelpers.deprecation_warning(
             "pyalgotrade.barfeed.csvfeed.YahooFeed will be deprecated in the next version. Please use pyalgotrade.barfeed.yahoofeed.Feed instead.",
             stacklevel=2)
     BarFeed.__init__(self)
Ejemplo n.º 41
0
    def buildFigure(self, fromDateTime=None, toDateTime=None):
        # Deprecated in v0.18.
        warninghelpers.deprecation_warning("buildFigure will be deprecated in the next version. Use buildFigureAndSubplots.", stacklevel=2)

        fig, _ = self.buildFigureAndSubplots(fromDateTime, toDateTime)
        return fig
Ejemplo n.º 42
0
 def placeOrder(self, order):
     # Deprecated since v0.16
     warninghelpers.deprecation_warning("placeOrder will be deprecated in the next version. Please use submitOrder instead.", stacklevel=2)
     return self.submitOrder(order)
Ejemplo n.º 43
0
 def getNetProfit(self, includeCommissions=True):
     # Deprecated in v0.15.
     warninghelpers.deprecation_warning("getNetProfit will be deprecated in the next version. Please use getPnL instead.", stacklevel=2)
     return self.getPnL(includeCommissions)
Ejemplo n.º 44
0
	def getLastBars(self):
		warninghelpers.deprecation_warning("getLastBars will be deprecated in the next version. Please use getCurrentBars instead.", stacklevel=2)
		return self.getCurrentBars()
Ejemplo n.º 45
0
	def getResult(self):
		warninghelpers.deprecation_warning("getResult will be deprecated in the next version. Please use getReturn instead.", stacklevel=2)
		return self.getReturn(False)
Ejemplo n.º 46
0
 def __init__(self, *args, **kwargs):
     # Deprecated since v0.15
     warninghelpers.deprecation_warning(
         "Slope was moved in the pyalgotrade.technical.linreg package",
         stacklevel=2)
     linreg.Slope.__init__(self, *args, **kwargs)