diff --git a/indicators.py b/indicators.py index 49f25ad..1af1508 100644 --- a/indicators.py +++ b/indicators.py @@ -679,8 +679,8 @@ if __name__ == "__main__": # App layout app.layout = [ html.Div([ - # html.Button('Reset', id="reset-button", n_clicks=0, - # style={'font-size': '12px', 'width': '140px', 'display': 'inline-block', 'margin-bottom': '10px', 'margin-right': '5px', 'height':'36px', 'verticalAlign': 'top'}), + html.Button('Reload Syms', id="reload-button", n_clicks=0, + style={'font-size': '12px', 'width': '140px', 'display': 'inline-block', 'margin-bottom': '10px', 'margin-right': '5px', 'height':'36px', 'verticalAlign': 'top'}), html.Div([ dcc.Dropdown(symbols, symbols[0], id='symbols_dropdown_list',), ], style={'width': '140px', 'text-align': 'center'}), @@ -735,16 +735,16 @@ if __name__ == "__main__": return False, "Pause", True return no_update - # # reset button callback - # @callback(Output('interval-component', 'n_intervals'), - # Output("start-button", "children"), - # Output('symbols_dropdown_list', 'disabled'), - # Input("reset-button", "n_clicks"),) + # reload button callback + @callback(Output('symbols_dropdown_list', 'options'), + Input("reload-button", "n_clicks"),) - # def reset_cycle(n): - # if n: - # return 0, "Pause", False - # return no_update + def reload_syms(n): + if n: + watchlist = get_watchlist() + symbols = watchlist.index.values.tolist() + return symbols + return no_update # interval callback @callback(Output('symbols_dropdown_list', 'value'), @@ -766,8 +766,7 @@ if __name__ == "__main__": # State('symbols_dropdown_list', 'options') # Input(component_id='signal', component_property='data'), ) - - # def update_graph(col_chosen, syms): + def update_graph(col_chosen): if not col_chosen: raise PreventUpdate @@ -830,21 +829,15 @@ if __name__ == "__main__": x=rsi.index, y=['_RSI', '_VoRSI'], ) - # fig.add_traces(price_line.data + volume_line.data, rows=1, cols=1, secondary_ys=[False, False, False, False, False, False, True]) fig.add_traces(price_line.data + volume_line.data, rows=1, cols=1, secondary_ys=[True, True, True, True, True, True, False]) fig.add_traces(macd_line.data + macd_hist_pos.data + macd_hist_neg.data, rows=2, cols=1) - # fig.add_traces(macd_line.data, rows=2, cols=1) fig.add_traces(rsi_line.data, rows=3, cols=1) # fig.update_traces(marker_color = 'rgba(0,0,250,0.5)', # marker_line_width = 0, # selector=dict(type="bar"), - # ) - # fig.update_layout(bargap=0, bargroupgap=0) - # fig.layout.xaxis.title="Time" fig.layout.yaxis.title="Volume" - # fig.layout.yaxis.type="log" fig.layout.yaxis2.title="Price ($)" fig.layout.yaxis2.type="log" fig.layout.yaxis3.title="MACD" @@ -855,10 +848,8 @@ if __name__ == "__main__": margin=dict(l=30, r=20, t=50, b=20), ) # fig.update_layout(showlegend=False) - # fig.update_layout(margin=dict(l=30, r=20, t=50, b=20)) return fig - # return fig, syms.index(col_chosen) serve(app.server, host="0.0.0.0", port=8050, threads=7) # app.run(debug=True)