-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
26 lines (21 loc) · 706 Bytes
/
app.py
File metadata and controls
26 lines (21 loc) · 706 Bytes
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
from flask import request, jsonify, render_template
import os
import flask
import waitress
from main import getActions, getGainers
app = flask.Flask(__name__)
#app.config["DEBUG"] = True
# Route to The API Page
@app.route('/', methods=['GET'])
def home():
return '''<h1>Simple Moving Averages Trading API</h1><hr>
<p>You will receive json data of top yahoo stocks to trade, and whether you should buy
or sell them according to SMA Algorithm</p>'''
@app.route('/api/', methods=['GET'])
def api_all():
return jsonify(getActions(stocks=getGainers()))
# Execute app
if __name__ == "__main__":
app.debug = False
port = int(os.environ.get('PORT', 33507))
waitress.serve(app, port=port)