AmirTrader commited on
Commit
08fda2d
·
verified ·
1 Parent(s): 6445a61

Update src/app.py

Browse files
Files changed (1) hide show
  1. src/app.py +9 -2
src/app.py CHANGED
@@ -102,6 +102,13 @@ def get_last_friday():
102
  last_friday = today - timedelta(days = (today.weekday() - calendar.FRIDAY) % 7, weeks=(today.weekday() == calendar.FRIDAY))
103
  return last_friday
104
 
 
 
 
 
 
 
 
105
 
106
  ticker = pn.widgets.AutocompleteInput(name='Ticker', options=['NVDA','TSLA', 'AMZN' , 'MSFT' , 'AAPL' , 'GOOG' , 'AMD' ,'META' ,'AVGO','JPM','LLY','NVO','TSM','V', 'ASML','SMCI','CVX','JNJ','HD','COST','MRK'] , placeholder='Write Ticker here همین جا',value='ALL', restrict=False)
107
  ticker.value = "NVDA"
@@ -111,7 +118,7 @@ exp_date = pn.widgets.DatePicker(
111
  description='Select a Date',
112
  start= date.today() - timedelta(days=365 * 2)
113
  )
114
- exp_date.value = get_last_friday() #date.today() - timedelta(days= 2)
115
 
116
  startdate = pn.widgets.DatePicker(
117
  name ="Start Date",
@@ -126,7 +133,7 @@ enddate = pn.widgets.DatePicker(
126
  description='Select a Date',
127
  start= date.today() - timedelta(days=365 * 2)
128
  )
129
- enddate.value = get_last_friday()
130
 
131
  option_type = pn.widgets.Select(name='Option Type', options=['C', 'P'])
132
  option_type.value = 'C'
 
102
  last_friday = today - timedelta(days = (today.weekday() - calendar.FRIDAY) % 7, weeks=(today.weekday() == calendar.FRIDAY))
103
  return last_friday
104
 
105
+ def get_next_friday():
106
+ today = date.today()
107
+ # Calculate days until next Friday
108
+ days_until_next_friday = (calendar.FRIDAY - today.weekday() + 7) % 7
109
+ next_friday = today + timedelta(days=days_until_next_friday)
110
+ return next_friday
111
+
112
 
113
  ticker = pn.widgets.AutocompleteInput(name='Ticker', options=['NVDA','TSLA', 'AMZN' , 'MSFT' , 'AAPL' , 'GOOG' , 'AMD' ,'META' ,'AVGO','JPM','LLY','NVO','TSM','V', 'ASML','SMCI','CVX','JNJ','HD','COST','MRK'] , placeholder='Write Ticker here همین جا',value='ALL', restrict=False)
114
  ticker.value = "NVDA"
 
118
  description='Select a Date',
119
  start= date.today() - timedelta(days=365 * 2)
120
  )
121
+ exp_date.value = get_next_friday() #date.today() - timedelta(days= 2)
122
 
123
  startdate = pn.widgets.DatePicker(
124
  name ="Start Date",
 
133
  description='Select a Date',
134
  start= date.today() - timedelta(days=365 * 2)
135
  )
136
+ enddate.value = get_next_friday()
137
 
138
  option_type = pn.widgets.Select(name='Option Type', options=['C', 'P'])
139
  option_type.value = 'C'