Skip to content

Commit 53f7315

Browse files
committed
add button to update data
1 parent 4c1f1ab commit 53f7315

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

app.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,11 @@ def realtimesnapshot():
6868

6969
@app.route('/snapshot')
7070
def snapshot():
71-
71+
today = date.today()
7272
for stock in nifty_list:
7373
symbol = stock[0]
74+
7475
days = date.today() - timedelta(5)
7576
df = get_history(symbol=symbol,start= days,end=date.today())
7677
df.to_csv(f"datasets/{symbol}.csv")
77-
return {}
78+
return f'updated data for {today.strftime("%B %d, %Y")}'

templates/index.html

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
</head>
1010
<body>
1111
<h1>CandleStick Scanner</h1>
12+
<button type="button" onclick="window.location.href='{{ url_for( 'snapshot') }}';">Update data</button>
13+
1214
<form>
1315
<select name="pattern">
1416
{% for pattern in patterns %}

0 commit comments

Comments
 (0)