Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
high = mid - 1
if mid >= total:
return (0, 0)
start_pos = mid
low = mid
high = total - 1
while low <= high:
tmp_datetime = Datetime(data.index[high])
if end_datetime > tmp_datetime:
mid = high + 1
break
tmp_datetime = Datetime(data.index[low])
if tmp_datetime >= end_datetime:
mid = low
break
mid = (low + high) // 2
tmp_datetime = Datetime(data.index[mid])
if end_datetime > tmp_datetime:
low = mid + 1
else:
high = mid - 1
end_pos = total if mid >= total else mid
if start_pos >= end_pos:
return (0,0)
return (start_pos, end_pos)
def TA_CDLCLOSINGMARUBOZU(ind=None):
imp = crtTaIndicatorImp(ta.CDLCLOSINGMARUBOZU, 'TA_CDLCLOSINGMARUBOZU',
result_num = 1,
prices = ['open', 'high', 'low', 'close'])
return Indicator(imp)(ind) if ind else Indicator(imp)
def TA_ATR(ind=None, timeperiod=14):
imp = crtTaIndicatorImp(ta.ATR, 'TA_ATR',
result_num = 1,
params={'timeperiod': timeperiod},
prices = ['high', 'low', 'close'])
return Indicator(imp)(ind) if ind else Indicator(imp)
def TA_MIDPOINT(ind=None, timeperiod=14):
imp = crtTaIndicatorImp(ta.MIDPOINT, 'TA_MIDPOINT',
result_num = 1,
params={'timeperiod': timeperiod})
return Indicator(imp)(ind) if ind else Indicator(imp)
def TA_CDLTHRUSTING(ind=None):
imp = crtTaIndicatorImp(ta.CDLTHRUSTING, 'TA_CDLTHRUSTING',
result_num = 1,
prices = ['open', 'high', 'low', 'close'])
return Indicator(imp)(ind) if ind else Indicator(imp)
def TA_CDLMATHOLD(ind=None, penetration=0.5):
imp = crtTaIndicatorImp(ta.CDLMATHOLD, 'TA_CDLMATHOLD',
result_num = 1,
params={'penetration': penetration},
prices = ['open', 'high', 'low', 'close'])
return Indicator(imp)(ind) if ind else Indicator(imp)
def TA_CDLMARUBOZU(ind=None):
imp = crtTaIndicatorImp(ta.CDLMARUBOZU, 'TA_CDLMARUBOZU',
result_num = 1,
prices = ['open', 'high', 'low', 'close'])
return Indicator(imp)(ind) if ind else Indicator(imp)
def TA_ROCP(ind=None, timeperiod=10):
imp = crtTaIndicatorImp(ta.ROCP, 'TA_ROCP',
result_num = 1,
params={'timeperiod': timeperiod})
return Indicator(imp)(ind) if ind else Indicator(imp)
def TA_TYPPRICE(ind=None, timeperiod=14):
imp = crtTaIndicatorImp(ta.TYPPRICE, 'TA_TYPPRICE',
result_num = 1,
prices = ['high', 'low', 'close'])
return Indicator(imp)(ind) if ind else Indicator(imp)
def TA_CDLSTALLEDPATTERN(ind=None):
imp = crtTaIndicatorImp(ta.CDLSTALLEDPATTERN, 'TA_CDLSTALLEDPATTERN',
result_num = 1,
prices = ['open', 'high', 'low', 'close'])
return Indicator(imp)(ind) if ind else Indicator(imp)