-
Notifications
You must be signed in to change notification settings - Fork 659
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e73586d
commit 4b0fa90
Showing
14 changed files
with
87 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,4 @@ | |
unanttended.rst | ||
targetpostask2.rst | ||
scheduler.rst | ||
tqsdk2ctptest.rst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
.. _tqsdk2ctptest: | ||
|
||
在 tqsdk 中调用 tqsdk2 查询保证金 | ||
================================================= | ||
tqSdk 没有直接提供查询保证金的接口,但是你可以通过使用tqsdk2 的直连功能来做到这个效果。tqsdk和tqsdk2可以在一个py文件中同时运行。 | ||
|
||
该方法仅支持直连 CTP 柜台时使用。受限制于 CTP 柜台的流控机制(每秒 1 笔), 短时间发送大量查询指令后, 后续查询指令将会排队等待。 | ||
为了避免盘中的查询等待时间, 建议盘前启动程序, 对标的合约提前进行查询:: | ||
|
||
from tqsdk import TqApi, TqAuth, TqAccount | ||
import tqsdk2 | ||
|
||
account = tqsdk2.TqCtp(front_url, front_broker, app_id, auth_code, account_id, password) | ||
api_margin = tqsdk2.TqApi(account = account, auth=tqsdk2.TqAuth("信易账户", "账户密码")) | ||
rate = api_margin.get_margin_rates("SHFE.cu2201") | ||
print(rate) | ||
api = TqApi(TqAccount("期货公司","账号","密码"),auth=TqAuth("信易账户", "账户密码")) | ||
quote = api.get_quote("SHFE.cu2201") | ||
while True: | ||
api.wait_update() | ||
quote.datetime | ||
# 正常和tqsdk一样执行策略 | ||
|
||
|
||
tqsdk2的直连功能需要企业版权限,有关企业版的具体费用和功能,请参考 `天勤官方网站 <https://www.shinnytech.com/tqsdk_professional/>`_ | ||
如果想了解更多关于tqsdk2的直连功能TqCtp,请参考 `tqsdk2官方文档 <https://doc.shinnytech.com/tqsdk2/latest/reference/tqsdk2.ctp.html?highlight=tqctp#tqsdk2.TqCtp/>`_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ def get_tag(self): | |
|
||
setuptools.setup( | ||
name='tqsdk', | ||
version="3.2.3", | ||
version="3.2.4", | ||
description='TianQin SDK', | ||
author='TianQin', | ||
author_email='[email protected]', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = '3.2.3' | ||
__version__ = '3.2.4' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters