# Path: pyti/catch_errors.py
# def check_for_period_error(data, period):
# def check_for_input_len_diff(*args):
# 
# Path: pyti/weighted_moving_average.py
# def weighted_moving_average(data, period):
#     """
#     Weighted Moving Average.
# 
#     Formula:
#     (P1 + 2 P2 + 3 P3 + ... + n Pn) / K
#     where K = (1+2+...+n) = n(n+1)/2 and Pn is the most recent price
#     """
#     catch_errors.check_for_period_error(data, period)
#     k = (period * (period + 1)) / 2.0
# 
#     wmas = []
#     for idx in range(0, len(data)-period+1):
#         product = [data[idx + period_idx] * (period_idx + 1) for period_idx in range(0, period)]
#         wma = sum(product) / k
#         wmas.append(wma)
#     wmas = fill_for_noncomputable_vals(data, wmas)
# 
#     return wmas


import numpy as np
from pyti import catch_errors
from pyti.weighted_moving_average import (
    weighted_moving_average as wma
    )
from __future__ import absolute_import


def hull_moving_average(data, period):
    """
    Hull Moving Average.

    Formula:
    HMA = WMA(2*WMA(n/2) - WMA(n)), sqrt(n)
    """
    catch_errors.check_for_period_error(data, period)
    hma = wma(

# Path: pyti/catch_errors.py
# def check_for_period_error(data, period):
# def check_for_input_len_diff(*args):
# 
# Path: pyti/weighted_moving_average.py
# def weighted_moving_average(data, period):
#     """
#     Weighted Moving Average.
# 
#     Formula:
#     (P1 + 2 P2 + 3 P3 + ... + n Pn) / K
#     where K = (1+2+...+n) = n(n+1)/2 and Pn is the most recent price
#     """
#     catch_errors.check_for_period_error(data, period)
#     k = (period * (period + 1)) / 2.0
# 
#     wmas = []
#     for idx in range(0, len(data)-period+1):
#         product = [data[idx + period_idx] * (period_idx + 1) for period_idx in range(0, period)]
#         wma = sum(product) / k
#         wmas.append(wma)
#     wmas = fill_for_noncomputable_vals(data, wmas)
# 
#     return wmas


# Path: pyti/hull_moving_average.py
import numpy as np
from pyti import catch_errors
from pyti.weighted_moving_average import (
    weighted_moving_average as wma
    )

from __future__ import absolute_import


def hull_moving_average(data, period):
    """
    Hull Moving Average.

    Formula:
    HMA = WMA(2*WMA(n/2) - WMA(n)), sqrt(n)
    """
    catch_errors.check_for_period_error(data, period)
    hma = wma(

        2 * wma(data, int(period/2)) - wma(data, period), int(np.sqrt(period))