Skip to content

Commit caf43a0

Browse files
committed
##update
1 parent 2ff72aa commit caf43a0

File tree

3 files changed

+48
-4
lines changed

3 files changed

+48
-4
lines changed

QACTPBeeBroker/__init__.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from QACTPBeeBroker.setting import eventmq_ip, ip
88
from QAPUBSUB.producer import publisher_routing
99

10-
__version__ = '1.2'
10+
__version__ = '1.3'
1111
__author__ = 'yutiansut'
1212

1313

@@ -37,6 +37,7 @@ def on_tick(self, tick):
3737
return
3838
try:
3939
x = dumps(tick) #
40+
print(tick.symbol)
4041
self.pub.pub(x, routing_key=tick.symbol)
4142
except Exception as e:
4243
print(e)
@@ -99,8 +100,12 @@ def go(userid, password, brokerid, mdaddr, tdaddr, appid, authcode):
99100
cont['product'] = cont['product'].value
100101
cont['date'] = cur_date
101102
print(cont)
102-
contractdb.update_one({'gateway_name': 'ctp', 'symbol': cont['symbol']}, {
103-
'$set': cont}, upsert=True)
103+
try:
104+
contractdb.update_one({'gateway_name': 'ctp', 'symbol': cont['symbol']}, {
105+
'$set': cont}, upsert=True)
106+
except Exception as e:
107+
print(e)
108+
104109

105110

106111
if __name__ == '__main__':

beebroker.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
from time import sleep
2+
3+
from ctpbee.interface.ctp.td_api import BeeTdApi
4+
5+
6+
class TdApi(BeeTdApi):
7+
8+
def __init__(self):
9+
super().__init__(event_engine=None)
10+
11+
def on_event(self, type, data):
12+
print(type, data)
13+
14+
15+
if __name__ == '__main__':
16+
api = TdApi()
17+
login_info = {
18+
"userid": "089131",
19+
"password": "350888",
20+
"brokerid": "9999",
21+
# 24小时
22+
"md_address": "tcp://180.168.146.187:10131",
23+
"td_address": "tcp://180.168.146.187:10130",
24+
# # 移动
25+
# "md_address": "tcp://218.202.237.33:10112",
26+
# "td_address": "tcp://218.202.237.33:10102",
27+
"product_info": "",
28+
"appid": "simnow_client_test",
29+
"auth_code": "0000000000000000",
30+
}
31+
api.connect(login_info)
32+
33+
# api.send_order()
34+
# api.cancel_order()
35+
while True:
36+
api.query_account()
37+
sleep(2)
38+
api.query_position()
39+
sleep(2)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def read(fname):
6262
'Intended Audience :: Developers',
6363
'Operating System :: OS Independent',
6464
],
65-
install_requires=['quantaxis', 'quantaxis_pubsub==1.6.2'],
65+
install_requires=['quantaxis', 'quantaxis_pubsub>=1.6.3', 'ctpbee<=0.31.2'],
6666
entry_points={
6767
'console_scripts': [
6868
'QACTPBEE = QACTPBeeBroker.__init__:go'

0 commit comments

Comments
 (0)