# 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


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


def chaikin_money_flow(close_data, high_data, low_data, volume, period):
    """
    Chaikin Money Flow.

    Formula:
    CMF = SUM[(((Cn - Ln) - (Hn - Cn)) / (Hn - Ln)) * V] / SUM(Vn)
    """
    catch_errors.check_for_input_len_diff(
        close_data, high_data, low_data, volume)

# 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/chaikin_money_flow.py
import numpy as np
from pyti import catch_errors
from pyti.function_helper import fill_for_noncomputable_vals
from six.moves import range

from __future__ import absolute_import


def chaikin_money_flow(close_data, high_data, low_data, volume, period):
    """
    Chaikin Money Flow.

    Formula:
    CMF = SUM[(((Cn - Ln) - (Hn - Cn)) / (Hn - Ln)) * V] / SUM(Vn)
    """
    catch_errors.check_for_input_len_diff(
        close_data, high_data, low_data, volume)

    catch_errors.check_for_period_error(close_data, period)