Skip to content

Commit

Permalink
Update Version 3.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
shinny-pack authored and shinny-mayanqiong committed Apr 24, 2023
1 parent 4548361 commit 48c48f6
Show file tree
Hide file tree
Showing 15 changed files with 324 additions and 175 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.12
Version: 3.4.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'3.2.12'
version = u'3.4.0'
# The full version, including alpha/beta/rc tags.
release = u'3.2.12'
release = u'3.4.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
28 changes: 17 additions & 11 deletions doc/usage/mddatas.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,29 @@ KQ 快期 (所有主连合约, 指数都归属在这里)
SSWE 上期所仓单
SSE 上海证券交易所
SZSE 深圳证券交易所
GFEX 广州期货交易所
================== ====================================================================

一些合约代码示例::

SHFE.cu1901 - 上期所 cu1901 期货合约
DCE.m1901 - 大商所 m1901 期货合约
CZCE.SR901 - 郑商所 SR901 期货合约
CFFEX.IF1901 - 中金所 IF1901 期货合约
INE.sc2109 - 上期能源 sc2109 期货合约
SHFE.cu1901 - 上期所 cu1901 期货合约
DCE.m1901 - 大商所 m1901 期货合约
CZCE.SR901 - 郑商所 SR901 期货合约
CFFEX.IF1901 - 中金所 IF1901 期货合约
INE.sc2109 - 上期能源 sc2109 期货合约
GFEX.si2301 - 广期所 si2301 期货合约

CZCE.SPD SR901&SR903 - 郑商所 SR901&SR903 跨期合约
DCE.SP a1709&a1801 - 大商所 a1709&a1801 跨期合约
CZCE.SPD SR901&SR903 - 郑商所 SR901&SR903 跨期合约
DCE.SP a1709&a1801 - 大商所 a1709&a1801 跨期合约
GFEX.SP si2308&si2309 - 广期所 si2308&si2309 跨期组合

DCE.m1807-C-2450 - 大商所豆粕期权
CZCE.CF003C11000 - 郑商所棉花期权
SHFE.au2004C308 - 上期所黄金期权
DCE.m1807-C-2450 - 大商所豆粕期权
CZCE.CF003C11000 - 郑商所棉花期权
SHFE.au2004C308 - 上期所黄金期权
CFFEX.IO2002-C-3550 - 中金所沪深300股指期权
INE.sc2109C450 - 上期能源原油期权
INE.sc2109C450 - 上期能源原油期权
GFEX.si2308-C-5800 - 广期所硅期权


[email protected] - 中金所IF品种主连合约
[email protected] - 上期所bu品种指数
Expand All @@ -67,6 +72,7 @@ SZSE 深圳证券交易所
SZSE.90001355 - 深交所中证500ETF期权
SSE.510500 - 上交所中证500ETF
SSE.10004497 - 上交所中证500ETF期权
SZSE.159901 - 深交所100ETF



Expand Down
9 changes: 9 additions & 0 deletions doc/version.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

版本变更
=============================
3.4.0 (2023/04/13)

* 增加:支持国密连接,可以在 :py:meth:`~tqsdk.TqAccount` 构造时指定 sm 参数为 True 来启用.
当启用国密时仅支持: win7 或以上, ubuntu 22.04 或以上, debian 12 或以上

3.3.0 (2022/11/22)

* 增加:支持广州期货交易所 GFEX,如果用户需要交易广期所合约需要升级到此版本以上

3.2.12 (2022/10/20)

* 优化: :py:meth:`~tqsdk.TqApi.query_all_level_finance_options` 增加 ETF 期权标的,文档补充完整 ETF 基金名称
Expand Down
36 changes: 3 additions & 33 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,22 @@

import setuptools

# from py-spy/setup.py
try:
from wheel.bdist_wheel import bdist_wheel as _bdist_wheel, get_platform

class bdist_wheel(_bdist_wheel):

def finalize_options(self):
_bdist_wheel.finalize_options(self)
# Mark us as not a pure python package (we have platform specific ctpse lib)
if self.plat_name != "any":
self.root_is_pure = False
plat_name = (self.plat_name or get_platform()).replace('-', '_').replace('.', '_')
if plat_name == "linux_x86_64" or plat_name == "manylinux1_x86_64":
self.distribution.package_data[""] = ["ctpse/LinuxDataCollect64.so"]
elif plat_name == "win32":
self.distribution.package_data[""] = ["ctpse/WinDataCollect32.dll"]
elif plat_name == "win_amd64":
self.distribution.package_data[""] = ["ctpse/WinDataCollect64.dll"]

def get_tag(self):
# this set's us up to build generic wheels.
python, abi, plat = _bdist_wheel.get_tag(self)
# We don't contain any python source
python, abi = 'py3', 'none'
return python, abi, plat
except ImportError:
bdist_wheel = None

with open("README.md", mode="r", encoding='utf-8') as fh:
long_description = fh.read()

setuptools.setup(
name='tqsdk',
version="3.2.12",
version="3.4.0",
description='TianQin SDK',
author='TianQin',
author_email='[email protected]',
long_description=long_description,
long_description_content_type="text/markdown",
url='https://www.shinnytech.com/tqsdk',
packages=setuptools.find_packages(),
zip_safe=False,
packages=setuptools.find_packages(exclude=["tqsdk.test", "tqsdk.test.*"]),
python_requires='>=3.6.4',
install_requires=["websockets>=8.1", "requests", "numpy", "pandas>=1.1.0", "scipy", "simplejson", "aiohttp",
"certifi", "pyjwt", "psutil", "shinny_structlog", "sgqlc", "filelock"],
cmdclass={'bdist_wheel': bdist_wheel},
"certifi", "pyjwt", "psutil", "shinny_structlog", "sgqlc", "filelock", "tqsdk_ctpse", "tqsdk_sm"],
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: Apache Software License",
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.12'
__version__ = '3.4.0'
4 changes: 3 additions & 1 deletion tqsdk/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ def get_quote(self, symbol: str) -> Quote:
* INE: 能源交易所(原油)
* SSE: 上交所
* SZSE: 深交所
* GFEX: 广期所
Example1::
Expand Down Expand Up @@ -449,6 +450,7 @@ def get_quote_list(self, symbols: List[str]) -> QuoteList:
* INE: 能源交易所(原油)
* SSE: 上交所
* SZSE: 深交所
* GFEX: 广期所
Example::
Expand Down Expand Up @@ -1201,7 +1203,7 @@ def insert_order(self, symbol: str, direction: str, offset: str = "", volume: in
Example4::
# 多账户模式下, 使用不同期货公司交易账户进行下单操作
# 多账户模式下, 分别获取各账户的成交记录
from tqsdk import TqApi, TqAuth, TqMultiAccount
account1 = TqAccount("H海通期货", "123456", "123456")
Expand Down
6 changes: 3 additions & 3 deletions tqsdk/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def _get_td_url(self, broker_id, account_id):
if "TQ" not in broker_list[broker_id]["category"]:
raise Exception(f"该期货公司 - {broker_id} 暂不支持 TqSdk 登录,请联系期货公司。")

return broker_list[broker_id]["url"], broker_list[broker_id].get('broker_type', 'FUTURE')
return broker_list[broker_id]["url"], broker_list[broker_id].get('broker_type', 'FUTURE'), broker_list[broker_id].get('smtype'), broker_list[broker_id].get('smconfig')

def _get_md_url(self, stock, backtest):
"""获取行情网关地址"""
Expand Down Expand Up @@ -148,7 +148,7 @@ def _has_account(self, account):
def _has_md_grants(self, symbol):
symbol_list = symbol if isinstance(symbol, list) else [symbol]
for symbol in symbol_list:
if symbol.split('.', 1)[0] in ["SHFE", "DCE", "CZCE", "INE", "CFFEX", "KQ", "SSWE"] and self._has_feature("futr"):
if symbol.split('.', 1)[0] in ["SHFE", "DCE", "CZCE", "INE", "CFFEX", "KQ", "SSWE", "GFEX"] and self._has_feature("futr"):
continue
elif symbol.split('.', 1)[0] in ["SSE", "SZSE"] and self._has_feature("sec"):
continue
Expand All @@ -162,6 +162,6 @@ def _has_td_grants(self, symbol):
# 对于 opt / cmb / adv 权限的检查由 OTG 做
if symbol.split('.', 1)[0] in ["SSE", "SZSE"] and self._has_feature("sec"):
return True
if symbol.split('.', 1)[0] in ["SHFE", "DCE", "CZCE", "INE", "CFFEX", "KQ"] and self._has_feature("futr"):
if symbol.split('.', 1)[0] in ["SHFE", "DCE", "CZCE", "INE", "CFFEX", "KQ", "GFEX"] and self._has_feature("futr"):
return True
raise Exception(f"您的账户不支持交易 {symbol},需要购买专业版本后使用。升级网址:https://account.shinnytech.com")
Loading

0 comments on commit 48c48f6

Please sign in to comment.