-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
64 lines (52 loc) · 1.88 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import dash
from dash import html
from dash.dependencies import Input, Output
import dash_table
import pandas as pd
from classes import Bot
import time
timeframes = ['D1', 'H4', 'H1', 'M15', 'M5', 'M1']
bot1 = Bot("EURUSD",0.01,30,4,"buy", timeframes)
bot2 = Bot("GBPUSD",0.01,30,4,"buy", timeframes)
# Creamos una lista para almacenar las entradas diarias y las transacciones
daily_entries = []
transactions = []
app = dash.Dash(__name__)
app.layout = html.Div([
html.H1("Dashboard de Trading"),
html.Div([
html.Div([
html.H2("Entradas Diarias"),
dash_table.DataTable(
id='daily-entries',
columns=[{'name': i, 'id': i} for i in daily_entries]
)
], className="six columns"),
html.Div([
html.H2("Transacciones"),
dash_table.DataTable(
id='transactions',
columns=[{'name': i, 'id': i} for i in transactions]
)
], className="six columns")
])
])
# Callback para actualizar las entradas diarias y transacciones
@app.callback(
[Output('daily-entries', 'data'),
Output('transactions', 'data')],
[Input('interval-component', 'n_intervals')]
)
def update_data(n):
# Lógica para actualizar las entradas diarias y transacciones
# Puedes obtener esta información de tu bot o de algún otro origen de datos
# Aquí vamos a usar el bot para obtener los datos actualizados
bot1.run()
bot2.run()
# Obtener datos de las entradas diarias y transacciones del bot
# Suponiendo que el bot tiene atributos daily_entries y transactions
daily_entries_data = bot1.daily_entries
transactions_data = bot1.transactions + bot2.transactions
return daily_entries_data, transactions_data
if __name__ == '__main__':
app.run_server(debug=True)