forked from QuantFans/quantdigger
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_shell.py
More file actions
62 lines (50 loc) · 1.56 KB
/
Copy pathtest_shell.py
File metadata and controls
62 lines (50 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# -*- coding: utf-8 -*-
##
# @file test_shell.py
# @brief
# @author wondereamer
# @version 0.1
# @date 2016-08-07
import six
import sys
import unittest
from quantdigger.interaction.backend import Backend
from quantdigger.interaction.shell import shell
backend = Backend()
class TestShell(object):
""" WindowGate call backend """
def __init__(self):
pass
#self._engine = ZMQEventEngine('TestShell')
#self._engine.start()
#self._gate = EventRPCClient('TestShell', self._engine,
#ConfigInteraction.ui_server_for_shell)
#self._backend = EventRPCClient('TestShell', self._engine,
#ConfigInteraction.backend_server_for_shell)
def test_get_all_contracts(self):
six.print_(shell.get_all_contracts())
#def test_get_pcontract(self):
#ret = self.shell.sync_call("get_pcontract", {
#'str_pcontract': 'BB.TEST-1.MINUTE'
#})
#six.print_(json.loads(ret).keys())
#return
if __name__ == '__main__':
#unittest.main()
#try:
#while True:
#time.sleep(1)
#except KeyboardInterrupt:
### @BUG 如果异常退出,系统可能遗留连接,导致多次回调。
#backend.stop()
#sys.exit(0)
import time
t = TestShell()
t.test_get_all_contracts()
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
## @BUG 如果异常退出,系统可能遗留连接,导致多次回调。
backend.stop()
sys.exit(0)