diff --git a/indicators.py b/indicators.py index f389930..4a2f8e1 100644 --- a/indicators.py +++ b/indicators.py @@ -677,6 +677,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.Div([ dcc.Dropdown(symbols, symbols[0], id='symbols_dropdown_list',), ], style={'width': '140px', 'text-align': 'center'}), @@ -694,7 +696,8 @@ if __name__ == "__main__": dcc.Interval( id='interval-component', interval=3*1000, # in milliseconds - n_intervals=len(symbols), + n_intervals=0, + # max_intervals=len(symbols), disabled=True, ), ] @@ -724,13 +727,23 @@ if __name__ == "__main__": def start_cycle(n, value): if n: - # if n%2 == 0: if value == "Pause": return True, "Auto Play", False else: 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"),) + # def reset_cycle(n): + # if n: + # return 0, "Pause", False + # return no_update + # interval callback @callback(Output('symbols_dropdown_list', 'value'), Input("interval-component", "n_intervals"), @@ -815,7 +828,8 @@ 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=[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) @@ -827,15 +841,19 @@ if __name__ == "__main__": # fig.update_layout(bargap=0, bargroupgap=0) # fig.layout.xaxis.title="Time" - fig.layout.yaxis.title="Price" - fig.layout.yaxis.type="log" - fig.layout.yaxis2.title="Volume" + 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" fig.layout.yaxis4.title="RSI/VoRSI" + fig.layout.yaxis.griddash="dash" - fig.update_layout(title_text=plot_ind, title_x=0.5) + fig.update_layout(title_text=plot_ind, title_x=0.5, + 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)) + # fig.update_layout(margin=dict(l=30, r=20, t=50, b=20)) return fig # return fig, syms.index(col_chosen)