nickpagz / adx-bot

8 stars 21 forks source link

KeyError: EMA_20 / Value not in range 78 #3

Open gzmnc opened 2 years ago

gzmnc commented 2 years ago

Many thanks Nick for the great work, unfortunately I encountered some issues:

The script worked fine for a couple days but suddenly stopped and got this error:

Traceback (most recent call last): File “C:\Users\XXX\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pandas\core\indexes\base.py”, line 3621, in get_loc return self._engine.get_loc(casted_key) File “pandas_libs\index.pyx”, line 136, in pandas._libs.index.IndexEngine.get_loc File “pandas_libs\index.pyx”, line 163, in pandas._libs.index.IndexEngine.get_loc File “pandas_libs\hashtable_class_helper.pxi”, line 5198, in pandas._libs.hashtable.PyObjectHashTable.get_item File “pandas_libs\hashtable_class_helper.pxi”, line 5206, in pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: ‘EMA_20’

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File “C:\Users\XXX\adx_bot.py”, line 330, in unfiltered_stats = perp_stats(perp) File “C:\Users\XXX\adx_bot.py”, line 247, in perp_stats df[‘EMASLOPE’] = df[‘EMA’+str(emalength)].diff().abs() / df[‘EMA’+str(ema_length)] File “C:\Users\XXX\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pandas\core\frame.py”, line 3506, in getitem indexer = self.columns.get_loc(key) File “C:\Users\XXX\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pandas\core\indexes\base.py”, line 3623, in get_loc raise KeyError(key) from err KeyError: ‘EMA_20’

Could this be a problem on the FTX side? Not able to get the perp stats..?

Also tried the other branch with the HTF validation and that gets a similar error with Value not in range 78

gzmnc commented 2 years ago

I set up the VM instance with the HTF validation branch and still get this error:

Getting perps OHLCV data... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Traceback (most recent call last): File "/home/01/.local/lib/python3.9/site-packages/pandas/core/indexes/range.py", line 385, in get_loc return self._range.index(new_key) ValueError: 78 is not in range

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/01/adxbot/adx_bot.py", line 358, in unfiltered_stats, trend_direction = perp_stats(perp) File "/home/01/adxbot/adx_bot.py", line 273, in perp_stats emafast = df2.loc[(df.shape[0]-2), 'EMA'+str(htf_fast_ema)] File "/home/01/.local/lib/python3.9/site-packages/pandas/core/indexing.py", line 960, in getitem return self.obj._get_value(*key, takeable=self._takeable) File "/home/01/.local/lib/python3.9/site-packages/pandas/core/frame.py", line 3622, in _get_value row = self.index.get_loc(index) File "/home/01/.local/lib/python3.9/site-packages/pandas/core/indexes/range.py", line 387, in get_loc raise KeyError(key) from err KeyError: 78

gzmnc commented 2 years ago

Ok I noticed that the bot works when I the timeframe to 15, with 60 I receive this error. Unfortunately the performance of the bot was better for me with 60 (when it worked).