diff --git a/src/nailab/execution/executor.py b/src/nailab/execution/executor.py index 3323c27..a546041 100644 --- a/src/nailab/execution/executor.py +++ b/src/nailab/execution/executor.py @@ -21,6 +21,7 @@ class Executor: strategy.run() results = strategy.get_analyzer('stats').get_result() - return results + trades = strategy.get_analyzer('tradeslist').get_result() + return (results, trades) diff --git a/src/nailab/ui/applicationwindow.py b/src/nailab/ui/applicationwindow.py index 2bd381b..b964320 100644 --- a/src/nailab/ui/applicationwindow.py +++ b/src/nailab/ui/applicationwindow.py @@ -71,13 +71,13 @@ class ApplicationWindow: feeds.append(feed) e = Executor() - result = e.execute_from_file(self.tab_manager.get_current_source_path(), feeds) + (result, trades) = e.execute_from_file(self.tab_manager.get_current_source_path(), feeds) - self._add_results_page(result) + self._add_results_page(result, trades) - def _add_results_page(self, results): + def _add_results_page(self, results, trades): res_widget = ResultsTableWidget() - res_widget.set_results(results) + res_widget.set_results(results, trades) res_widget.show_all() self.tab_manager.new_misc_tab(res_widget) diff --git a/src/nailab/ui/resultstable.py b/src/nailab/ui/resultstable.py index 5b703bc..41a8a2a 100644 --- a/src/nailab/ui/resultstable.py +++ b/src/nailab/ui/resultstable.py @@ -12,24 +12,26 @@ def render_ratio(a, b): else: return "∞" -class ResultsTableWidget(Gtk.Box): +class ResultsTableWidget(Gtk.Notebook): def __init__(self): - super().__init__(Gtk.Orientation.VERTICAL) + super().__init__() + + self.set_tab_pos(Gtk.PositionType.LEFT) self.buffer = Gtk.TextBuffer() self.text_result = Gtk.TextView() self.text_result.set_buffer(self.buffer) - self.add(self.text_result) + self.append_page(self.text_result, Gtk.Label('Statistics')) style_ctx = self.text_result.get_style_context() self.provider = Gtk.CssProvider() self.provider.load_from_data(b'GtkTextView { font-family: "Monospace"; }') style_ctx.add_provider(self.provider, Gtk.STYLE_PROVIDER_PRIORITY_USER) - - def set_results(self, results): + def set_results(self, results, trades): self.buffer.set_text(self.generate_plain_text(results)) + print(trades) def generate_plain_text(self, stats):