def get_all_investments(): dba = dbAccessor() stocks = dba.getInvestments(session.get('uid', 1)) print(stocks) data = [] for stock in stocks: data.append(company_analysis(stock[1], holding=True, name=stock[5])) print data response = make_response(jsonify(data=data), 200) response.headers['Access-Control-Allow-Credentials'] = 'true' response.headers['Access-Control-Allow-Origin'] = '*' response.headers['Access-Control-Allow-Methods'] = 'PUT, GET, POST, DELETE, OPTIONS' response.headers['Access-Control-Allow-Headers'] = 'Origin, Accept, Content-Type, X-Requested-With, X-CSRF-Token' return response
def get_all_investments(): dba = dbAccessor() stocks = dba.getInvestments(session.get('uid', 1)) print(stocks) data = [] for stock in stocks: data.append(company_analysis(stock[1], holding=True, name=stock[5])) print data response = make_response(jsonify(data=data), 200) response.headers['Access-Control-Allow-Credentials'] = 'true' response.headers['Access-Control-Allow-Origin'] = '*' response.headers[ 'Access-Control-Allow-Methods'] = 'PUT, GET, POST, DELETE, OPTIONS' response.headers[ 'Access-Control-Allow-Headers'] = 'Origin, Accept, Content-Type, X-Requested-With, X-CSRF-Token' return response
def trans(): total = 0 p = dbAccessor() res = p.getTransactions(session.get('uid', 1)) stock = [] print(res) for i in res: total += i[2] stocks = {"name": i[5], "num": i[2]} stock.append(stocks) data = {"total": total, "stocks": stock} response = make_response(jsonify(data=data), 200) response.headers['Access-Control-Allow-Credentials'] = 'true' response.headers['Access-Control-Allow-Origin'] = '*' response.headers[ 'Access-Control-Allow-Methods'] = 'PUT, GET, POST, DELETE, OPTIONS' response.headers[ 'Access-Control-Allow-Headers'] = 'Origin, Accept, Content-Type, X-Requested-With, X-CSRF-Token' return response
def trans(): total = 0 p = dbAccessor() res = p.getTransactions(session.get('uid', 1)) stock = [] print(res) for i in res: total += i[2] stocks = { "name": i[5], "num": i[2] } stock.append(stocks) data = { "total": total, "stocks": stock } response = make_response(jsonify(data=data), 200) response.headers['Access-Control-Allow-Credentials'] = 'true' response.headers['Access-Control-Allow-Origin'] = '*' response.headers['Access-Control-Allow-Methods'] = 'PUT, GET, POST, DELETE, OPTIONS' response.headers['Access-Control-Allow-Headers'] = 'Origin, Accept, Content-Type, X-Requested-With, X-CSRF-Token' return response