Skip to content

Commit

Permalink
fix: tqhelper.py 文件中用到的内部变量增加 _
Browse files Browse the repository at this point in the history
  • Loading branch information
shinny-mayanqiong authored and shinny-limin committed Dec 19, 2019
1 parent bc64e33 commit 1f4ab5a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tqsdk/tqhelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ async def account_watcher(api, dt_func, tq_send_chan):
async for _ in update_chan:
account_changed = api.is_changing(account, "static_balance")
for d in api._diffs:
for oid in d.get("trade", {}).get(api._account.account_id, {}).get("orders", {}).keys():
for oid in d.get("trade", {}).get(api._account._account_id, {}).get("orders", {}).keys():
order = api.get_order(oid)
if order._this_session is not True:
continue
Expand All @@ -87,7 +87,7 @@ async def account_watcher(api, dt_func, tq_send_chan):
"datetime": dt_func(),
"order": {k: v for k, v in order.items() if not k.startswith("_")},
})
for tid in d.get("trade", {}).get(api._account.account_id, {}).get("trades", {}).keys():
for tid in d.get("trade", {}).get(api._account._account_id, {}).get("trades", {}).keys():
trade = api.get_trade(tid)
order = api.get_order(trade.order_id)
if order._this_session is not True:
Expand Down Expand Up @@ -327,7 +327,7 @@ def link_tq(api):
# 根据运行模式分别执行不同的初始化任务
if args._action == "run":
if isinstance(api._account, TqAccount) and (
api._account.broker_id != args._broker_id or api._account.account_id != args._account_id):
api._account._broker_id != args._broker_id or api._account._account_id != args._account_id):
raise Exception("策略代码与设置中的账户参数冲突。可尝试删去代码中的账户参数 TqAccount,以终端或者插件设置的账户参数运行。")
instance = SingleInstance(args._account_id)
api._account = TqAccount(args._broker_id, args._account_id, args._password)
Expand Down

0 comments on commit 1f4ab5a

Please sign in to comment.