Beispiel #1
0
def update_down_pred(n1, n2, n3, n4, n5, click_cache, t1, t2, t3, t4, t5):
    click_cache = np.array(
        list(map(lambda n: int(n), click_cache[0].split(' '))))
    new_clicks = np.array([n1, n2, n3, n4, n5])
    idx = np.argmax(new_clicks - click_cache)
    t = np.array([t1, t2, t3, t4, t5])[idx]
    df = load_ts(t)
    df.sort_index(inplace=True)
    ic = IndiqueCalculator(df, t)
    pred = ic.load_predict()
    return str(round(pred[0][0] * 100, 1)) + '%'
Beispiel #2
0
def update_vpt_figure(n1, n2, n3, n4, n5, click_cache, t1, t2, t3, t4, t5):
    click_cache = np.array(
        list(map(lambda n: int(n), click_cache[0].split(' '))))
    new_clicks = np.array([n1, n2, n3, n4, n5])
    idx = np.argmax(new_clicks - click_cache)
    t = np.array([t1, t2, t3, t4, t5])[idx]
    df = load_ts(t)
    df.sort_index(inplace=True)
    ic = IndiqueCalculator(df, t)
    vpt = ic.get_vpt()
    data = [go.Scatter(x=vpt.index, y=vpt.values)]
    layout = go.Layout(title='3 mos VPT',
                       paper_bgcolor='rgba(0, 0, 0, 0.7)',
                       plot_bgcolor='rgba(48, 48, 48, 0.7)',
                       margin={
                           'l': 40,
                           'b': 40,
                           't': 40,
                           'r': 0
                       },
                       font={'color': 'white'},
                       height=300)
    return go.Figure(data, layout=layout)