Skip to content

Commit

Permalink
Update Version 3.2.12
Browse files Browse the repository at this point in the history
  • Loading branch information
shinny-pack authored and shinny-mayanqiong committed Oct 21, 2022
1 parent 8446a3b commit 4548361
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 20 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.11
Version: 3.2.12
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.11'
version = u'3.2.12'
# The full version, including alpha/beta/rc tags.
release = u'3.2.11'
release = u'3.2.12'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
19 changes: 13 additions & 6 deletions doc/usage/mddatas.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,19 @@ SZSE 深圳证券交易所
SSE.000300 - 沪深300指数
SSE.000905 - 中证500指数
SSE.000852 - 中证1000指数
SSE.510050 - 上交所上证50etf
SSE.510300 - 上交所沪深300etf
SZSE.159919 - 深交所沪深300etf
SSE.10002513 - 上交所上证50etf期权
SSE.10002504 - 上交所沪深300etf期权
SZSE.90000097 - 深交所沪深300etf期权
SSE.510050 - 上交所上证50ETF
SSE.510300 - 上交所沪深300ETF
SZSE.159919 - 深交所沪深300ETF
SSE.10002513 - 上交所上证50ETF期权
SSE.10002504 - 上交所沪深300ETF期权
SZSE.90000097 - 深交所沪深300ETF期权
SZSE.159915 - 易方达创业板ETF
SZSE.90001277 - 创业板ETF期权
SZSE.159922 - 深交所中证500ETF
SZSE.90001355 - 深交所中证500ETF期权
SSE.510500 - 上交所中证500ETF
SSE.10004497 - 上交所中证500ETF期权



**注意:并非所有合约都是可交易合约.**
Expand Down
6 changes: 6 additions & 0 deletions doc/version.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

版本变更
=============================
3.2.12 (2022/10/20)

* 优化: :py:meth:`~tqsdk.TqApi.query_all_level_finance_options` 增加 ETF 期权标的,文档补充完整 ETF 基金名称
* docs:修正文档,添加上交所和深交所中证1000ETF和深交所创业板ETF代码示例


3.2.11 (2022/07/27)

* 增加:下载数据时 csv_file_name 参数支持 str / asyncio.StreamWriter 两种类型
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.11",
version="3.2.12",
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.11'
__version__ = '3.2.12'
11 changes: 7 additions & 4 deletions tqsdk/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2877,9 +2877,12 @@ def query_all_level_finance_options(self, underlying_symbol, underlying_price, o
Args:
underlying_symbol (str): [必填] 标的合约 (针对 ETF 期权和股指期权,只支持以下几个合约)
* "SSE.000300" 为中金所股指期权标的
* "SSE.510050" 为上交所上证 50 ETF 期权标的
* "SSE.510300" 为上交所上证 300 ETF 期权标的
* "SZSE.159919" 为深交所沪深 300 ETF 期权标的
* "SSE.510050" 为上交所华夏上证 50 ETF 期权标的
* "SSE.510300" 为上交所华泰柏瑞沪深 300 ETF 期权标的
* "SZSE.159919" 为深交所嘉实沪深 300 ETF 期权标的
* "SZSE.159915" 为深交所易方达创业板 ETF 期权标的
* "SZSE.159922" 为深交所嘉实中证 500 ETF 期权标的
* "SSE.510500" 为上交所南方中证 500 ETF 期权标的
underlying_price (float): [必填] 标的价格,该价格用户输入可以是任意值,例如合约最新价,最高价,开盘价等然后以该值去对比实值/虚值/平值期权
Expand Down Expand Up @@ -2936,7 +2939,7 @@ def query_all_level_finance_options(self, underlying_symbol, underlying_price, o
"""
if self._stock is False:
raise Exception("期货行情系统(_stock = False)不支持当前接口调用")
if underlying_symbol not in ["SSE.000300", "SSE.510050", "SSE.510300", "SZSE.159919"]:
if underlying_symbol not in ["SSE.000300", "SSE.510050", "SSE.510300", "SZSE.159919", "SZSE.159915", "SZSE.159922", "SSE.510500"]:
raise Exception("不支持的标的合约")
if option_class not in ['CALL', 'PUT']:
raise Exception("option_class 参数错误,option_class 必须是 'CALL' 或者 'PUT'")
Expand Down
3 changes: 2 additions & 1 deletion tqsdk/data_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ async def _run(self):
factor = factor_df.iloc[i].factor
adj_cols = DataSeries._get_adj_cols(symbol, self._dur_nano)
lt = self.df["datetime"].lt(dt)
self.df.loc[lt, adj_cols] = self.df.loc[lt, adj_cols] * factor
for col in adj_cols:
self.df.loc[lt, col] = self.df.loc[lt, col] * factor
if self._adj_type == "B":
# 正序循环 factor_df, 对于大于等于当前 factor_df[datetime] 的行 乘以 1 / factor_df[factor]
for i in range(factor_df.shape[0]):
Expand Down
2 changes: 1 addition & 1 deletion tqsdk/lib/target_pos_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def get_price(direction):
def get_price_by_quote(quote):
def get_price(direction):
# 在 BUY 时使用买一价加一档价格,SELL 时使用卖一价减一档价格
# 在 BUY 时使用涨停价,SELL 时使用跌停价
if direction == "BUY":
price = quote["upper_limit"]
else:
Expand Down
6 changes: 3 additions & 3 deletions tqsdk/objs_not_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,14 +279,14 @@ def _quotes_to_dataframe(self, quotes):
for col in self.__dict__["_columns"]:
if col == "expire_rest_days":
current_dt = self._api._get_current_datetime().timestamp()
self.loc[:, col] = [_get_expire_rest_days(quotes[s]['expire_datetime'], current_dt)
self[col] = [_get_expire_rest_days(quotes[s]['expire_datetime'], current_dt)
if quotes[s].get('expire_datetime') else float('nan')
for s in self.__dict__["_symbol_list"]]
elif col == "trading_time_day" or col == "trading_time_night":
k = 'day' if col == "trading_time_day" else 'night'
self.loc[:, col] = Series([self._get_trading_time(quotes, s, k) for s in self.__dict__["_symbol_list"]])
self[col] = Series([self._get_trading_time(quotes, s, k) for s in self.__dict__["_symbol_list"]])
else:
self.loc[:, col] = Series([quotes[s].get(col, default_quote[col]) for s in self.__dict__["_symbol_list"]])
self[col] = Series([quotes[s].get(col, default_quote[col]) for s in self.__dict__["_symbol_list"]])

def __await__(self):
return self.__dict__["_task"].__await__()
Expand Down

0 comments on commit 4548361

Please sign in to comment.