Rui Heng Foo (rfoo1250) and Michael Liu (restics)
This project is a comprehensive stock market analysis tool developed for CSE 472: Social Media Mining. The Python program mines social media platforms for posts related to a specific stock, performs sentiment analysis on the collected data, and generates a daily sentiment score ranging from -100 to 100.
This sentiment score is then used to generate trading signals—buy, sell, or hold—based on user-defined thresholds. The system includes a robust backtesting feature that simulates the trading strategy against the last 10 years of historical stock data, allowing for evaluation of the strategy's effectiveness through key performance metrics and visualizations.
OS env for Michael
- Windows 11
- Python 3.12
- pip 24.3.1
OS env for Foo
- Windows 10 / Powershell Major 5 Minor 1 Build 19041 Revision 5129
- Python 3.12.5
- pip 24.3.1
Prerequisites: current path of the directory is ...\472proj2
- Enter
pip install -r requirements.txtto the command line of your terminal to install necessary python packages via pip. - Run both
python Alpha_Vantage_stocks_crawler.pyandpython prawscraper.pyin part1\ - Run
python sentiment_analysis.pyin part2\ - Run only
python processdatasets.pyin part3\ - Run
python backtesting_program.pyin part4\
Further instructions and details are listed in the report.
| README.md
| requirements.txt
|
+---.idea
| | .gitignore
| | 472proj2.iml
| | csv-editor.xml
| | discord.xml
| | misc.xml
| | modules.xml
| | vcs.xml
| |
| \---inspectionProfiles
| profiles_settings.xml
|
+---part1
| | .env
| | Alpha_Vantage_stocks_crawler.py
| | Alpha_Vantage_stocks_crawler.py.bak
| | decade_daily_NVDA_prices.csv
| | prawscraper.py
| | year_daily_NVDA_prices.csv
| |
| \---out
| rdaytrading_nvda.csv
| rinvesting_NVDA.csv
| rstocks_NVDA.csv
| rwallstreetbets_NVDA.csv
|
+---part2
| | sentiment_analysis.py
| | sentiment_analysis.py.bak
| |
| \---out
| combined_sentiment_results.csv
| daily_sentiment_score.csv
|
+---part3
| | .env
| | brokerbot.py
| | brokerbot.py.bak
| | processdatasets.py
| | processdatasets.py.bak
| |
| +---out
| | combined_sentiment_results.csv
| |
| \---__pycache__
| brokerbot.cpython-312.pyc
|
+---part4
| backtesting_program.py
| backtesting_program.py.bak
| brokerbot.py