Skip to content

Commit

Permalink
⭐ 支持包含字母的委托单号
Browse files Browse the repository at this point in the history
  • Loading branch information
shidenggui committed Jun 1, 2020
1 parent 1e3d2ab commit 0f824b9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
8 changes: 4 additions & 4 deletions easytrader/clienttrader.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ def reverse_repo(self, security, price, amount, **kwargs):

return self.trade(security, price, amount)


@perf_clock
def buy(self, security, price, amount, **kwargs):
self._switch_left_menus(["买入[F1]"])
Expand Down Expand Up @@ -288,7 +287,9 @@ def auto_ipo(self):

if len(stock_list) == 0:
return {"message": "今日无新股"}
invalid_list_idx = [i for i, v in enumerate(stock_list) if v[self.config.AUTO_IPO_NUMBER] <= 0]
invalid_list_idx = [
i for i, v in enumerate(stock_list) if v[self.config.AUTO_IPO_NUMBER] <= 0
]

if len(stock_list) == len(invalid_list_idx):
return {"message": "没有发现可以申购的新股"}
Expand Down Expand Up @@ -488,8 +489,7 @@ def _cancel_entrust_by_double_click(self, row):
).double_click(coords=(x, y))

def refresh(self):
# self._switch_left_menus(["买入[F1]"], sleep=0.05)
self._switch_left_menus_by_shortcut("{F5}",sleep=0.1)
self._switch_left_menus_by_shortcut("{F5}", sleep=0.1)

@perf_clock
def _handle_pop_dialogs(self, handler_class=pop_dialog_handler.PopDialogHandler):
Expand Down
11 changes: 4 additions & 7 deletions easytrader/pop_dialog_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,15 @@ def _extract_content(self):
return self._app.top_window().Static.window_text()

def _extract_entrust_id(self, content):
# return re.search(r"\d+", content).group()
rule = '编号:(.*?)。'
ids=re.findall(rule,content)
return ids[0]
return re.search(r"[\da-zA-Z]+", content).group()

def _submit_by_click(self):
try:
self._app.top_window()["确定"].click()
except Exception as ex:
self._app.Window_(
best_match="Dialog", top_level_only=True
).ChildWindow(best_match="确定").click()
self._app.Window_(best_match="Dialog", top_level_only=True).ChildWindow(
best_match="确定"
).click()

def _submit_by_shortcut(self):
self._set_foreground(self._app.top_window())
Expand Down

0 comments on commit 0f824b9

Please sign in to comment.