eshan6704 commited on
Commit
d2218a1
·
verified ·
1 Parent(s): f0e5be0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py CHANGED
@@ -11,7 +11,27 @@ from nsepython import *
11
  from yahooinfo import fetch_info
12
  from build_nse_fno import nse_fno_html
13
  import datetime
 
 
 
 
 
 
 
 
14
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
  # ======================================================
17
  # Request Type Options
 
11
  from yahooinfo import fetch_info
12
  from build_nse_fno import nse_fno_html
13
  import datetime
14
+ # ======================================================
15
+ # Date helpers
16
+ # ======================================================
17
+ def today_str():
18
+ return datetime.date.today().strftime("%d-%m-%Y")
19
+
20
+ def yesterday_str():
21
+ return (datetime.date.today() - datetime.timedelta(days=1)).strftime("%d-%m-%Y")
22
 
23
+ def last_year_date(d):
24
+ dt = datetime.datetime.strptime(d, "%d-%m-%Y")
25
+ new_dt = dt.replace(year=dt.year - 1)
26
+ return new_dt.strftime("%d-%m-%Y")
27
+
28
+ # ======================================================
29
+ # HTML wrapper
30
+ # ======================================================
31
+ def wrap(html):
32
+ if html is None:
33
+ return "<h3>No Data</h3>"
34
+ return SCROLL_WRAP.replace("{{HTML}}", html)
35
 
36
  # ======================================================
37
  # Request Type Options