本文整理汇总了Python中pyalgotrade.warninghelpers.deprecation_warning函数的典型用法代码示例。如果您正苦于以下问题:Python deprecation_warning函数的具体用法?Python deprecation_warning怎么用?Python deprecation_warning使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了deprecation_warning函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUseAdjustedValues
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
示例2: __init__
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)
示例3: order
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)
示例4: exitPosition
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)
示例5: getAdjLow
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)
示例6: getQuantity
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())
示例7: __init__
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)
示例8: getValue
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())
示例9: getValue
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
示例10: getUnrealizedNetProfit
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)
示例11: __init__
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
示例12: getValuesAbsolute
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
示例13: getPnL
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
示例14: getValues
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
示例15: exit
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)