diff --git "a/EXAMPLE/4_\345\233\236\346\265\213\345\256\236\347\233\230\344\272\244\346\230\223/QATTS_caitong_test.py" "b/EXAMPLE/4_\345\233\236\346\265\213\345\256\236\347\233\230\344\272\244\346\230\223/QATTS_caitong_test.py" new file mode 100644 index 000000000..8597e1bde --- /dev/null +++ "b/EXAMPLE/4_\345\233\236\346\265\213\345\256\236\347\233\230\344\272\244\346\230\223/QATTS_caitong_test.py" @@ -0,0 +1,34 @@ + +import os +import QUANTAXIS as QA +print('在运行前 请先运行tdxtradeserver的 exe文件') +print('这是测试代码, 下面需要输入的 key/iv在ini中自己查找, account 和password是自己的账户密码 ') +api = QA.QA_TTSBroker(endpoint="http://127.0.0.1:19820/api", + enc_key=bytes(input('env_key: '), encoding='utf-8'), enc_iv=bytes(input('env_iv: '), encoding='utf-8')) + +print("---Ping---") +result = api.ping() +print(result) + +print("---登入---") +acc = input('account: ') +password = input('password: ') +result = api.logon("60.191.116.36", 7708, + "6.44", 1, + acc, acc, password, "") + +if result["success"]: + for i in (0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 13, 14, 15): + print("---查询信息 cate=%d--" % i) + print(api.data_to_df(api.query_data(i))) + + + print('==============================下面是下单部分========================') + print('即将演示的是 下单000001 数量100股 价格9.8 的限价单模式') + + if str(input('我已知晓, 并下单 按y继续 n 退出'))[0] == 'y': + + print(api.send_order(code='000001', price=9.8, amount=100, + towards=QA.ORDER_DIRECTION.BUY, order_model=QA.ORDER_DIRECTION.BUY)) + print("---登出---") + print(api.logoff()) diff --git a/QUANTAXIS/__init__.py b/QUANTAXIS/__init__.py index b6f426190..fbabb1e80 100755 --- a/QUANTAXIS/__init__.py +++ b/QUANTAXIS/__init__.py @@ -31,7 +31,7 @@ 2017/4/8 """ -__version__ = '1.2.8.dev3' +__version__ = '1.2.8' __author__ = 'yutiansut' # fetch methods @@ -155,7 +155,8 @@ QA_RandomBroker, QA_SimulatedBroker, QA_RealBroker, - QA_BacktestBroker + QA_BacktestBroker, + QA_TTSBroker, ) # Account,Risk,Portfolio,User,Strategy