-
Notifications
You must be signed in to change notification settings - Fork 656
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
a24d884
commit fac614c
Showing
18 changed files
with
215 additions
and
72 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
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 |
---|---|---|
@@ -1,74 +1,45 @@ | ||
.. _enterprise: | ||
|
||
TqSdk2 企业版 | ||
TqSdk 企业版 | ||
================================================= | ||
除了 TqSdk 专业版以外,我们还提供 TqSdk2 企业版本来供用户使用,如果想了解专业版和企业版的区别,`可以点击查看 TqSdk2 文档 <https://doc.shinnytech.com/tqsdk2/latest/advanced/for_tqsdk1_user.html#tqsdk2-tqsdk>`_ | ||
除了 TqSdk 专业版以外,我们还提供 TqSdk 企业版本 | ||
|
||
如果想使用 TqSdk2 企业版功能,可以点击 `个人中心 <https://account.shinnytech.com/>`_ 申请15天试用或购买 | ||
企业版和专业版相比的主要区别是柜台支持上的区别,企业版支持直连 CTP/融航/杰宜斯等柜台,专业版只能通过中继的方式去进行连接 | ||
|
||
企业版本提供专业版的全部功能 :ref:`profession` ,且 TqSdk 和 TqSdk2 专业版权限通用,此外还包含如下功能 | ||
如果想使用 TqSdk 企业版功能,可以点击 `个人中心 <https://account.shinnytech.com/>`_ 申请15天试用或购买 | ||
|
||
TqSdk2 直连功能 | ||
|
||
TqSdk 直连功能 | ||
------------------------------------------------- | ||
在 TqSdk2 中除了通过中继模式接入期货公司以外,还提供用户通过直连模式接入任意一家指定期货公司 | ||
在 TqSdk 企业版支持用户通过直连模式接入任意一家指定期货公司 | ||
|
||
除了接入指定期货公司的优点以外,直连模式还带来了一下好处: | ||
|
||
* 交易指令直达期货公司,省去中继服务器路径,交易延迟平均减少10ms左右 | ||
* 减少了交易服务器依赖,程序运行稳定性提升 | ||
|
||
TqSdk 直连CTP模式的详细介绍,请点击 :py:class:`~tqsdk.TqCtp` | ||
|
||
.. _tqjees: | ||
|
||
TqSdk2 连接资管平台功能 | ||
------------------------------------------------- | ||
TqSdk2 提供了资管平台的对接支持,支持用户连接到指定资管平台 | ||
|
||
以连接杰宜斯的模拟服务器为例:: | ||
|
||
from tqsdk2 import TqApi, TqAuth, TqJees | ||
|
||
acc = TqJees(td_url="tcp://129.211.138.170:10001", broker_id="JeesDemo", app_id="shinny_tqsdk_01", auth_code= "0000000000000000", user_name="杰宜斯模拟账户", password="杰宜斯模拟账户密码") | ||
api = TqApi(acc,auth= TqAuth("快期账户","账户密码")) | ||
|
||
其中杰宜斯的 **模拟账户** 和 **模拟账户密码** 需要自行和杰宜斯联系获取,其他参数在杰宜斯模拟下为 | ||
|
||
td_url="tcp://39.101.174.218:40205" | ||
|
||
broker_id="JeesDemo" | ||
|
||
app_id="shinny_tqsdk_01" | ||
|
||
auth_code="0000000000000000" | ||
|
||
杰宜斯实盘情况下将对应信息换成实盘信息即可 | ||
|
||
资管平台连接模式的详细介绍,请点击 :py:class:`~tqsdk2.api.TqJees` . | ||
|
||
|
||
.. _tqrohon: | ||
.. _tqjees: | ||
|
||
TqSdk2 连接资管平台功能 | ||
TqSdk 连接平台功能 | ||
------------------------------------------------- | ||
TqSdk2 提供了资管平台的对接支持,支持用户连接到指定资管平台 | ||
|
||
以连接融航的模拟服务器为例:: | ||
|
||
from tqsdk2 import TqApi, TqAuth, TqRohon | ||
TqSdk 提供了资管平台的对接支持,支持用户连接到指定资管平台,例如杰宜斯或者融航资管系统等 | ||
|
||
acc = TqRohon(td_url="tcp://129.211.138.170:10001", broker_id="RohonDemo", app_id="shinny_tqsdk_01", auth_code= "qZWmA7iTXaEO2w40", user_name="融航模拟账户", password="融航模拟账户密码") | ||
api = TqApi(acc,auth= TqAuth("快期账户","账户密码")) | ||
以连融航的模拟服务器为例:: | ||
|
||
其中融航模拟的 **模拟账户** 和 **模拟账户密码** 需要自行和融航联系获取,其他参数在融航模拟下为 | ||
from tqsdk import TqApi, TqRohon, TqAuth | ||
|
||
td_url="tcp://129.211.138.170:10001" | ||
account = TqRohon(account_id="融航账户", password="融航密码", front_broker="融航柜台代码", front_url="融航柜台地址", app_id="融航 AppID", auth_code="融航 AuthCode") | ||
api = TqApi(account, auth=TqAuth("快期账户", "账户密码")) | ||
|
||
broker_id="RohonDemo" | ||
其中融航的 **模拟账户** 、 **模拟账户密码** 、 **app_id** 和 **auth_code** 需要自行和融航联系获取,其他参数在融航模拟下为 | ||
|
||
app_id="shinny_tqsdk_01" | ||
front_url="tcp://129.211.138.170:10001" | ||
|
||
auth_code="qZWmA7iTXaEO2w40" | ||
front_broker="RohonDemo" | ||
|
||
融航实盘情况下将对应信息换成实盘信息即可 | ||
|
||
资管平台连接模式的详细介绍,请点击 :py:class:`~tqsdk2.api.TqRohon` . | ||
融航资管平台连接模式的详细介绍,请点击 :py:class:`~tqsdk.TqRohon` |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.. _tqsdk.tqjees: | ||
|
||
tqsdk.TqJees - 杰宜斯资管交易类 | ||
------------------------------------------------------------------ | ||
.. autoclass:: tqsdk.TqJees | ||
:members: | ||
:inherited-members: |
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,7 @@ | ||
.. _tqsdk.tqyida: | ||
|
||
tqsdk.TqYida - 易达交易类 | ||
------------------------------------------------------------------ | ||
.. autoclass:: tqsdk.TqYida | ||
:members: | ||
:inherited-members: |
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 |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
|
||
setuptools.setup( | ||
name='tqsdk', | ||
version="3.7.2", | ||
version="3.7.3", | ||
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
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.7.2' | ||
__version__ = '3.7.3' |
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 |
---|---|---|
|
@@ -72,7 +72,7 @@ | |
from tqsdk.risk_rule import TqRiskRule | ||
from tqsdk.ins_schema import ins_schema, basic, derivative, future, option | ||
from tqsdk.symbols import TqSymbols | ||
from tqsdk.tradeable import TqAccount, TqZq, TqKq, TqKqStock, TqSim, TqSimStock, BaseSim, BaseOtg, TqCtp, TqRohon | ||
from tqsdk.tradeable import TqAccount, TqZq, TqKq, TqKqStock, TqSim, TqSimStock, BaseSim, BaseOtg, TqCtp, TqRohon, TqJees, TqYida | ||
from tqsdk.trading_status import TqTradingStatus | ||
from tqsdk.tqwebhelper import TqWebHelper | ||
from tqsdk.utils import _generate_uuid, _query_for_quote, BlockManagerUnconsolidated, _quotes_add_night, _bisect_value, \ | ||
|
@@ -82,7 +82,7 @@ | |
from .__version__ import __version__ | ||
|
||
|
||
UnionTradeable = Union[TqAccount, TqKq, TqZq, TqKqStock, TqSim, TqSimStock, TqCtp, TqRohon] | ||
UnionTradeable = Union[TqAccount, TqKq, TqZq, TqKqStock, TqSim, TqSimStock, TqCtp, TqRohon, TqJees, TqYida] | ||
|
||
|
||
class TqApi(TqBaseApi): | ||
|
@@ -121,8 +121,13 @@ def __init__(self, account: Optional[Union[TqMultiAccount, UnionTradeable]] = No | |
* :py:class:`~tqsdk.TqRohon` : 使用融航资管账号 | ||
* :py:class:`~tqsdk.TqJees` : 使用杰宜斯资管账号 | ||
* :py:class:`~tqsdk.TqYida` : 使用易达账号 | ||
* :py:class:`~tqsdk.TqMultiAccount` : 多账户列表,列表中支持 :py:class:`~tqsdk.TqAccount`、:py:class:`~tqsdk.TqKq`、:py:class:`~tqsdk.TqKqStock`、\ | ||
:py:class:`~tqsdk.TqSim`、:py:class:`~tqsdk.TqSimStock`、:py:class:`~tqsdk.TqZq`、:py:class:`~tqsdk.TqRohon` 和 :py:class:`~tqsdk.TqCtp` 中的 0 至 N 个或者组合 | ||
:py:class:`~tqsdk.TqSim`、:py:class:`~tqsdk.TqSimStock`、:py:class:`~tqsdk.TqZq`、:py:class:`~tqsdk.TqRohon`、:py:class:`~tqsdk.TqJees`、\ | ||
:py:class:`~tqsdk.TqYida` 和 :py:class:`~tqsdk.TqCtp` 中的 0 至 N 个或者组合 | ||
auth (TqAuth/str): [必填]用户快期账户: | ||
* :py:class:`~tqsdk.TqAuth` : 添加快期账户类,例如:TqAuth("[email protected]", "123456") | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#!usr/bin/env python3 | ||
# -*- coding:utf-8 -*- | ||
__author__ = 'chenli' | ||
|
||
import hashlib | ||
|
||
from tqsdk.tradeable.otg.base_otg import BaseOtg | ||
from tqsdk.tradeable.mixin import FutureMixin | ||
|
||
|
||
class TqJees(BaseOtg, FutureMixin): | ||
"""杰宜斯资管账户类""" | ||
|
||
def __init__(self, account_id: str, password: str, front_broker: str, front_url: str, app_id: str, auth_code: str) -> None: | ||
""" | ||
创建杰宜斯资管账户实例 | ||
Args: | ||
account_id (str): 帐号 | ||
password (str): 密码 | ||
front_broker (str): 杰宜斯柜台代码 | ||
front_url (str): 杰宜斯柜台地址 | ||
app_id (str): 杰宜斯 AppID | ||
auth_code (str): 杰宜斯 AuthCode | ||
Example1:: | ||
from tqsdk import TqApi, TqJees | ||
account = TqJees(account_id="杰宜斯账户", password="杰宜斯密码", front_broker="杰宜斯柜台代码", front_url="杰宜斯柜台地址", app_id="杰宜斯 AppID", auth_code="杰宜斯 AuthCode") | ||
api = TqApi(account, auth=TqAuth("快期账户", "账户密码")) | ||
注意: | ||
1. 使用 TqJees 账户需要安装 tqsdk_zq_otg 包: pip install -U tqsdk_zq_otg | ||
2. front_broker, front_url, app_id 和 auth_code 信息需要向杰宜斯申请程序化外接后取得 | ||
""" | ||
self._account_id = account_id | ||
self._front_broker = front_broker | ||
self._front_url = front_url | ||
self._app_id = app_id | ||
self._auth_code = auth_code | ||
super(TqJees, self).__init__(broker_id="", account_id=account_id, password=password, td_url="zqotg://127.0.0.1:0/trade") | ||
|
||
@property | ||
def _account_auth(self): | ||
return { | ||
"feature": "tq_direct", | ||
"account_id": self._account_id, | ||
"auto_add": True, | ||
} | ||
|
||
def _get_account_key(self): | ||
s = self._broker_id + self._account_id | ||
s += self._front_broker if self._front_broker else "" | ||
s += self._front_url if self._front_url else "" | ||
return hashlib.md5(s.encode('utf-8')).hexdigest() | ||
|
||
async def _send_login_pack(self): | ||
req = { | ||
"aid": "req_login", | ||
"bid": "tqsdk_zq_otg", | ||
"user_name": self._account_id, | ||
"password": self._password, | ||
"broker_id": self._front_broker, | ||
"front": self._front_url, | ||
"app_id": self._app_id, | ||
"auth_code": self._auth_code, | ||
"backend": "jees" | ||
} | ||
await self._td_send_chan.send(req) |
Oops, something went wrong.