Eventually we will want to move this code into this library do add onto the stock data frame used to train the models. (Similar to how the add_EMA and add_SMA functions work).
Steps:
Create a new branch SupportandResistance
Within forecast team 3, create a function:
add_resistance_and_support(data)
This function can be in it's own python file if you would like. When you're done we'll move it to the PythonDataProcessing repo.
Use get_stock_data to get a data frame with stock data. You can use print(data) to see the format. It's basically a table.
Follow the steps in the tutorial link above to get lines. Feel free to brainstorm improvements too.
Within the function you will probably need to create a new column in the data frame for all the support / resistance new values. I'm not sure the best way to do this. Idk if a set number of columns is best or if we should have it dynamically add columns? One idea is to have SupportClose and ResistanceClose columns then have a Support Far and ResistanceFar column. Either way, the rows for each of these columns correspond to a date. You can put the y value of any support line here. So that each date has corresponding support/resistance lines.
Add this column to that stock data frame. See sma and ema.
Little Background:
Calculate the resistance / support lines for a stock.
Probably need to google what those lines are.
This looks like a good guide to get those lines: https://towardsdatascience.com/detection-of-price-support-and-resistance-levels-in-python-baedc44c34c9
We have a library designed to get data like that: https://github.com/Deep-Stonks-Group/PythonDataProcessing/blob/main/PythonDataProcessing/DataRetrieval.py
Eventually we will want to move this code into this library do add onto the stock data frame used to train the models. (Similar to how the add_EMA and add_SMA functions work).
Steps:
Create a new branch
SupportandResistance
Within forecast team 3, create a function:
add_resistance_and_support(data)
This function can be in it's own python file if you would like. When you're done we'll move it to the PythonDataProcessing repo.Use get_stock_data to get a data frame with stock data. You can use print(data) to see the format. It's basically a table.
Follow the steps in the tutorial link above to get lines. Feel free to brainstorm improvements too.
Within the function you will probably need to create a new column in the data frame for all the support / resistance new values. I'm not sure the best way to do this. Idk if a set number of columns is best or if we should have it dynamically add columns? One idea is to have SupportClose and ResistanceClose columns then have a Support Far and ResistanceFar column. Either way, the rows for each of these columns correspond to a date. You can put the y value of any support line here. So that each date has corresponding support/resistance lines.
Add this column to that stock data frame. See sma and ema.