Exemple #1
0
 async def ohlcv_callback(self, exchange: str, exchange_id: str,
                          cryptocurrency: str, symbol: str, time_frame,
                          candle, inc_in_construction_data):
     symbol_candles = self.get_exchange_symbol_data(exchange, exchange_id,
                                                    symbol)
     high_candles = trading_api.get_symbol_high_candles(
         symbol_candles,
         time_frame,
         include_in_construction=inc_in_construction_data)
     if len(high_candles) >= self.short_period:
         low_candles = trading_api.get_symbol_low_candles(
             symbol_candles,
             time_frame,
             include_in_construction=inc_in_construction_data)
         close_candles = trading_api.get_symbol_close_candles(
             symbol_candles,
             time_frame,
             include_in_construction=inc_in_construction_data)
         volume_candles = trading_api.get_symbol_volume_candles(
             symbol_candles,
             time_frame,
             include_in_construction=inc_in_construction_data)
         await self.evaluate(cryptocurrency, symbol, time_frame,
                             high_candles, low_candles, close_candles,
                             volume_candles, candle)
     else:
         self.eval_note = False
         await self.evaluation_completed(
             cryptocurrency,
             symbol,
             time_frame,
             eval_time=evaluators_util.get_eval_time(full_candle=candle,
                                                     time_frame=time_frame))
Exemple #2
0
    async def ohlcv_callback(self, exchange: str, exchange_id: str,
                             cryptocurrency: str, symbol: str, time_frame,
                             candle, inc_in_construction_data):

        close = trading_api.get_symbol_close_candles(
            self.get_exchange_symbol_data(exchange, exchange_id, symbol),
            time_frame,
            include_in_construction=inc_in_construction_data)
        volume = trading_api.get_symbol_volume_candles(
            self.get_exchange_symbol_data(exchange, exchange_id, symbol),
            time_frame,
            include_in_construction=inc_in_construction_data)
        self.eval_note = commons_constants.START_PENDING_EVAL_NOTE
        if len(close) > self.slow_length:
            await self.evaluate(cryptocurrency, symbol, time_frame, candle,
                                close, volume)
        await self.evaluation_completed(
            cryptocurrency,
            symbol,
            time_frame,
            eval_time=evaluators_util.get_eval_time(full_candle=candle,
                                                    time_frame=time_frame))