# Path: dynts/dsl/functions/registry.py
# class FunctionBase(ASTFunctionBase):
#     '''Base class for a timeseries function implementation.
# The only member function to implement is the ``__call__`` method.
# 
#     .. function:: __call__(args, **kwargs)
# 
#         where *args* is a list of arguments (timeseries or other objects) and
#         *kwargs* is a dictionary of input parameters.
#         For example, the rolling-standard deviation is defined as::
# 
#             std(expression,window=20)
#     '''
#     abstract = True
#     description = ''
# 
#     def __str__(self):
#         return self.name
# 
#     def __repr__(self):
#         return self.name


from .registry import FunctionBase

    sd(tiker,window=40)
    sd(tiker, window=40, scale = 252)
    sd(ldelta(GOOG), window = 60, scale = 252)

:parameter window: the rolling window in units. Default ``20``
:parameter scale: Scaling constant. Default ``1``
'''
    def apply(self, ts, **kwargs):
        return ts.rollsd(**kwargs)


class Sharpe(ScalarWindowFunction):
    '''\
Rolling Annualised Sharpe Ratio given by:

.. math::

    {\\tt sharpe}(y_t,w) = \\frac{y_t-y_{t-w}}{{\\tt sd}({\\tt delta}(y_t),w)}

Typical usage::

    sharpe(tiker)
    sharpe(tiker,window=40)

:parameter window: the rolling window in units. Default ``20``.
'''
    def apply(self, ts, **kwargs):
        return ts.rollapply('sharpe',**kwargs)



# Path: dynts/dsl/functions/registry.py
# class FunctionBase(ASTFunctionBase):
#     '''Base class for a timeseries function implementation.
# The only member function to implement is the ``__call__`` method.
# 
#     .. function:: __call__(args, **kwargs)
# 
#         where *args* is a list of arguments (timeseries or other objects) and
#         *kwargs* is a dictionary of input parameters.
#         For example, the rolling-standard deviation is defined as::
# 
#             std(expression,window=20)
#     '''
#     abstract = True
#     description = ''
# 
#     def __str__(self):
#         return self.name
# 
#     def __repr__(self):
#         return self.name


# Path: dynts/dsl/functions/simple.py
from .registry import FunctionBase

    sd(tiker,window=40)
    sd(tiker, window=40, scale = 252)
    sd(ldelta(GOOG), window = 60, scale = 252)

:parameter window: the rolling window in units. Default ``20``
:parameter scale: Scaling constant. Default ``1``
'''
    def apply(self, ts, **kwargs):
        return ts.rollsd(**kwargs)


class Sharpe(ScalarWindowFunction):
    '''\
Rolling Annualised Sharpe Ratio given by:

.. math::

    {\\tt sharpe}(y_t,w) = \\frac{y_t-y_{t-w}}{{\\tt sd}({\\tt delta}(y_t),w)}

Typical usage::

    sharpe(tiker)
    sharpe(tiker,window=40)

:parameter window: the rolling window in units. Default ``20``.
'''
    def apply(self, ts, **kwargs):
        return ts.rollapply('sharpe',**kwargs)



class reg(FunctionBase):
