Skip to content

Commit

Permalink
Merge pull request #971 from yutiansut/master
Browse files Browse the repository at this point in the history
update
  • Loading branch information
yutiansut authored Jan 22, 2019
2 parents ef8a6b9 + 528bbd3 commit ae25da4
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
34 changes: 34 additions & 0 deletions EXAMPLE/4_回测实盘交易/QATTS_caitong_test.py
Original file line number Diff line number Diff line change
@@ -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())
5 changes: 3 additions & 2 deletions QUANTAXIS/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
2017/4/8
"""

__version__ = '1.2.8.dev3'
__version__ = '1.2.8'
__author__ = 'yutiansut'

# fetch methods
Expand Down Expand Up @@ -155,7 +155,8 @@
QA_RandomBroker,
QA_SimulatedBroker,
QA_RealBroker,
QA_BacktestBroker
QA_BacktestBroker,
QA_TTSBroker,
)

# Account,Risk,Portfolio,User,Strategy
Expand Down

0 comments on commit ae25da4

Please sign in to comment.