-
Notifications
You must be signed in to change notification settings - Fork 26
/
beebroker.py
39 lines (31 loc) · 1.07 KB
/
beebroker.py
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
from time import sleep
from ctpbee.interface.ctp.td_api import BeeTdApi
class TdApi(BeeTdApi):
def __init__(self):
super().__init__(event_engine=None)
def on_event(self, type, data):
print(type, data)
if __name__ == '__main__':
api = TdApi()
login_info = {
"userid": "089131",
"password": "350888",
"brokerid": "9999",
# 24小时
"md_address": "tcp://180.168.146.187:10131",
"td_address": "tcp://180.168.146.187:10130",
# # 移动
# "md_address": "tcp://218.202.237.33:10112",
# "td_address": "tcp://218.202.237.33:10102",
"product_info": "",
"appid": "simnow_client_test",
"auth_code": "0000000000000000",
}
api.connect(login_info)
# api.send_order()
# api.cancel_order()
while True:
api.query_account()
sleep(2)
api.query_position()
sleep(2)