diff --git a/tradingview-webhooks-bot/app.py b/tradingview-webhooks-bot/app.py new file mode 100644 index 0000000..f3b2b91 --- /dev/null +++ b/tradingview-webhooks-bot/app.py @@ -0,0 +1,40 @@ +import dash +import dash_core_components as dcc +import dash_html_components as html +import csv +import datetime + +def get_log(): + log = [] + with open('logs/log.csv', 'r', encoding="utf-8") as csvfile: + reader = csv.reader(csvfile, delimiter=',', quotechar='"') + for row in reader: + log.append(row) + return log + +app = dash.Dash('tradingview-webhooks') + +app.layout = html.Div([ + + html.Img(src='https://github.com/Robswc/tradingview-webhooks-bot/raw/master/img/webhooks_bot_logo.png', style={'height': 50}), + html.Hr(), + html.Div([ + html.Table(), + ], id='alerts-table'), + html.Div(id='app-frame'), + dcc.Interval( + id='app-update', + interval=1000, + n_intervals=0), + ], className="container", style={'width': '100%', 'max-width': 50000}) + +@app.callback(dash.dependencies.Output('alerts-table', 'children'), [dash.dependencies.Input('app-update', 'n_intervals')]) +def update_app(intervals): + table = [] + for i in get_log(): + table.append(html.Tr(i)) + return table + + +if __name__ == '__main__': + app.run_server(debug=True) \ No newline at end of file diff --git a/tradingview-webhooks-bot/logs/log.csv b/tradingview-webhooks-bot/logs/log.csv new file mode 100644 index 0000000..f84aee2 --- /dev/null +++ b/tradingview-webhooks-bot/logs/log.csv @@ -0,0 +1,2 @@ +"('Sending:', 'XBTUSD', 'market', 'buy', '500', 'None')" +"('Sending:', 'XBTUSD', 'market', 'buy', '500', 'None')" diff --git a/tradingview-webhooks-bot/webhook-bot.py b/tradingview-webhooks-bot/webhook-bot.py index 936c90b..7dc4fa2 100644 --- a/tradingview-webhooks-bot/webhook-bot.py +++ b/tradingview-webhooks-bot/webhook-bot.py @@ -22,7 +22,7 @@ def root(): return 'online' - +# create seperate path for webhooks only. @app.route('/webhook', methods=['POST']) def webhook(): if request.method == 'POST':