Esempio 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)
Esempio 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())
Esempio 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)
Esempio 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())
Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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())
Esempio 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)
Esempio 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
Esempio 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)
Esempio 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
Esempio 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)
Esempio 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
Esempio 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
Esempio 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)
Esempio 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
Esempio 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)
Esempio 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
Esempio 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)
Esempio 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
Esempio 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
Esempio 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
Esempio 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
Esempio 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
Esempio 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
Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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()
Esempio 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)
Esempio 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)
Esempio 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())
Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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
Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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
Esempio 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)
Esempio 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)
Esempio 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()
Esempio 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)
Esempio 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)