Example #1
0
from flask import Flask, render_template, request, redirect, Markup
from bokeh.plotting import figure, output_file, show # standard bokeh import
from bokeh.models import Range1d, BoxAnnotation
from bokeh.embed import components
import time
import datetime
import requests
import simplejson as json
import numpy as np 
import pandas as pd

app = Flask(__name__)

app.script = ''
app.div = ''

@app.route('/')
def main():
  return redirect('/index')

@app.route('/index',methods=['GET','POST'])
def index():
    if request.method == 'GET':  
        app.script = ''
        app.div = ''
        app.stock_symbol = ''
        app.stock_name = ''
        app.closing_price = ''
        app.volume = ''
     	app.opening_price = ''
     	app.daily_diff_price = ''
Example #2
0
from flask import Flask, render_template, request, redirect
from process import make_html
from plot import produce_plot
from bokeh.embed import components
from bokeh.plotting import figure
import json


app = Flask(__name__)
app.OPTIONS = [r"Open", r"Adj_Open", r"Close", r"Adj_Close"]
app.NAMES = [s.replace("_",". ") for s in app.OPTIONS]
app.div = []
app.script = ""


@app.route('/')
def main():
  return redirect('/index')

@app.route('/clear', methods = ['GET'])
def clear():
	return redirect('/index')
	#return render_template('index.html',op = app.OPTIONS, names = app.NAMES)

@app.route('/index', methods = ['GET','POST'])
def index():
	if request.method == 'GET':
		return render_template('index.html', op = app.OPTIONS, names = app.NAMES)
	if request.method == 'POST':
		options = [val.replace("_",". ") for val in app.OPTIONS if request.form.get(val) is not None]
		ticker = request.form.get("ticker")
Example #3
0
from flask import Flask, render_template, redirect, url_for, request, session, flash, g, Markup
from functools import wraps
from subprocess import check_output
from hashlib import sha256
from uuid import uuid4
import sqlite3


app = Flask(__name__)

app.config.from_object('config')
app.database = app.config['DATABASE']
app.script = app.config['SCRIPT']
app.secret_key = app.config['SECRET_KEY']

###################################### NON-PAGE FUNCTIONS ###################################

##
# Login Required Decorator
def login_required(f):
    @wraps(f)
    def wrap(*args, **kwargs):
        if 'logged_in' in session:
            return f(*args, **kwargs)
        else:
            flash('You must be logged in to view this page.')
            return redirect(url_for('login'))
    return wrap

##
# Admin Required Decorator
from flask import Flask, render_template, request, redirect
from work import get_current_station_data, get_current_info
from datetime import datetime
import pandas
import json

app = Flask(__name__)
app.have_locs = False
app.script = None
app.div = None

@app.route('/')
def main():
  return redirect('/index')

@app.route('/index', methods=['GET', 'POST'])
def index():
  if request.method == 'GET':
    #app.time = datetime.now()
    app.current_time, app.station_info = get_current_info.get_station_info()
    app.temp, app.conditions = get_current_info.get_noaa_info()
    app.features = get_current_info.build_features(app.current_time, app.temp, app.conditions)
    date_str = app.current_time.strftime('%A, %B %d, %Y') 
    time_str = app.current_time.strftime('%H:%M')
    return render_template('index.html', time = time_str, date=date_str,
                           temp = app.temp, conditions = app.conditions, df=str(app.features))
  else:
    app.start_point = request.form['start_point']
    app.end_point = request.form['end_point']
    app.have_locs = True
    #app.time = request.form['time'] maybe...
Example #5
0
from bokeh.plotting import figure
from bokeh.embed import components
import Quandl
import time
import datetime

app_lulu = Flask(__name__)

app_lulu.colors = {"Black": "#000000", "Red": "#FF0000", "Green": "#00FF00", "Blue": "#0000FF"}
app_lulu.colorlist = ["Black", "Red", "Green", "Blue"]

# global variables list 12345786
app_lulu.vars = {}
app_lulu.stock_data = []
app_lulu.err_msg = ""
app_lulu.script = ""
app_lulu.div = ""
app_lulu.price_cnt = 0
app_lulu.time_delta = datetime.timedelta(days=-31)


@app_lulu.route("/")
def main_entry():
    return redirect("/main_input")


@app_lulu.route("/main_input", methods=["GET", "POST"])
def main_input():
    if request.method == "GET":
        return render_template("user_input_page.html")
    else: