kaito1410 / autodd_rev2 Goto Github PK
View Code? Open in Web Editor NEWAn improved version of the original AutoDD
License: GNU General Public License v3.0
An improved version of the original AutoDD
License: GNU General Public License v3.0
It looks like in the latest code the definition of key_stats_measures dict disappeared which is causing an error when running. I added it back in at lines 64/65 and everything worked as it should.
I am not sure what happened. The program was working perfectly until I tried to use it today. Now it just returns nothing. I attempted a new install and it still reproduced the same result. There are no error logs so it's a little difficult to isolate the problem.
Has Reddit changed something on their end?
Just wanted to let you know that PSAW has been unresponsive for around 2 days.
Hi, I have a mac, everything is working until I run_auto_dd. sh and get this error:
from psaw import PushshiftAPI
ImportError: No module named psaw
I did isntall all requirements multiple times and have python 3.
thank you!
Hi,
found this exception by running script today(13:00 CET, 2020/1/26 on Win10).
Getting submissions...
Searching for tickers...
Populating results...
Counting rockets...
Getting quick stats...
Traceback (most recent call last):
File "main.py", line 101, in <module>
main()
File "main.py", line 92, in main
results_tbl = getQuickStats(results_tbl)
File "C:\Users\Rado\Desktop\AutoDD\AutoDD_Rev2-main\AutoDD.py", line 489, in getQuickStats
change_50day = ((float(price) - float(avg50day))/float(avg50day))*100
ZeroDivisionError: float division by zero
My temporal "fix" was:
if price is not None and price != 0:
if avg50day > 0:
change_50day = ((float(price) - float(avg50day))/float(avg50day))*100
else:
change_50day = 0
on line 489 in AutoDD.py
I just tried the code, it's awesome!
Although I just tried to run this command:
main.py --interval 2 --sub wallstreetbets
And got this error output:
Traceback (most recent call last):
File "C:\Users\guillaume\PycharmProjects\AutoDD_Rev2\main.py", line 101, in <module>
main()
File "C:\Users\guillaume\PycharmProjects\AutoDD_Rev2\main.py", line 92, in main
results_tbl = getQuickStats(results_tbl)
File "C:\Users\guillaume\PycharmProjects\AutoDD_Rev2\AutoDD.py", line 491, in getQuickStats
if avg50day > 0:
TypeError: '>' not supported between instances of 'NoneType' and 'int'
After some debugging I was able to narrow it down to the ticker "WIN" for which yahoo does not return 'fiftyDayAverage'. I wrote a little standalone to isolate the error:
from yahooquery import Ticker
ticker=Ticker('WIN')
data=ticker.summary_detail.get('WIN')
if data.get('fiftyDayAverage') is None:
print("Houston...")
I doubt "WIN" was meant as a stock ticker in the reddit submission, but regardless, it is a valid ticker, so this error should not occur?
In the meantime I added "WIN" to the list of banned words locally. Works as a temp fix.
I just went through your code, I love it and will try my hand at using it tomorrow.
I just found what seems to be an undercounting of tickers:
# title_extracted is a set, duplicate tickers from the same title counted once only
for k in title_extracted:
if k in all_dict:
all_dict[k] += increment
else:
all_dict[k] = increment
# avoid counting additional point for the tickers found in the text body
# only search the text body if ticker was not found in the title
if len(title_extracted) > 0:
continue
for m in selftext_extracted:
if m in all_dict:
all_dict[m] += increment
else:
all_dict[m] = increment
Doesn't the above miss out on instances when a ticker appears in the selftext but not in the title? (eg say the title contains AAPL and the selftext contains MSFT, it would skip MSFT).
Since rocket_tickers
is already a set, shouldn't the above be replaced by the following?
for k in rocket_tickers:
if k in all_dict:
all_dict[k] += increment
else:
all_dict[k] = increment
Thanks again for sharing this code.
Me again :)
I just got this error:
Traceback (most recent call last):
File "C:\Users\guillaume\PycharmProjects\AutoDD_Rev2\main.py", line 101, in <module>
main()
File "C:\Users\guillaume\PycharmProjects\AutoDD_Rev2\main.py", line 65, in main
prev_tbl, prev_rockets = get_freq_list(results_from_api[1])
File "C:\Users\guillaume\PycharmProjects\AutoDD_Rev2\AutoDD.py", line 171, in get_freq_list
rocket_tickers = selftext_extracted.union(title_extracted)
UnboundLocalError: local variable 'selftext_extracted' referenced before assignment
I assume this happens when there is no selftext. Easy fix is to add the line pointed to below
# search the text body for the ticker/tickers
selftext_extracted = set() # <------------- INSERT
if hasattr(i, 'selftext'):
selftext = ' ' + i.selftext + ' '
selftext_extracted = set(re.findall(pattern, selftext))
Hey there,
I'm getting the following error trying to run the main.py on both Ubuntu and macOS.
Traceback (most recent call last):
File "main.py", line 101, in <module>
main()
File "main.py", line 98, in main
print_tbl(results_tbl, args.filename, args.allsub, args.yahoo, args.csv)
File "/app/auto-dd/AutoDD.py", line 378, in print_tbl
writer.writerow(row)
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 87: ordinal not in range(128)
Do you have any idea on what I can do to get it running? It seems to have trouble printing the table after gathering the data. I can get it running on Windows though.
Thanks in advance!
Am I right that or row[1][1] >= min_val
is redundant in the code below?
tbl = [row for row in tbl if row[1][0] >= min_val or row[1][1] >= min_val]
If I'm not mistaken row[1][0]
is the total score (prev + current) for the ticker, and row[1][1]
is the current score.
I'm removing the redundant part in my version of the code, just making sure I haven't misunderstood something?
Hello,
rockets seem to be counted in an odd way. Let's take an example. Suppose a reddit submission has the following title:
"PLEASE BUY AAPL, MSFT, GME NOW"
then for that submission you would have
rocket_dict['PLEASE'] += 6
rocket_dict['BUY'] += 6
rocket_dict['AAPL'] += 6
rocket_dict['MSFT'] += 6
rocket_dict['GME'] += 6
rocket_dict['NOW'] += 6
Shouldn't it be +=1
for each one?
Could you please clarify what rockets count?
PS. I should have finished the refactored code by Monday or so if you're interested. Speedup is in the order of 100x when there are many tickers.
On first time running, recieve the following:
C:\Users*\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\psaw\PushshiftAPI.py:192: UserWarning: Got non 200 code 429
warnings.warn("Got non 200 code %s" % response.status_code)
C:\Users\Shokkatweej\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\psaw\PushshiftAPI.py:180: UserWarning: Unable to connect to pushshift.io. Retrying after backoff.
warnings.warn("Unable to connect to pushshift.io. Retrying after backoff.")
And then stalls at 'Getting quick stats...'
Hi there,
First of all thank you for your excellent work.
Running main.py with wallstreetbets sub option is incredibly slow. My thought is that because of the huge dataset, but processing one entry a second is not ideal.
Thank you frou your app.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.