Skip to content

Commit

Permalink
Update Version 3.2.10
Browse files Browse the repository at this point in the history
  • Loading branch information
shinny-pack authored and shinny-mayanqiong committed Jul 20, 2022
1 parent 6b51b4e commit 41ee293
Show file tree
Hide file tree
Showing 13 changed files with 79 additions and 15 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: 3.2.9
Version: 3.2.10
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'3.2.9'
version = u'3.2.10'
# The full version, including alpha/beta/rc tags.
release = u'3.2.9'
release = u'3.2.10'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
3 changes: 2 additions & 1 deletion doc/usage/mddatas.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
----------------------------------------------------
TqSdk中的合约代码, 统一采用 交易所代码.交易所内品种代码 的格式. 交易所代码为全大写字母, 交易所内品种代码的大小写规范, 遵从交易所规定, 大小写敏感.

其中 TqSdk 免费版本提供全部的期货、商品/金融期权和上证50、沪深300和中证500的实时行情
其中 TqSdk 免费版本提供全部的期货、商品/金融期权和上证50、沪深300、中证500和中证1000的实时行情

购买或申请 TqSdk 专业版试用后可提供A股股票的实时和历史行情,具体免费版和专业版的区别,请点击 `天勤量化专业版 <https://www.shinnytech.com/tqsdk_professional/>`_

Expand Down Expand Up @@ -54,6 +54,7 @@ SZSE 深圳证券交易所
SSE.000016 - 上证50指数
SSE.000300 - 沪深300指数
SSE.000905 - 中证500指数
SSE.000852 - 中证1000指数
SSE.510050 - 上交所上证50etf
SSE.510300 - 上交所沪深300etf
SZSE.159919 - 深交所沪深300etf
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.2.10 (2022/07/20)

* 增加:增加中证 1000 指数,免费用户可获取该指数行情,参考文档 :ref:`mddatas`
* 修复:回测中没有正常更新 quotes 下的 expire_rest_days 字段的问题
* 修复:回测 web_gui 图表没有显示成交标注、持仓线的问题


3.2.9 (2022/07/07)

* 增加:下载 tick 数据时增加 average 列
Expand Down
2 changes: 1 addition & 1 deletion 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="3.2.9",
version="3.2.10",
description='TianQin SDK',
author='TianQin',
author_email='[email protected]',
Expand Down
2 changes: 1 addition & 1 deletion tqsdk/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '3.2.9'
__version__ = '3.2.10'
2 changes: 1 addition & 1 deletion tqsdk/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def _has_md_grants(self, symbol):
continue
elif symbol.split('.', 1)[0] in ["SSE", "SZSE"] and self._has_feature("sec"):
continue
elif symbol in ["SSE.000016", "SSE.000300", "SSE.000905"] and self._has_feature("lmt_idx"):
elif symbol in ["SSE.000016", "SSE.000300", "SSE.000905", "SSE.000852"] and self._has_feature("lmt_idx"):
continue
else:
raise Exception(f"您的账户不支持查看 {symbol} 的行情数据,需要购买专业版本后使用。升级网址:https://account.shinnytech.com")
Expand Down
14 changes: 10 additions & 4 deletions tqsdk/data_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ class DataExtension(object):

def __init__(self, api):
self._api = api
self._data = {'trade': {}} # 数据截面, 现在的功能只需要记录 trade
self._data = {
'trade': {},
'quotes': {} # 记录 quotes 的 expire_datetime,并不是每一次 diff 更新都会重新发送 expire_datetime,重新 expire_rest_days 时需要这个信息
} # 数据截面, 现在的功能只需要记录 trade
self._diffs = []
self._diffs_paths = set()
self._prototype = {
Expand Down Expand Up @@ -109,6 +112,11 @@ async def _md_recv(self, pack):
"""将行情数据和交易数据合并至 self._data """
for d in pack.get("data", []):
self._datetime_state.update_state(d)
if d.get('quotes', None):
_simple_merge_diff(
result=self._data['quotes'],
diff=d['quotes']
)
if d.get('trade', None):
_simple_merge_diff_and_collect_paths(
result=self._data['trade'],
Expand Down Expand Up @@ -160,9 +168,7 @@ def _generate_ext_diff(self):

def _update_quotes(self, diff):
for symbol in diff['quotes']:
if not _is_key_exist(diff, path=['quotes', symbol], key=['expire_datetime']):
continue
expire_datetime = diff['quotes'][symbol]['expire_datetime']
expire_datetime = self._data['quotes'].get(symbol, {}).get('expire_datetime', None)
if expire_datetime and expire_datetime == expire_datetime: # 排除 None 和 nan
# expire_rest_days 距离到期日的剩余天数(自然日天数),正数表示距离到期日的剩余天数,0表示到期日当天,负数表示距离到期日已经过去的天数
# 直接修改在 diff 里面的数据,当 diffs 里有多个对同个合约的修改时,保持数据截面的一致
Expand Down
1 change: 0 additions & 1 deletion tqsdk/objs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import json
import warnings

from tqsdk.datetime import _get_expire_rest_days
from tqsdk.diff import _get_obj
from tqsdk.entity import Entity
from tqsdk.utils import _query_for_init, _generate_uuid
Expand Down
4 changes: 2 additions & 2 deletions tqsdk/web/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><!--[if IE]><link rel="icon" href="web/favicon.ico"><![endif]--><title>tqsdk-python-web</title><link href="web/css/app.d72d8978.css" rel="preload" as="style"><link href="web/css/chunk-vendors.c93e9127.css" rel="preload" as="style"><link href="web/js/app.fc01ac28.js" rel="preload" as="script"><link href="web/js/chunk-vendors.d7fceff6.js" rel="preload" as="script"><link href="web/css/chunk-vendors.c93e9127.css" rel="stylesheet"><link href="web/css/app.d72d8978.css" rel="stylesheet"><link rel="icon" type="image/png" sizes="32x32" href="web/img/icons/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="web/img/icons/favicon-16x16.png"><link rel="manifest" href="web/manifest.json"><meta name="theme-color" content="#4DBA87"><meta name="apple-mobile-web-app-capable" content="no"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="tqsdk-python-web"><link rel="apple-touch-icon" href="web/img/icons/apple-touch-icon-152x152.png"><link rel="mask-icon" href="web/img/icons/safari-pinned-tab.svg" color="#4DBA87"><meta name="msapplication-TileImage" content="web/img/icons/msapplication-icon-144x144.png"><meta name="msapplication-TileColor" content="#000000"></head><body><noscript><strong>We're sorry but tqsdk web doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><script>const TqsdkAddress = location.host
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><!--[if IE]><link rel="icon" href="web/favicon.ico"><![endif]--><title>tqsdk-python-web</title><link href="web/css/app.d72d8978.css" rel="preload" as="style"><link href="web/css/chunk-vendors.c93e9127.css" rel="preload" as="style"><link href="web/js/app.2c843c86.js" rel="preload" as="script"><link href="web/js/chunk-vendors.d7fceff6.js" rel="preload" as="script"><link href="web/css/chunk-vendors.c93e9127.css" rel="stylesheet"><link href="web/css/app.d72d8978.css" rel="stylesheet"><link rel="icon" type="image/png" sizes="32x32" href="web/img/icons/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="web/img/icons/favicon-16x16.png"><link rel="manifest" href="web/manifest.json"><meta name="theme-color" content="#4DBA87"><meta name="apple-mobile-web-app-capable" content="no"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="tqsdk-python-web"><link rel="apple-touch-icon" href="web/img/icons/apple-touch-icon-152x152.png"><link rel="mask-icon" href="web/img/icons/safari-pinned-tab.svg" color="#4DBA87"><meta name="msapplication-TileImage" content="web/img/icons/msapplication-icon-144x144.png"><meta name="msapplication-TileColor" content="#000000"></head><body><noscript><strong>We're sorry but tqsdk web doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><script>const TqsdkAddress = location.host
const FetchUrl = '/url'</script><script>const GetTqsdkUrl = function () {
return new Promise(function (resolve, reject) {
fetch(FetchUrl).then(function(response) {
Expand All @@ -7,4 +7,4 @@
})
});
})
}</script><div id="app"></div><script src="web/js/chunk-vendors.d7fceff6.js"></script><script src="web/js/app.fc01ac28.js"></script></body></html>
}</script><div id="app"></div><script src="web/js/chunk-vendors.d7fceff6.js"></script><script src="web/js/app.2c843c86.js"></script></body></html>
1 change: 1 addition & 0 deletions tqsdk/web/js/app.2c843c86.js

Large diffs are not rendered by default.

50 changes: 50 additions & 0 deletions tqsdk/web/precache-manifest.7ed60b69dab01cdb0c64836489ab6e0d.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
self.__precacheManifest = (self.__precacheManifest || []).concat([
{
"revision": "bdb3edcf9a8b75004898",
"url": "web/css/app.d72d8978.css"
},
{
"revision": "444d46da73e61093ed76",
"url": "web/css/chunk-vendors.c93e9127.css"
},
{
"revision": "82cf43358c1d5de3b328f77464ef3d42",
"url": "web/d3.min.js"
},
{
"revision": "143146fa24554ae2c5ac0a3982abb952",
"url": "web/fonts/ionicons.143146fa.woff2"
},
{
"revision": "99ac3308dd8ee14f749f51538d0d5b9e",
"url": "web/fonts/ionicons.99ac3308.woff"
},
{
"revision": "d535a25a79fb1365ae814b61e88fae71",
"url": "web/fonts/ionicons.d535a25a.ttf"
},
{
"revision": "a2c4a261a239aa84463dc70e4bac9b9a",
"url": "web/img/ionicons.a2c4a261.svg"
},
{
"revision": "be353b15878098c0796b790ddb8d2977",
"url": "web/index.html"
},
{
"revision": "bdb3edcf9a8b75004898",
"url": "web/js/app.2c843c86.js"
},
{
"revision": "444d46da73e61093ed76",
"url": "web/js/chunk-vendors.d7fceff6.js"
},
{
"revision": "260485a0902e994592bfde307cd2874e",
"url": "web/manifest.json"
},
{
"revision": "b6216d61c03e6ce0c9aea6ca7808f7ca",
"url": "web/robots.txt"
}
]);
2 changes: 1 addition & 1 deletion tqsdk/web/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");

importScripts(
"web/precache-manifest.6648e5db468eb9b65c97bc6d385e4143.js"
"web/precache-manifest.7ed60b69dab01cdb0c64836489ab6e0d.js"
);

workbox.core.setCacheNameDetails({prefix: "tqsdk-python-web"});
Expand Down

0 comments on commit 41ee293

Please sign in to comment.