From 4450ccd2be030e5345dd2f6e6481e89e1646e13d Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Sun, 9 Jun 2019 10:21:44 +0800 Subject: [PATCH] [Mod] flake8 code improve --- docs/conf.py | 4 ++-- vnpy/app/cta_backtester/ui/widget.py | 17 ++++++++--------- vnpy/app/cta_strategy/backtesting.py | 1 + 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index c16b73ee..e7870b73 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -188,7 +188,7 @@ texinfo_documents = [ # -- Options for intersphinx output ---------------------------------------------- intersphinx_mapping = { - #'python': ('https://docs.python.org/3/', None), + # 'python': ('https://docs.python.org/3/', None), } # -- Options for Epub output ------------------------------------------------- @@ -211,4 +211,4 @@ epub_exclude_files = ['search.html'] autodoc_default_options = { 'member-order': 'bysource', 'undoc-members': True, -} \ No newline at end of file +} diff --git a/vnpy/app/cta_backtester/ui/widget.py b/vnpy/app/cta_backtester/ui/widget.py index fddf5573..b73b4f54 100644 --- a/vnpy/app/cta_backtester/ui/widget.py +++ b/vnpy/app/cta_backtester/ui/widget.py @@ -130,7 +130,7 @@ class BacktesterManager(QtWidgets.QWidget): form.addRow("合约乘数", self.size_line) form.addRow("价格跳动", self.pricetick_line) form.addRow("回测资金", self.capital_line) - + left_vbox = QtWidgets.QVBoxLayout() left_vbox.addLayout(form) left_vbox.addWidget(backtesting_button) @@ -153,19 +153,19 @@ class BacktesterManager(QtWidgets.QWidget): self.chart.setMinimumWidth(1000) self.trade_dialog = BacktestingResultDialog( - self.main_engine, + self.main_engine, self.event_engine, "回测成交记录", BacktestingTradeMonitor ) self.order_dialog = BacktestingResultDialog( - self.main_engine, + self.main_engine, self.event_engine, "回测委托记录", BacktestingOrderMonitor ) self.daily_dialog = BacktestingResultDialog( - self.main_engine, + self.main_engine, self.event_engine, "回测每日盈亏", DailyResultMonitor @@ -263,7 +263,7 @@ class BacktesterManager(QtWidgets.QWidget): if result: self.statistics_monitor.clear_data() self.chart.clear_data() - + self.trade_button.setEnabled(False) self.order_button.setEnabled(False) self.daily_button.setEnabled(False) @@ -892,8 +892,8 @@ class BacktestingResultDialog(QtWidgets.QDialog): """ def __init__( - self, - main_engine: MainEngine, + self, + main_engine: MainEngine, event_engine: EventEngine, title: str, table_class: QtWidgets.QTableWidget @@ -930,7 +930,7 @@ class BacktestingResultDialog(QtWidgets.QDialog): def update_data(self, data: list): """""" self.updated = True - + data.reverse() for obj in data: self.table.insert_new_row(obj) @@ -938,4 +938,3 @@ class BacktestingResultDialog(QtWidgets.QDialog): def is_updated(self): """""" return self.updated - diff --git a/vnpy/app/cta_strategy/backtesting.py b/vnpy/app/cta_strategy/backtesting.py index bdeb6295..115881cc 100644 --- a/vnpy/app/cta_strategy/backtesting.py +++ b/vnpy/app/cta_strategy/backtesting.py @@ -1039,6 +1039,7 @@ class BacktestingEngine: """ return list(self.daily_results.values()) + class DailyResult: """"""