Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: EMA_20 / Value not in range 78 #3

Open
gzmnc opened this issue Apr 4, 2022 · 2 comments
Open

KeyError: EMA_20 / Value not in range 78 #3

gzmnc opened this issue Apr 4, 2022 · 2 comments

Comments

@gzmnc
Copy link

gzmnc commented Apr 4, 2022

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[‘EMA_SLOPE’] = df[‘EMA_’+str(ema_length)].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
Copy link
Author

gzmnc commented Apr 4, 2022

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
ema_fast = 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
Copy link
Author

gzmnc commented Apr 6, 2022

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant