Skip to content

Commit

Permalink
Update Version 3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
shinny-pack authored and shinny-mayanqiong committed Nov 15, 2021
1 parent 436f83b commit d08cbee
Show file tree
Hide file tree
Showing 16 changed files with 778 additions and 409 deletions.
2 changes: 1 addition & 1 deletion PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: tqsdk
Version: 2.9.4
Version: 3.0.0
Summary: TianQin SDK
Home-page: https://www.shinnytech.com/tqsdk
Author: TianQin
Expand Down
4 changes: 2 additions & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
# built documents.
#
# The short X.Y version.
version = u'2.9.4'
version = u'3.0.0'
# The full version, including alpha/beta/rc tags.
release = u'2.9.4'
release = u'3.0.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
7 changes: 7 additions & 0 deletions doc/version.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

版本变更
=============================
3.0.0 (2021/11/12)

* 增加::py:class:`~tqsdk.account.TqKqStock` **快期股票模拟** 账户类型,支持股票模拟交易。**专业版用户** 可用,专业版购买网址:https://account.shinnytech.com。
* 增加::py:class:`~tqsdk.risk_rule.TqRuleAccOpenVolumesLimit` 类,日内累计开仓手数限制
* 优化:使用 sgqlc 库生成合约服务的 graphql 查询


2.9.4 (2021/11/04)

* 增加::py:meth:`~tqsdk.api.TqApi.query_symbol_info` 接口返回值中增加 ``upper_limit``, ``lower_limit`` 这两个字段
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def get_tag(self):

setuptools.setup(
name='tqsdk',
version="2.9.4",
version="3.0.0",
description='TianQin SDK',
author='TianQin',
author_email='[email protected]',
Expand All @@ -47,7 +47,7 @@ def get_tag(self):
zip_safe=False,
python_requires='>=3.6.4',
install_requires=["websockets>=8.1", "requests", "numpy", "pandas>=1.1.0", "scipy", "simplejson", "aiohttp",
"certifi", "pyjwt", "psutil", "shinny_structlog"],
"certifi", "pyjwt", "psutil", "shinny_structlog", "sgqlc"],
cmdclass={'bdist_wheel': bdist_wheel},
classifiers=[
"Programming Language :: Python :: 3",
Expand Down
2 changes: 1 addition & 1 deletion tqsdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
name = "tqsdk"

from tqsdk.api import TqApi
from tqsdk.account import TqAccount, TqKq
from tqsdk.account import TqAccount, TqKq, TqKqStock
from tqsdk.auth import TqAuth
from tqsdk.channel import TqChan
from tqsdk.backtest import TqBacktest, TqReplay
Expand Down
2 changes: 1 addition & 1 deletion tqsdk/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.9.4'
__version__ = '3.0.0'
33 changes: 33 additions & 0 deletions tqsdk/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,36 @@ def __init__(self, td_url: Optional[str] = None):
创建快期模拟账户实例
"""
super().__init__("快期模拟", "", "", td_url=td_url)


class TqKqStock(TqAccount):
def __init__(self, td_url: Optional[str] = None):
"""
创建快期股票模拟账户实例
快期股票模拟为专业版功能,可以点击 `天勤量化专业版 <https://www.shinnytech.com/tqsdk_professional/>`_ 申请试用或购买
Example::
from tqsdk import TqApi, TqAuth, TqKqStock, TqChan
tq_kq_stock = TqKqStock()
api = TqApi(account=tq_kq_stock, auth=TqAuth("信易账户", "账户密码"))
quote = api.get_quote("SSE.688529")
print(quote)
# 下单限价单
order = api.insert_order("SSE.688529", volume=200, direction="BUY", limit_price=quote.ask_price1)
while order.status == 'ALIVE':
api.wait_update()
print(order) # 打印委托单信息
print(api.get_account()) # 打印快期股票模拟账户信息
print(api.get_position("SSE.688529")) # 打印持仓信息
for trade in order.trade_records.values():
print(trade) # 打印委托单对应的成交信息
api.close()
"""
super().__init__("快期股票模拟", "", "", td_url=td_url, account_type="SPOT")
211 changes: 106 additions & 105 deletions tqsdk/api.py

Large diffs are not rendered by default.

5 changes: 1 addition & 4 deletions tqsdk/backtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,10 +417,7 @@ async def _ensure_serial(self, ins, dur, chart_id=None):

async def _ensure_query(self, pack):
"""一定收到了对应 query 返回的包"""
query_pack = {
"query": pack["query"],
"variables": pack["variables"].copy()
}
query_pack = {"query": pack["query"]}
if query_pack.items() <= self._data.get("symbols", {}).get(pack["query_id"], {}).items():
return
async with TqChan(self._api, last_only=True) as update_chan:
Expand Down
Loading

0 comments on commit d08cbee

Please sign in to comment.