# Path: dynts/dsl/functions/registry.py
# def composeFunction(name, comp, description='', docs=''):
#     attrs = {
#         'composite': comp,
#         '__doc__': docs,
#         'description': description
#     }
#     return ASTFunctionMeta(name, (CompositeBase,), attrs)
# 
# Path: dynts/dsl/functions/simple.py
# class ScalarWindowFunction(ScalarFunction):
#     abstract = True
# 
#     def get_name(self, arg, window, **kwargs):
#         return '%s(%s,window=%s)' % (self.name, arg, window)


from .registry import composeFunction
from .simple import ScalarWindowFunction

    'asharpe',
    '15.874*sharpe(delta(x1),window=20)',
    docs='''\
a''',
    description='Annualised volatility'
)

# Annualized sharpe on log-changes
composeFunction(
    'alsharpe',
    '15.874*sharpe(ldelta(x1),window=20)',
    docs='''\
a''',
    description='Annualised volatility'
)


class zscore(ScalarWindowFunction):
    """\
    Rolling Z-Score function:

    .. math::

        zs_{n,w} = \\frac{y_n - y_{n-w}}{\sigma_{n,w}}

    """
    def apply(self, ts, **kwargs):
        return tsfunctions.zscore(ts, **kwargs)



# Path: dynts/dsl/functions/registry.py
# def composeFunction(name, comp, description='', docs=''):
#     attrs = {
#         'composite': comp,
#         '__doc__': docs,
#         'description': description
#     }
#     return ASTFunctionMeta(name, (CompositeBase,), attrs)
# 
# Path: dynts/dsl/functions/simple.py
# class ScalarWindowFunction(ScalarFunction):
#     abstract = True
# 
#     def get_name(self, arg, window, **kwargs):
#         return '%s(%s,window=%s)' % (self.name, arg, window)


# Path: dynts/dsl/functions/composite.py
from .registry import composeFunction
from .simple import ScalarWindowFunction

    'asharpe',
    '15.874*sharpe(delta(x1),window=20)',
    docs='''\
a''',
    description='Annualised volatility'
)

# Annualized sharpe on log-changes
composeFunction(
    'alsharpe',
    '15.874*sharpe(ldelta(x1),window=20)',
    docs='''\
a''',
    description='Annualised volatility'
)


class zscore(ScalarWindowFunction):
    """\
    Rolling Z-Score function:

    .. math::

        zs_{n,w} = \\frac{y_n - y_{n-w}}{\sigma_{n,w}}

    """
    def apply(self, ts, **kwargs):
        return tsfunctions.zscore(ts, **kwargs)



class prange(ScalarWindowFunction):
