hackingthemarkets/ttm-squeeze

Issue running squeeze.py

Opened this issue · 5 comments

I haven't coded in ages. My coding knowledge is from way back in Qbasic, VBasic, C and C++ Days.

I am getting these error messages when I run squeeze.py.
Any clue why?

& python c:/Users/Rich/Desktop/Investments/ttm-squeeze-master/ttm-squeeze-master/squeeze.py
Traceback (most recent call last):
File "c:\Users\Rich\Desktop\Investments\ttm-squeeze-master\ttm-squeeze-master\squeeze.py", line 30, in
if df.iloc[-3]['squeeze_on'] and not df.iloc[-1]['squeeze_on']:
File "C:\Users\Rich\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pandas\core\indexing.py", line 895, in getitem
return self._getitem_axis(maybe_callable, axis=axis)
File "C:\Users\Rich\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pandas\core\indexing.py", line 1501, in _getitem_axis
self._validate_integer(key, axis)
File "C:\Users\Rich\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pandas\core\indexing.py", line 1444, in _validate_integer
raise IndexError("single positional indexer is out-of-bounds")
IndexError: single positional indexer is out-of-bounds

I went back an went through the datasets. There were some stocks that had a low volume.

I deleted them.
This drastically reduced the number of errors I have.

Now I just have this:

Traceback (most recent call last):
File "c:\Users\Rich\Desktop\Investments\ttm-squeeze-master\ttm-squeeze-master\squeeze.py", line 51, in
df = dataframes['ACZ.TO']
KeyError: 'ACZ.TO'

Ok... Update.

I want back, started from scratch. Had some issues with my first run. I could have had the folder selected wrong.
I corrected the folder by moving my files to the proper path. For some reason Winrar was added an additional path to the one I gave it.

I then used "code ."

I cut the original dataset down so I could test it properly. I got it to run no problem and it showed googl chart.

I then changed the date to make sure it wasn't a date issue. reran it. I got new squeezes. And also tried a different stock to print.
It worked perfectly, to my knowledge. lol

Now, I am going to see if I can get it to work with my other list. I think the problem may be arising when it is using extra characters in the stock. Canadian stocks list some stocks with the ".to" or ".v" added to them

Yes... I narrowed it down to being an issue loading stocks with the "." in the name.

Any help?

If I change it like this it works

df = dataframes['ACZ']

... New issue.

If I have datasets with less than 2 rows of data I get errors. (this is not including the row of names)

I figured out how to deal with stocks that have too low of volume of information.
If there isn't 3 rows of data the program will error out.
To get around this you need it like this:

size=len(df)
# print(size)
if size <= 2:
    continue


if df.iloc[-3]['squeeze_on'] and not df.iloc[-1]['squeeze_on']:
    print("{} is coming out the squeeze".format(symbol))