-
Notifications
You must be signed in to change notification settings - Fork 11
/
app.py
66 lines (48 loc) · 2.18 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
from flask import *
import predict
from glo_variable import PAST, FUTURE, DATA_PATH, STD_PATH, TARGET_OPEN, TARGET_HIGH, TARGET_LOW, TARGET_CLOSE
# Initialising flask
app = Flask(__name__)
# Defining the route for the main() funtion
@app.route("/", methods=["POST", "GET"])
def main():
open_past, open_future = predict.predict(TARGET_OPEN, PAST, FUTURE, STD_PATH, DATA_PATH)
high_past, high_future = predict.predict(TARGET_HIGH, PAST, FUTURE, STD_PATH, DATA_PATH)
low_past, low_future = predict.predict(TARGET_LOW, PAST, FUTURE, STD_PATH, DATA_PATH)
close_past, close_future = predict.predict(TARGET_CLOSE, PAST, FUTURE, STD_PATH, DATA_PATH)
dates = predict.getDate(DATA_PATH, PAST, FUTURE)
open_past = open_past.tolist()
open_past = open_past + [None] * FUTURE
open_future = open_future.tolist()
open_future = [None] * (PAST-1) + [open_past[PAST-1]] + open_future
high_past = high_past.tolist()
high_past = high_past + [None] * FUTURE
high_future = high_future.tolist()
high_future = [None] * (PAST-1) + [high_past[PAST-1]] + high_future
low_past = low_past.tolist()
low_past = low_past + [None] * FUTURE
low_future = low_future.tolist()
low_future = [None] * (PAST-1) + [low_past[PAST-1]] + low_future
close_past = close_past.tolist()
close_past = close_past + [None] * FUTURE
close_future = close_future.tolist()
close_future = [None] * (PAST-1) + [close_past[PAST-1]] + close_future
# print("past >>>>> ", past, "future >>>>> ", future)
temp = 0
# data = {'past': [1,5,7,2,5,6,9,2,1,10]}
data = {
'open_past': open_past, 'open_future': open_future,
'high_past': high_past, 'high_future': high_future,
'low_past': low_past, 'low_future': low_future,
'close_past': close_past, 'close_future': close_future,
'dates': dates
}
# print(type(past))
# print(type([1,2,3]))
if (request.method == 'POST'):
temp = 10
data = {'temp': temp}
return render_template("home.html", data = data) #rendering our home.html contained within /templates
if __name__ == "__main__":
# Running flask
app.run(debug = True, port = 4446)