Example #1
0
    def analyze_ichimoku_cloud(self, market_pair, exchange, hot_thresh=0, cold_thresh=0):
        ic_analyzer = IchimokuCloud()

        tenkansen_period = 9
        kijunsen_period = 26
        senkou_span_b_period = 52
        chikou_span_period = 26

        tankensen_historical_data = self.day_historical_data[0:tenkansen_period]
        kijunsen_historical_data = self.day_historical_data[0:kijunsen_period]
        senkou_span_b_historical_data = self.day_historical_data[0:senkou_span_b_period]

        leading_span_a = ic_analyzer.get_senkou_span_a(
            kijunsen_historical_data,
            tankensen_historical_data
        )

        leading_span_b = ic_analyzer.get_senkou_span_b(senkou_span_b_historical_data)

        ichimoku_data = {
            'values': (leading_span_a, leading_span_b),
            'is_hot': False,
            'is_cold': False
        }

        return ichimoku_data
Example #2
0
    def analyze_ichimoku_cloud(self, market_pair):
        ic_analyzer = IchimokuCloud()
        base_line_data = self.exchange_interface.get_historical_data(
            market_pair=market_pair, period_count=26, time_unit='1d')
        conversion_line_data = self.exchange_interface.get_historical_data(
            market_pair=market_pair, period_count=9, time_unit='1d')
        span_b_data = self.exchange_interface.get_historical_data(
            market_pair=market_pair, period_count=52, time_unit='1d')

        leading_span_a = ic_analyzer.calculate_leading_span_a(
            base_line_data, conversion_line_data)
        leading_span_b = ic_analyzer.calculate_leading_span_b(span_b_data)
        return leading_span_a, leading_span_b
Example #3
0
    def analyze_ichimoku_cloud(self,
                               historial_data,
                               hot_thresh=None,
                               cold_thresh=None):
        """Performs an ichimoku cloud analysis on the historical data

        Args:
            historial_data (list): A matrix of historical OHCLV data.
            hot_thresh (float, optional): Defaults to None. The threshold at which this might be good
                to purchase.
            cold_thresh (float, optional): Defaults to None. The threshold at which this might be good
                to sell.

        Returns:
            dict: A dictionary containing a tuple of indicator values and booleans for buy / sell
                indication.
        """

        ic_analyzer = IchimokuCloud()

        tenkansen_period = 9
        kijunsen_period = 26
        senkou_span_b_period = 52
        chikou_span_period = 26

        tankensen_historical_data = historial_data[0:tenkansen_period]
        kijunsen_historical_data = historial_data[0:kijunsen_period]
        senkou_span_b_historical_data = historial_data[0:senkou_span_b_period]

        leading_span_a = ic_analyzer.get_senkou_span_a(
            kijunsen_historical_data, tankensen_historical_data)

        leading_span_b = ic_analyzer.get_senkou_span_b(
            senkou_span_b_historical_data)

        ichimoku_data = {
            'values': (leading_span_a, leading_span_b),
            'is_hot': False,
            'is_cold': False
        }

        return ichimoku_data
Example #4
0
    def analyze_ichimoku_cloud(self,
                               historial_data,
                               hot_thresh=None,
                               cold_thresh=None):
        """Performs an ichimoku cloud analysis on the historical data

        Args:
            historial_data (list): A matrix of historical OHCLV data.
            hot_thresh (float, optional): Defaults to None. The threshold at which this might be
                good to purchase.
            cold_thresh (float, optional): Defaults to None. The threshold at which this might be
                good to sell.

        Returns:
            dict: A dictionary containing a tuple of indicator values and booleans for buy / sell
                indication.
        """

        ic_analyzer = IchimokuCloud()

        tenkansen_period = 9
        kijunsen_period = 26
        senkou_span_b_period = 52

        tenkansen_historical_data = historial_data[-tenkansen_period:]
        kijunsen_historical_data = historial_data[-kijunsen_period:]
        senkou_span_b_historical_data = historial_data[-senkou_span_b_period:]

        tenkan_sen = ic_analyzer.get_tenkansen(tenkansen_historical_data)
        kijun_sen = ic_analyzer.get_kijunsen(kijunsen_historical_data)
        leading_span_a = ic_analyzer.get_senkou_span_a(
            kijunsen_historical_data, tenkansen_historical_data)

        leading_span_b = ic_analyzer.get_senkou_span_b(
            senkou_span_b_historical_data)

        is_hot = False
        if leading_span_a > leading_span_b and hot_thresh is not None:
            if historial_data[-1][4] > leading_span_a:
                is_hot = True

        is_cold = False
        if leading_span_a < leading_span_b and cold_thresh is not None:
            if historial_data[-1][4] < leading_span_b:
                is_cold = True

        if math.isnan(tenkan_sen):
            tenkan_sen = None

        if math.isnan(kijun_sen):
            kijun_sen = None

        ichimoku_data = {
            'values': (tenkan_sen, kijun_sen),
            'is_hot': is_hot,
            'is_cold': is_cold
        }

        return ichimoku_data
Example #5
0
    def analyze_ichimoku_cloud(self,
                               market_pair,
                               exchange,
                               ichimoku_threshold=0):
        ic_analyzer = IchimokuCloud()

        span_b_periods = self.ichimoku_config['span_b']['period_count']
        base_line_periods = self.ichimoku_config['base_line']['period_count']
        conversion_line_periods = self.ichimoku_config['conversion_line'][
            'period_count']

        max_period_count = max(span_b_periods, base_line_periods,
                               conversion_line_periods)

        history = self.__exchange_interface.get_historical_data(
            market_pair=market_pair,
            exchange=exchange,
            period_count=max_period_count,
            time_unit=self.ichimoku_config['time_unit'])

        base_line_data = history[0:base_line_periods]
        conversion_line_data = history[0:conversion_line_periods]
        span_b_data = history[0:span_b_periods]

        leading_span_a = ic_analyzer.get_leading_span_a(
            base_line_data, conversion_line_data)
        leading_span_b = ic_analyzer.get_leading_span_b(span_b_data)
        is_ichimoku_trending = ic_analyzer.is_ichimoku_trending(
            self.ichimoku_config["ichimoku_threshold"])

        ichimoku_data = {
            'span_a_value': leading_span_a,
            'span_b_value': leading_span_b,
            'is_ichimoku_trending': is_ichimoku_trending
        }

        return ichimoku_data