Example #1
0
 async def ohlcv_callback(self, exchange: str, exchange_id: str,
                          cryptocurrency: str, symbol: str, time_frame,
                          candle, inc_in_construction_data):
     exchange_symbol_data = self.get_exchange_symbol_data(
         exchange, exchange_id, symbol)
     high = trading_api.get_symbol_high_candles(
         exchange_symbol_data,
         time_frame,
         include_in_construction=inc_in_construction_data)
     low = trading_api.get_symbol_low_candles(
         exchange_symbol_data,
         time_frame,
         include_in_construction=inc_in_construction_data)
     close = trading_api.get_symbol_close_candles(
         exchange_symbol_data,
         time_frame,
         include_in_construction=inc_in_construction_data)
     self.eval_note = commons_constants.START_PENDING_EVAL_NOTE
     if len(close) > self.length:
         await self.evaluate(cryptocurrency, symbol, time_frame, candle,
                             high, low, close)
     await self.evaluation_completed(
         cryptocurrency,
         symbol,
         time_frame,
         eval_time=evaluators_util.get_eval_time(full_candle=candle,
                                                 time_frame=time_frame))
Example #2
0
 async def ohlcv_callback(self, exchange: str, exchange_id: str,
                          cryptocurrency: str, symbol: str, time_frame, candle, inc_in_construction_data):
     candle_data = trading_api.get_symbol_close_candles(self.get_exchange_symbol_data(exchange, exchange_id, symbol),
                                                        time_frame,
                                                        self.period_length,
                                                        include_in_construction=inc_in_construction_data)
     await self.evaluate(cryptocurrency, symbol, time_frame, candle_data, candle)
Example #3
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))
 def get_diff(self, exchange: str, exchange_id: str, symbol: str, time_frame):
     candle_data = trading_api.get_symbol_close_candles(self.get_exchange_symbol_data(exchange, exchange_id, symbol),
                                                        time_frame,
                                                        limit=2)
     yesterday = candle_data[-2]
     today = candle_data[-1]
     delta = today - yesterday
     return delta / yesterday
Example #5
0
 def _get_rsi_averages(self, symbol_candles, time_frame, include_in_construction):
     # compute the slow and fast RSI average
     candle_data = trading_api.get_symbol_close_candles(symbol_candles, time_frame,
                                                        include_in_construction=include_in_construction)
     if len(candle_data) > self.period_length:
         rsi_v = tulipy.rsi(candle_data, period=self.period_length)
         rsi_v = data_util.drop_nan(rsi_v)
         if len(rsi_v):
             slow_average = numpy.mean(rsi_v[-self.slow_eval_count:])
             fast_average = numpy.mean(rsi_v[-self.fast_eval_count:])
             return slow_average, fast_average, rsi_v
     return None, None, None
Example #6
0
 def close(self):
     return trading_api.get_symbol_close_candles(
         self.candles,
         self.time_frame,
         include_in_construction=self.inc_in_construction_data)