Skip to content

Commit

Permalink
no_ui demo
Browse files Browse the repository at this point in the history
  • Loading branch information
lin committed Nov 14, 2020
1 parent b2a34e2 commit 2fefd3b
Showing 1 changed file with 2 additions and 32 deletions.
34 changes: 2 additions & 32 deletions example/no_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,36 +21,13 @@
"key": "",
"secret": "",
"会话数": 3,
"服务器": ["TESTNET", "REAL"],
"合约模式": ["反向", "正向"],
"服务器": "REAL",
"合约模式": "正向",
"代理地址": "",
"代理端口": 0,
}


# Chinese futures market trading period (day/night)
DAY_START = time(8, 45)
DAY_END = time(14, 29)

NIGHT_START = time(20, 45)
NIGHT_END = time(2, 45)


def check_trading_period():
""""""
current_time = datetime.now().time()

trading = False
if (
(current_time >= DAY_START and current_time <= DAY_END)
or (current_time >= NIGHT_START)
or (current_time <= NIGHT_END)
):
trading = True

return trading


def run():
"""
Running in the child process.
Expand Down Expand Up @@ -85,12 +62,5 @@ def run():
while True:
sleep(10)

trading = check_trading_period()
if not trading:
print("关闭进程")
main_engine.close()
sys.exit(0)


if __name__ == "__main__":
run()

0 comments on commit 2fefd3b

Please sign in to comment.