jesse-ai / jesse

An advanced crypto trading bot written in Python
https://jesse.trade
MIT License
5.73k stars 732 forks source link

Getting websocket error when using T3, dema or tema indicators #486

Closed UmitOzdemir closed 5 days ago

UmitOzdemir commented 5 days ago

Describe the bug After creating a new strategy, I have added one of the these 3 indicators and an after method for interactive chart. But UI gives Error parsing websocket message data.

To Reproduce Steps to reproduce the behavior:

  1. Create a new strategy
  2. Add a property for tema or T3 or dema
  3. Add an after method to add it to the chart
  4. Run it on any timeframe with or without fastmode, enable interactive chart Example code: @property def tema(self): return ta.tema(self.candles, period=120, source_type="hl2")

    def after(self) -> None: self.add_line_to_candle_chart('tema', self.tema, "green")

Expected behavior Expecting to see the indicator on the chart

Screenshots Browser console log: 0.0.0.0-1731473210773.log Screenshot 2024-11-13 at 04 55 33

Enviroment (please complete the following information): iOS 15.1 (24B83), Chrome 130.0.6723.117 Jesse 1.3.13,

Additional context Add any other context about the problem here.

UmitOzdemir commented 5 days ago

This may not be related with the indicators. But something about caching. Today I got another error message after cleaning the database cache from settings menu. It works correctly, if I choose another date period.


2024-11-13 10:57:31 [2024-11-13 10:57:31,655] [timeloop] [INFO] Timeloop now started. Jobs will run based on the interval set 2024-11-13 10:57:31 Unhandled exception in the process: 2024-11-13 10:57:31 Traceback (most recent call last): 2024-11-13 10:57:31 File "/jesse-docker/jesse/services/multiprocessing.py", line 21, in run 2024-11-13 10:57:31 mp.Process.run(self) 2024-11-13 10:57:31 File "/usr/local/lib/python3.11/multiprocessing/process.py", line 108, in run 2024-11-13 10:57:31 self._target(*self._args, **self._kwargs) 2024-11-13 10:57:31 File "/jesse-docker/jesse/modes/backtest_mode.py", line 68, in run 2024-11-13 10:57:31 _execute_backtest( 2024-11-13 10:57:31 File "/jesse-docker/jesse/modes/backtest_mode.py", line 120, in _execute_backtest 2024-11-13 10:57:31 warmup_candles, candles = load_candles( 2024-11-13 10:57:31 ^^^^^^^^^^^^^ 2024-11-13 10:57:31 File "/jesse-docker/jesse/modes/backtest_mode.py", line 336, in load_candles 2024-11-13 10:57:31 warmup_candles_arr, trading_candle_arr = get_candles( 2024-11-13 10:57:31 ^^^^^^^^^^^^ 2024-11-13 10:57:31 File "/jesse-docker/jesse/services/candle.py", line 226, in get_candles 2024-11-13 10:57:31 warmup_candles = _get_candles_from_db(exchange, symbol, warmup_start_timestamp, warmup_finish_timestamp, 2024-11-13 10:57:31 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-11-13 10:57:31 File "/jesse-docker/jesse/services/candle.py", line 259, in _get_candles_from_db 2024-11-13 10:57:31 cached_value = cache.get_value(cache_key) 2024-11-13 10:57:31 ^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-11-13 10:57:31 File "/jesse-docker/jesse/services/cache.py", line 71, in get_value 2024-11-13 10:57:31 with open(item['path'], 'rb') as f: 2024-11-13 10:57:31 ^^^^^^^^^^^^^^^^^^^^^^^^ 2024-11-13 10:57:31 FileNotFoundError: [Errno 2] No such file or directory: 'storage/temp/1706682600000-1706745540000-Bybit USDT Perpetual-BTC-USDT.pickle'

saleh-mir commented 5 days ago

Hi,

Regarding the second issue, try removing any files inside the /storage/temp directory.

As for the first issue, I have to address it later. At the moment, I need to add more validation to throw better errors. However, to fix it on your side, I'm guessing the values are NaN at that point in time, which is pretty expected with indicators such as T3. You need to increase your warmup candles number to resolve this.

UmitOzdemir commented 5 days ago

Thank you for addressing the issues so quickly. On my side everything works as expected now. I will close the ticket.