# Path: alphaware/enums.py
# class OutputDataFormat(IntEnum):
#     MULTI_INDEX_DF = 0
#     PITVOT_TABLE_DF = 1
# 
# class ReturnType(IntEnum):
#     Non_Cumul = 0
#     Cumul = 1
# 
# Path: alphaware/const.py
# RETURN = namedtuple('RETURN', ['data', 'type'])


import pandas as pd
import numpy as np
from datetime import datetime
from argcheck import expect_types
from xutils.date_utils import Date
from empyrical import cum_returns
from ..enums import (OutputDataFormat,
                     ReturnType)
from ..const import RETURN
    if isinstance(arg, pd.DataFrame):
        return arg
    else:
        return pd.DataFrame(arg)


@expect_types(arg=(np.ndarray, pd.DataFrame, pd.Series))
def ensure_np_array(func, argname, arg):
    """
    :return: 转换成np.ndarray格式
    """
    if isinstance(arg, np.ndarray):
        return arg
    else:
        return arg.values


def ensure_cumul_return(func, argname, arg):
    if not isinstance(arg, RETURN):
        return arg
    if arg.type == ReturnType.Cumul:
        return arg.data
    else:
        data_ = cum_returns(arg.data, starting_value=1.0)
        return data_


def ensure_noncumul_return(func, argname, arg):
    if not isinstance(arg, RETURN):
        return arg

# Path: alphaware/enums.py
# class OutputDataFormat(IntEnum):
#     MULTI_INDEX_DF = 0
#     PITVOT_TABLE_DF = 1
# 
# class ReturnType(IntEnum):
#     Non_Cumul = 0
#     Cumul = 1
# 
# Path: alphaware/const.py
# RETURN = namedtuple('RETURN', ['data', 'type'])


# Path: alphaware/utils/input_validation.py
import pandas as pd
import numpy as np
from datetime import datetime
from argcheck import expect_types
from xutils.date_utils import Date
from empyrical import cum_returns
from ..enums import (OutputDataFormat,
                     ReturnType)
from ..const import RETURN

    if isinstance(arg, pd.DataFrame):
        return arg
    else:
        return pd.DataFrame(arg)


@expect_types(arg=(np.ndarray, pd.DataFrame, pd.Series))
def ensure_np_array(func, argname, arg):
    """
    :return: 转换成np.ndarray格式
    """
    if isinstance(arg, np.ndarray):
        return arg
    else:
        return arg.values


def ensure_cumul_return(func, argname, arg):
    if not isinstance(arg, RETURN):
        return arg
    if arg.type == ReturnType.Cumul:
        return arg.data
    else:
        data_ = cum_returns(arg.data, starting_value=1.0)
        return data_


def ensure_noncumul_return(func, argname, arg):
    if not isinstance(arg, RETURN):
        return arg

    if arg.type == ReturnType.Non_Cumul: