def __init__(self, fwd_returns_window=1, task="regression"):
     #
     if task == "regression":
         self.labeler = RegressionLabler(window=fwd_returns_window)
             
     self.pct_change = tf.PctChange(window=1)
     self.ReturnsRollingStd = jf.ReturnsRollingStd(window=4)
     self.net_profit = CustomFeature()
 def __init__(self):
     self.pct_change = tf.PctChange(window=1) 
     
     # price-volume
     self.PriceVolume = talib.PriceVolume()
     
     
     # extra added
     self.KDJ = talib.KDJRelated(fastk_period=9, slowk_period=3, slowd_period=3)
     
     # journal
     self.ReturnsRollingStd4 = jf.ReturnsRollingStd(window=4)
     self.ReturnsRollingStd12 = jf.ReturnsRollingStd(window=12)
     
     self.BackwardSharpRatio4 = jf.BackwardSharpRatio(window=4)
     self.BackwardSharpRatio12 = jf.BackwardSharpRatio(window=12)
     
     # trading factor
     self.VolumeReturnsCorr4 = vp.VolumeReturnsCorr(window=4)
     self.VolumeReturnsCorr12 = vp.VolumeReturnsCorr(window=12)
     
     self.HighLowCorr4 = vp.HighLowCorr(window=4)
Ejemplo n.º 3
0
    def __init__(self, fwd_returns_window=1, task="regression"):
        #
        if task == "regression":
            self.labeler = RegressionLabler(window=fwd_returns_window)

        self.pct_change = tf.PctChange(window=1)
        #
        self.ROCP = talib.ROCP(timeperiod=1)
        self.MACD = talib.MACDRelated(fastperiod=12,
                                      slowperiod=26,
                                      signalperiod=9)
        self.RSI6 = talib.DemeanedRSI(timeperiod=6)
        self.RSI12 = talib.DemeanedRSI(timeperiod=12)
        self.RSI24 = talib.DemeanedRSI(timeperiod=24)

        self.RSIROCP6 = talib.RSIROCP(timeperiod=6)
        self.RSIROCP12 = talib.RSIROCP(timeperiod=12)
        self.RSIROCP24 = talib.RSIROCP(timeperiod=24)

        self.VROCP = talib.VolumeROCP()
        #BOLL
        self.BOLL = talib.BBANDS(timeperiod=5, nbdevup=2, nbdevdn=2, matype=0)

        #MA
        self.MAROCP5 = talib.MAROCP(timeperiod=5)
        self.MAROCP10 = talib.MAROCP(timeperiod=10)
        self.MAROCP20 = talib.MAROCP(timeperiod=20)
        self.MAROCP30 = talib.MAROCP(timeperiod=30)
        self.MAROCP60 = talib.MAROCP(timeperiod=60)
        self.MAROCP90 = talib.MAROCP(timeperiod=90)

        self.MARelative5 = talib.MARelative(timeperiod=5)
        self.MARelative10 = talib.MARelative(timeperiod=10)
        self.MARelative20 = talib.MARelative(timeperiod=20)
        self.MARelative30 = talib.MARelative(timeperiod=30)
        self.MARelative60 = talib.MARelative(timeperiod=60)
        self.MARelative90 = talib.MARelative(timeperiod=90)

        #VMA
        self.VolumeRelative5 = talib.VolumeRelative(timeperiod=5)
        self.VolumeRelative10 = talib.VolumeRelative(timeperiod=10)
        self.VolumeRelative20 = talib.VolumeRelative(timeperiod=20)
        self.VolumeRelative30 = talib.VolumeRelative(timeperiod=30)
        self.VolumeRelative60 = talib.VolumeRelative(timeperiod=60)
        self.VolumeRelative90 = talib.VolumeRelative(timeperiod=90)

        # price-volume
        self.PriceVolume = talib.PriceVolume()

        # extra added
        self.KDJ = talib.KDJRelated(fastk_period=9,
                                    slowk_period=3,
                                    slowd_period=3)

        # journal
        self.ReturnsRollingStd4 = jf.ReturnsRollingStd(window=4)
        self.ReturnsRollingStd12 = jf.ReturnsRollingStd(window=12)
        self.ReturnsRollingStd22 = jf.ReturnsRollingStd(window=22)

        self.BackwardSharpRatio4 = jf.BackwardSharpRatio(window=4)
        self.BackwardSharpRatio12 = jf.BackwardSharpRatio(window=12)
        self.BackwardSharpRatio22 = jf.BackwardSharpRatio(window=22)
        self.BackwardSharpRatio36 = jf.BackwardSharpRatio(window=36)

        # trading factor
        self.VolumeReturnsCorr4 = vp.VolumeReturnsCorr(window=4)
        self.VolumeReturnsCorr12 = vp.VolumeReturnsCorr(window=12)
        self.VolumeReturnsCorr22 = vp.VolumeReturnsCorr(window=22)

        self.HighLowCorr4 = vp.HighLowCorr(window=4)
        self.HighLowCorr12 = vp.HighLowCorr(window=12)
        self.HighLowCorr22 = vp.HighLowCorr(window=22)

        self.VolumeVwapDeviation4 = vp.VolumeVwapDeviation(window=4)
        self.VolumeVwapDeviation12 = vp.VolumeVwapDeviation(window=12)
        self.VolumeVwapDeviation22 = vp.VolumeVwapDeviation(window=22)

        self.OpenJump = vp.OpenJump()
        self.AbnormalVolume4 = vp.AbnormalVolume(window=4)
        self.AbnormalVolume12 = vp.AbnormalVolume(window=12)
        self.AbnormalVolume22 = vp.AbnormalVolume(window=22)

        self.VolumeRangeDeviation4 = vp.VolumeRangeDeviation(window=4)
        self.VolumeRangeDeviation12 = vp.VolumeRangeDeviation(window=12)
        self.VolumeRangeDeviation22 = vp.VolumeRangeDeviation(window=22)