Renjith Karimattathil SASIDHARAN commited on
Commit
e2201fe
·
1 Parent(s): d823dc8

Added profit summary table

Browse files
Files changed (2) hide show
  1. __pycache__/app.cpython-39.pyc +0 -0
  2. app.py +19 -4
__pycache__/app.cpython-39.pyc ADDED
Binary file (4.07 kB). View file
 
app.py CHANGED
@@ -60,7 +60,7 @@ def create_latest_profit_plot(strategy, profits):
60
  title=f"Profits for day for {strategy}")
61
  plot.update_layout(legend=dict(x=0.5, y=0.99), title_x=0.5, legend_title_text="")
62
 
63
- table = go.Figure(data=[go.Table(
64
  header=dict(values=list(['Created', 'Closed', 'Market Type', 'Symbol', 'Qty', 'Ticker Delta', 'Open', 'Close', 'Profit']),
65
  align='left'),
66
  cells=dict(values=[
@@ -78,10 +78,23 @@ def create_latest_profit_plot(strategy, profits):
78
  )
79
  ])
80
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  if profits == 'Profits':
82
- return gr.update(value=plot, visible=True)
83
  if profits == 'Trades':
84
- return gr.update(value=table, visible=True)
85
 
86
 
87
  with gr.Blocks() as demo:
@@ -99,12 +112,14 @@ with gr.Blocks() as demo:
99
  with gr.Row():
100
  with gr.Column():
101
  profits_plot = gr.Plot(visible=False)
 
 
102
  with gr.Row():
103
  with gr.Column():
104
  trades_plot = gr.Plot(visible=False)
105
 
106
 
107
- fetch.click(create_latest_profit_plot, inputs=[strategy, type], outputs=profits_plot)
108
  # fetch.click(create_latest_profit_plot, inputs=[strategy, type], outputs=trades_plot)
109
  # fetch.click(create_issue_plot, inputs=[libraries, issues], outputs=issue_plot)
110
 
 
60
  title=f"Profits for day for {strategy}")
61
  plot.update_layout(legend=dict(x=0.5, y=0.99), title_x=0.5, legend_title_text="")
62
 
63
+ trades_table = go.Figure(data=[go.Table(
64
  header=dict(values=list(['Created', 'Closed', 'Market Type', 'Symbol', 'Qty', 'Ticker Delta', 'Open', 'Close', 'Profit']),
65
  align='left'),
66
  cells=dict(values=[
 
78
  )
79
  ])
80
 
81
+ profits_table = go.Figure(data=[go.Table(
82
+ header=dict(values=list(['Created', 'Closed', 'Market Type', 'Qty', 'Ticker Delta', 'Profit']),
83
+ align='left'),
84
+ cells=dict(values=[
85
+ orders.created_ts,
86
+ orders.closed_ts,
87
+ orders.market_type,
88
+ orders.quantity,
89
+ orders.ticker_delta,
90
+ orders.profit])
91
+ )
92
+ ])
93
+
94
  if profits == 'Profits':
95
+ return [gr.update(value=plot, visible=True), gr.update(value=profits_table, visible=True)]
96
  if profits == 'Trades':
97
+ return gr.update(value=trades_table, visible=True)
98
 
99
 
100
  with gr.Blocks() as demo:
 
112
  with gr.Row():
113
  with gr.Column():
114
  profits_plot = gr.Plot(visible=False)
115
+ with gr.Row():
116
+ profits_table = gr.Plot(visible=False)
117
  with gr.Row():
118
  with gr.Column():
119
  trades_plot = gr.Plot(visible=False)
120
 
121
 
122
+ fetch.click(create_latest_profit_plot, inputs=[strategy, type], outputs=[profits_plot, profits_table])
123
  # fetch.click(create_latest_profit_plot, inputs=[strategy, type], outputs=trades_plot)
124
  # fetch.click(create_issue_plot, inputs=[libraries, issues], outputs=issue_plot)
125