This repository has been archived by the owner on Nov 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
/
titan_app.py
65 lines (48 loc) · 1.58 KB
/
titan_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
from flask import Flask, render_template
from flask import request
from flask_debugtoolbar import DebugToolbarExtension
from core import titan_main
import logging
app = Flask(__name__)
titan_main.start_database()
app.debug = True
app.config['SECRET_KEY'] = '100'
toolbar = DebugToolbarExtension(app)
logger = logging.getLogger(__name__)
@app.route("/")
def mainpage():
return render_template('main.html')
@app.route("/strategy", methods=['POST'])
def strategy():
user_exchange = request.form['exchange']
user_basecurrency = request.form['basecurrency']
user_quotecurrency = request.form['quotecurrency']
user_candleinterval = request.form['candleinterval']
user_sma = request.form['sma']
user_fma = request.form['fma']
user_balance = request.form['balance']
if 'forward_simulation' in request.form:
user_input = [
user_exchange.lower(),
user_basecurrency.upper(),
user_quotecurrency.upper(),
user_candleinterval,
True,
int(user_sma),
int(user_fma),
int(user_balance)]
titan_main.start_strategy(user_input)
return render_template('results.html')
elif 'forward_live' in request.form:
return render_template('results_live.html')
@app.route("/contact")
def contactpage():
return render_template('main.html')
@app.route("/about")
def aboutpage():
return render_template('main.html')
@app.route("/github")
def githubpage():
return render_template('main.html')
if __name__ == "__main__":
app.run(host="0.0.0.0", port=5555)