MCPcopy Create free account
hub / github.com/ScottfreeLLC/AlphaPy / maratio

Function maratio

alphapy/transforms.py:923–944  ·  view source on GitHub ↗

r"""Calculate the ratio of two moving averages. Parameters ---------- f : pandas.DataFrame Dataframe containing the column ``c``. c : str Name of the column in the dataframe ``f``. p1 : int The period of the first moving average. p2 : int The

(f, c, p1 = 1, p2 = 10)

Source from the content-addressed store, hash-verified

921#
922
923def maratio(f, c, p1 = 1, p2 = 10):
924 r"""Calculate the ratio of two moving averages.
925
926 Parameters
927 ----------
928 f : pandas.DataFrame
929 Dataframe containing the column ``c``.
930 c : str
931 Name of the column in the dataframe ``f``.
932 p1 : int
933 The period of the first moving average.
934 p2 : int
935 The period of the second moving average.
936
937 Returns
938 -------
939 new_column : pandas.Series (float)
940 The array containing the new feature.
941
942 """
943 new_column = ma(f, c, p1) / ma(f, c, p2)
944 return new_column
945
946
947#

Callers

nothing calls this directly

Calls 1

maFunction · 0.85

Tested by

no test coverage detected