Skip to content

mccarthurmay/Stock_Tracker

Repository files navigation

Hello, this is a WIP.

main.py - Recommended, newest working version

IMPORTANT!!!
Main.py is not currently updated to support automatic paper trading. Run "run.py" to start the automated process. However, this is WIP and will likely cause a net loss. 

"Run" function in main.py is for manual trading. 
 - 1. Finds and displays stocks sorted by predicted % gain. Prints { (percent gain), (stock ticker), (rsi), (percent of times sold for a positive value) }
 - 2. Input a ticker and a full report will be presented. This includes stop loss, stop limit, estimated gain, and estimated turnover time. 

Within "commands", "run (old)" is the original purpose of this application. 

rsi_analysis.py analyzes % gain of stocks over the next year based on RSI ranges. 
- lines 134 and 136
   - line 134 is where you can set it to run on specific stocks (eg. comment out 133 + 134, add a line that says "stock_list = ['GM']"
   - line 136 is where you can set your desired RSI range

min_rsi.py is similar to rsi_analysis.py, except it was configured to run with day_trade.py / paper.py
- lines 140, 150 



Requirements:
yfinance, pandas, matplotlib, numpy, selenium, pyinstaller, tk




*must begin all databases containing tickers with "t_", "tickers_", or "ticker_" to be properly updated
*must begin all portfolios with "p_" or "portfolio_" to be properly updated

15.

Todo:
4. ML that reads minute by minute data to predict the next half an hour                                                                                            

6. Redo ml.py to predict if a stock is likely to reach 70rsi
    - currently working, low accuracy at more than "likelihood to reach before 10 days"
        - higher accuracy the lower the days

11. Create a website to host instead of GUI - use django, learn off coursera

14. Test multiple strategies, optimize income
    - increase number of datapoints
    - adjust ranking system (instead of % gain, winrate?)
    - adjust moving averages
    - buy stock categories; do an analysis on all categories 
        - choose category with highest open

15. Optimize optimize optimize
    - scanning for stocks is incredibly slow
        - likely api's fault, but will have to test if it's the massive calculations
    - many overlaps with yfinance now that an api is working

16. Will likely have to switch to a different trading api.


Done:
1. absolute low project 
    - find how much holders fluctuate 
    - use 10 rsi, 15 rsi, 20 rsi, and 30 rsi as buy signals
    - collect all necessary information at purchase date
        - date, volume, rsi, moving average (maybe a ratio)
    - gives information on how to set limits
    
3. rework portfolio system
    - buy price is being overwritten
    - (7/11 prices on test)
    - show gain  

7. complete a day trading module
    - integrates absolute low project adjusted for minute by minute data
    - provides stop loss and sell signals
    - finds best stocks to purchase for any given day

8. completely rework/organize code

3. various bugs in main with code rework

12. Fix bug that doesn't allow for paper.py to run permanently

9. Add automatic trading (paper for now) using Alpaca

10. Separate modules in main.py (day trade and old experiment) for user choice

13. MORE DATA - can't accurately "predict" anything if I only have 30 points of data. alpha vantage?
            - using tiingo

Bugs:
1. main.py two windows when clicking "load"
2. paper.py runs through all ma calculations regardless of position number on first start



Notes:
1. winrate project
    - shows that 'most' stocks do not gain any more once above 70 rsi
    - bought stocks showing 'bull' and 'MA Converging: False' or 'bear' and 'MA Converging: True' are very promising to be gainers
    - absolute minimum may 'peak' at under 20 rsi
2. shortrate project
    - still waiting on rsi values to go under
3. absolute low project
    - recorded all information, found that the most optimal RSI is 45-50 (specifically 45-47.5)
    - HOWEVER, found a flaw in my logic
        - It only reads perfect situations, where rsi = 45 turning into rsi = 70 is guaranteed.
        - NEED TO KNOW WHEN THIS OCCURS


Depreciated Ideas:

5. Probability to gain in month? (test.py, p_test2.pk)

2. winrate project
    - find signals on why DDOG and ADBE kept rising above 70 rsi



    *** MOVE TO NOTES

    day 7: 
    figured that MA doesn't work until a certain time

    adding trailing stop

    maybe short before certain time? neeed to maximize time