Spaces:
Running
Running
Commit
·
39d5cfb
1
Parent(s):
7237f65
Update app.py
Browse files
app.py
CHANGED
|
@@ -20,7 +20,7 @@ def get_df(ticker, startdate , enddate , interval="1d",window=50,window2=150):
|
|
| 20 |
DF = DF.reset_index()
|
| 21 |
return DF
|
| 22 |
|
| 23 |
-
def get_hvplot(ticker , startdate , enddate , interval,window):
|
| 24 |
DF = get_df(ticker , startdate=startdate , enddate=enddate , interval=interval,window=window)
|
| 25 |
|
| 26 |
import hvplot.pandas # Ensure hvplot is installed (pip install hvplot)
|
|
@@ -45,6 +45,7 @@ def get_hvplot(ticker , startdate , enddate , interval,window):
|
|
| 45 |
# # Step 4: Create a line plot for linear regression
|
| 46 |
line_plot = DF.hvplot(x='Date', y='Predicted_Close', kind='line',line_dash='dashed', color='red')
|
| 47 |
line_plot_SMA = DF.hvplot(x='Date', y='SMA', kind='line',line_dash='dashed', color='orange')
|
|
|
|
| 48 |
|
| 49 |
# # Step 5: Overlay scatter plot and linear regression line
|
| 50 |
# return (scatter_plot * line_plot).opts(width=800, height=600, show_grid=True, gridstyle={ 'grid_line_color': 'gray'})
|
|
@@ -190,7 +191,7 @@ tickers = pd.read_csv('tickers.csv').Ticker.to_list()
|
|
| 190 |
ticker = pn.widgets.AutocompleteInput(name='Ticker', options=tickers , placeholder='Write Ticker here همین جا')
|
| 191 |
ticker.value = "AAPL"
|
| 192 |
window = pn.widgets.IntSlider(name='Window Size', value=50, start=5, end=1000, step=5)
|
| 193 |
-
window2 = pn.widgets.IntSlider(name='Window
|
| 194 |
|
| 195 |
# Create a DatePicker widget with a minimum date of 2000-01-01
|
| 196 |
date_start = pn.widgets.DatePicker(
|
|
|
|
| 20 |
DF = DF.reset_index()
|
| 21 |
return DF
|
| 22 |
|
| 23 |
+
def get_hvplot(ticker , startdate , enddate , interval,window,window2):
|
| 24 |
DF = get_df(ticker , startdate=startdate , enddate=enddate , interval=interval,window=window)
|
| 25 |
|
| 26 |
import hvplot.pandas # Ensure hvplot is installed (pip install hvplot)
|
|
|
|
| 45 |
# # Step 4: Create a line plot for linear regression
|
| 46 |
line_plot = DF.hvplot(x='Date', y='Predicted_Close', kind='line',line_dash='dashed', color='red')
|
| 47 |
line_plot_SMA = DF.hvplot(x='Date', y='SMA', kind='line',line_dash='dashed', color='orange')
|
| 48 |
+
line_plot_SMA2 = DF.hvplot(x='Date', y='SMA2', kind='line',line_dash='dashed', color='orange')
|
| 49 |
|
| 50 |
# # Step 5: Overlay scatter plot and linear regression line
|
| 51 |
# return (scatter_plot * line_plot).opts(width=800, height=600, show_grid=True, gridstyle={ 'grid_line_color': 'gray'})
|
|
|
|
| 191 |
ticker = pn.widgets.AutocompleteInput(name='Ticker', options=tickers , placeholder='Write Ticker here همین جا')
|
| 192 |
ticker.value = "AAPL"
|
| 193 |
window = pn.widgets.IntSlider(name='Window Size', value=50, start=5, end=1000, step=5)
|
| 194 |
+
window2 = pn.widgets.IntSlider(name='Window Size2', value=150, start=5, end=1000, step=5)
|
| 195 |
|
| 196 |
# Create a DatePicker widget with a minimum date of 2000-01-01
|
| 197 |
date_start = pn.widgets.DatePicker(
|