diff --git a/PKG-INFO b/PKG-INFO index c2d115d3..05014de8 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -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 diff --git a/doc/conf.py b/doc/conf.py index 95fcf2a3..6b887c09 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -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. diff --git a/doc/usage/mddatas.rst b/doc/usage/mddatas.rst index 69c7e80b..49d11091 100644 --- a/doc/usage/mddatas.rst +++ b/doc/usage/mddatas.rst @@ -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期权 + **注意:并非所有合约都是可交易合约.** diff --git a/doc/version.rst b/doc/version.rst index cb31bcb9..894462ce 100644 --- a/doc/version.rst +++ b/doc/version.rst @@ -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 两种类型 diff --git a/setup.py b/setup.py index 7b3ce9db..ad8764d5 100644 --- a/setup.py +++ b/setup.py @@ -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='tianqincn@gmail.com', diff --git a/tqsdk/__version__.py b/tqsdk/__version__.py index 2c98f2ed..b831b858 100644 --- a/tqsdk/__version__.py +++ b/tqsdk/__version__.py @@ -1 +1 @@ -__version__ = '3.2.11' +__version__ = '3.2.12' diff --git a/tqsdk/api.py b/tqsdk/api.py index 6324de09..510c8aee 100644 --- a/tqsdk/api.py +++ b/tqsdk/api.py @@ -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): [必填] 标的价格,该价格用户输入可以是任意值,例如合约最新价,最高价,开盘价等然后以该值去对比实值/虚值/平值期权 @@ -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'") diff --git a/tqsdk/data_series.py b/tqsdk/data_series.py index 41f22185..5f4328f5 100644 --- a/tqsdk/data_series.py +++ b/tqsdk/data_series.py @@ -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]): diff --git a/tqsdk/lib/target_pos_task.py b/tqsdk/lib/target_pos_task.py index dfac805b..309ccb0b 100644 --- a/tqsdk/lib/target_pos_task.py +++ b/tqsdk/lib/target_pos_task.py @@ -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: diff --git a/tqsdk/objs_not_entity.py b/tqsdk/objs_not_entity.py index 057ee949..a7c81768 100644 --- a/tqsdk/objs_not_entity.py +++ b/tqsdk/objs_not_entity.py @@ -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__()