예제 #1
0
def BASPN(data, period=40):
    """
    Buy and Sell Pressure Normalized

    :param pd.DataFrame data: pandas DataFrame with open, high, low, close data
    :param int period: period used for indicator calculation
    :return pd.Series: with indicator data calculation results
    """
    return TA.BASPN(data, period)
예제 #2
0
def test_baspn():
    """test TA.BASPN"""

    basp = TA.BASPN(ohlc)

    assert isinstance(basp["Buy."], series.Series)
    assert isinstance(basp["Sell."], series.Series)

    assert basp["Buy."].values[-1] == 0.56374213100174275
    assert basp["Sell."].values[-1] == 0.74103021131003344
예제 #3
0
def test_baspn():
    """test TA.BASPN"""

    basp = TA.BASPN(ohlc).round(decimals=8)

    assert isinstance(basp["Buy."], series.Series)
    assert isinstance(basp["Sell."], series.Series)

    assert basp["Buy."].values[-1] == 0.56374213
    assert basp["Sell."].values[-1] == 0.74103021
예제 #4
0
파일: test_unit.py 프로젝트: toledy/finta
def test_baspn():
    '''test TA.BASPN'''

    basp = TA.BASPN(ohlc)

    assert isinstance(basp['Buy.'], series.Series)
    assert isinstance(basp['Sell.'], series.Series)

    assert basp['Buy.'].values[-1] == 0.56374213100174275
    assert basp['Sell.'].values[-1] == 0.74103021131003344
예제 #5
0
    def get_baspn(data):
        """Calculate the normalized buying and selling pressure of given dataframe.

        :param data: a dataframe in OHLC format
        :return: a concatenated Pandas series
        """
        if data is None:
            raise EmptyDataError("[!] Invalid data value")

        result = TA.BASPN(data)
        if result is None:
            raise IndicatorException
        return result
    # Bull and bear power
    prices["BullPower"], prices["BearPower"] = TA.EBBP(ohlc)

    # Ease of movement oscillator - distance from zero indicates ease (neg is down, positive is up)
    prices["EMI"] = TA.EMV(ohlcv)

    # Commodity Channel Index - above +100 is overbought, below -100 is oversold
    prices["CCI"] = TA.CCI(ohlc)

    # Coppock curve - momentum indicator (buy when it crosses from negative to positive
    prices["COPP"] = TA.COPP(ohlc)

    # Buying and selling pressure indicator
    prices["BASP_buy"], prices["BASP_sell"] = TA.BASP(ohlc)
    prices["BASPN_buy"], prices["BASPN_sell"] = TA.BASPN(ohlc)

    # Double exponential moving average - attempts to remove the moving average lag
    prices["DEMA"] = TA.DEMA(ohlc)

    # Triple exponential moving average - attempts to remove the moving average lag
    prices["TEMA"] = TA.TEMA(ohlc)
    # rate of change of TEMA - BUY/SELL triggered by zero crossings
    prices["TRIX"] = TA.TRIX(ohlc)
    prices["TRIX-signal"] = prices["TRIX"] / prices['TRIX'].ewm(span=9).mean()

    # Triangular moving average
    prices["TRIMA"] = TA.TRIMA(ohlc)

    # Volume adjusted moving average
    prices["VAMA"] = TA.VAMA(ohlcv)