feat: refresh Tencent quotes from GUI

This commit is contained in:
王鹏
2026-07-08 22:03:57 +08:00
parent f8cd9a92ab
commit 93e548d8a7
2 changed files with 11 additions and 2 deletions

View File

@@ -159,7 +159,7 @@ class MainWindow(QMainWindow):
def _create_toolbar(self) -> QHBoxLayout:
layout = QHBoxLayout()
buttons = [
("刷新", self.refresh_all),
("刷新行情", self._refresh_quotes),
("账户设置", self._edit_account),
("添加标的", self._add_instrument),
("录入成交", self._add_trade),
@@ -187,6 +187,14 @@ class MainWindow(QMainWindow):
self._fill_holdings_table()
self._refresh_details()
def _refresh_quotes(self) -> None:
try:
self.service.refresh_quotes()
except Exception as exc:
QMessageBox.warning(self, "行情刷新失败", str(exc))
return
self.refresh_all()
def _fill_holdings_table(self) -> None:
self.holdings_table.setRowCount(len(self._positions))
for row, position in enumerate(self._positions):