# Path: pyti/catch_errors.py
# def check_for_period_error(data, period):
# def check_for_input_len_diff(*args):
# 
# Path: pyti/function_helper.py
# def fill_for_noncomputable_vals(input_data, result_data):
#     non_computable_values = np.repeat(
#         np.nan, len(input_data) - len(result_data)
#         )
#     filled_result_data = np.append(non_computable_values, result_data)
#     return filled_result_data
# 
# Path: pyti/true_range.py
# def true_range(close_data, period):
#     """
#     True Range.
# 
#     Formula:
#     TRt = MAX(abs(Ht - Lt), abs(Ht - Ct-1), abs(Lt - Ct-1))
#     """
#     catch_errors.check_for_period_error(close_data, period)
# 
#     tr = [np.max([np.max(close_data[idx+1-period:idx+1]) -
#                 np.min(close_data[idx+1-period:idx+1]),
#                 abs(np.max(close_data[idx+1-period:idx+1]) -
#                 close_data[idx-1]),
#                 abs(np.min(close_data[idx+1-period:idx+1]) -
#                 close_data[idx-1])]) for idx in range(period-1, len(close_data))]
#     tr = fill_for_noncomputable_vals(close_data, tr)
#     return tr


import numpy as np
from pyti import catch_errors
from pyti.function_helper import fill_for_noncomputable_vals
from pyti.true_range import true_range
from six.moves import range
from __future__ import absolute_import


def buying_pressure(close_data, low_data):
    """
    Buying Pressure.

    Formula:
    BP = current close - min()
    """
    catch_errors.check_for_input_len_diff(close_data, low_data)
    bp = [close_data[idx] - np.min([low_data[idx], close_data[idx-1]]) for idx in range(1, len(close_data))]
    bp = fill_for_noncomputable_vals(close_data, bp)
    return bp


def avg_helper(close_data, low_data, period):

# Path: pyti/catch_errors.py
# def check_for_period_error(data, period):
# def check_for_input_len_diff(*args):
# 
# Path: pyti/function_helper.py
# def fill_for_noncomputable_vals(input_data, result_data):
#     non_computable_values = np.repeat(
#         np.nan, len(input_data) - len(result_data)
#         )
#     filled_result_data = np.append(non_computable_values, result_data)
#     return filled_result_data
# 
# Path: pyti/true_range.py
# def true_range(close_data, period):
#     """
#     True Range.
# 
#     Formula:
#     TRt = MAX(abs(Ht - Lt), abs(Ht - Ct-1), abs(Lt - Ct-1))
#     """
#     catch_errors.check_for_period_error(close_data, period)
# 
#     tr = [np.max([np.max(close_data[idx+1-period:idx+1]) -
#                 np.min(close_data[idx+1-period:idx+1]),
#                 abs(np.max(close_data[idx+1-period:idx+1]) -
#                 close_data[idx-1]),
#                 abs(np.min(close_data[idx+1-period:idx+1]) -
#                 close_data[idx-1])]) for idx in range(period-1, len(close_data))]
#     tr = fill_for_noncomputable_vals(close_data, tr)
#     return tr


# Path: pyti/ultimate_oscillator.py
import numpy as np
from pyti import catch_errors
from pyti.function_helper import fill_for_noncomputable_vals
from pyti.true_range import true_range
from six.moves import range

from __future__ import absolute_import


def buying_pressure(close_data, low_data):
    """
    Buying Pressure.

    Formula:
    BP = current close - min()
    """
    catch_errors.check_for_input_len_diff(close_data, low_data)
    bp = [close_data[idx] - np.min([low_data[idx], close_data[idx-1]]) for idx in range(1, len(close_data))]
    bp = fill_for_noncomputable_vals(close_data, bp)
    return bp


def avg_helper(close_data, low_data, period):

    catch_errors.check_for_input_len_diff(close_data, low_data)