-
Notifications
You must be signed in to change notification settings - Fork 0
/
GUI.py
33 lines (24 loc) · 865 Bytes
/
GUI.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
from flask import Flask, render_template, request
import Main
import KPI
import json
app = Flask(__name__)
# GUI.py成功執行,在瀏覽器輸入http://127.0.0.1:5000/ ,即可看到介面
# 也可直接輸入 http://34.125.202.159/ 進行操作
@app.route("/")
def index():
return render_template("index.html")
@app.route("/api/get_data", methods=['POST'])
def get_data():
stock = request.values['stock']
KbarsMinutes = int(request.values['KbarsMinutes'])
KbarsNewHigh = int(request.values['KbarsNewHigh'])
StopLoss = float(request.values['StopLoss'])
Main.run(stock, KbarsMinutes, KbarsNewHigh, StopLoss)
response = app.response_class(
response=json.dumps(KPI.run()),
mimetype='application/json'
)
return response
if __name__ == "__main__":
app.run(debug=True)