Python codes related to stock trading
- Retrieves intraday stock price for past 7 days (regular hours 9AM-4PM) and plots the closing price
- Note: Possible time intervals: "1min", "5min", "15min", "30min", "60min"
- Note: Possible outputsizes: "compact", "full" -- compact returns only the latest 100 data points in the intraday time series
- save_sp500_tickers() - Retrieves list of SP500 companies from wikipedia using BeautifulSoup module and writes to pickle module
- get_data_from_yahoo(reload_sp500=False) - Retrieves data from pickle and downloads interday data from Yahoo Finance -> saves as CSV in folder named 'stock_dfs'
- compile_data() - Creates excel sheet with all the tickers adjusted closing prices from dates downloaded
- visualize_data() - Creates a heat map that correlates all the tickers to one another to see how each company moves in relation to each other
- Retrieves interday data for specific ticker from Yahoo Finance
- Creates 100MA based on adjusted close and converts data to Open, high, low, close (OHLC) format
- Plots data with volume subplot
- process_data_for_labels(ticker) - Pulls csv created in "SP500_correlation_heatmap.py" and calculates the percent change day to day for each stock
- buy_sell_hold(*args) - returns a boolean to determine if stock has moved at least 2% within the last day
- extract_featuresets(ticker) - Returns a normalized feature set of stocks as well as the buy/hold/sell classifications
- do_ml(ticker) - Uses a voting classifier to vote for best course of action and back tests against 25% of sample data. Here, classifiers used are: Linear support vector classifier, k-nearest neighbours, random forest classifier. Prints accuracy as well as predicted spread.