Skip to content

Commit 22a07b1

Browse files
committed
financal report api add param begin/end
1 parent b5e830d commit 22a07b1

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

tigeropen/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
55
@author: gaoan
66
"""
7-
__VERSION__ = '2.1.8'
7+
__VERSION__ = '2.1.9'

tigeropen/fundamental/request/model.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ def __init__(self):
9191
self._market = None
9292
self._fields = None
9393
self._period_type = None
94+
self._begin_date = None
95+
self._end_date = None
9496

9597
@property
9698
def symbols(self):
@@ -124,6 +126,22 @@ def period_type(self):
124126
def period_type(self, value):
125127
self._period_type = value
126128

129+
@property
130+
def begin_date(self):
131+
return self._begin_date
132+
133+
@begin_date.setter
134+
def begin_date(self, value):
135+
self._begin_date = value
136+
137+
@property
138+
def end_date(self):
139+
return self._end_date
140+
141+
@end_date.setter
142+
def end_date(self, value):
143+
self._end_date = value
144+
127145
def to_openapi_dict(self):
128146
params = super().to_openapi_dict()
129147

@@ -139,6 +157,12 @@ def to_openapi_dict(self):
139157
if self.period_type:
140158
params['period_type'] = self.period_type
141159

160+
if self.begin_date:
161+
params['begin_date'] = self.begin_date
162+
163+
if self.end_date:
164+
params['end_date'] = self.end_date
165+
142166
return params
143167

144168

tigeropen/quote/quote_client.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1232,14 +1232,16 @@ def get_financial_daily(self, symbols, market, fields, begin_date, end_date):
12321232
else:
12331233
raise ApiException(response.code, response.message)
12341234

1235-
def get_financial_report(self, symbols, market, fields, period_type):
1235+
def get_financial_report(self, symbols, market, fields, period_type, begin_date=None, end_date=None):
12361236
"""
12371237
获取财报数据
12381238
:param symbols:
12391239
:param market: 查询的市场. 可选的值为 common.consts.Market 枚举类型, 如 Market.US
12401240
:param fields: 查询的字段列表. 可选的项为 common.consts 下的 Income, Balance, CashFlow, BalanceSheetRatio,
12411241
Growth, Leverage, Profitability 枚举类型. 如 Income.total_revenue
12421242
:param period_type: 查询的周期类型. 可选的值为 common.consts.FinancialReportPeriodType 枚举类型
1243+
:param begin_date: specify range begin of period_end_date
1244+
:param end_date: specify range end of period_end_date
12431245
:return: pandas.DataFrame, 各 column 的含义如下:
12441246
symbol: 证券代码
12451247
currency: 财报使用的币种
@@ -1254,6 +1256,8 @@ def get_financial_report(self, symbols, market, fields, period_type):
12541256
params.fields = [get_enum_value(field) for field in fields]
12551257
params.period_type = get_enum_value(period_type)
12561258
params.lang = get_enum_value(self._lang)
1259+
params.begin_date = date_str_to_timestamp(begin_date, self._timezone)
1260+
params.end_date = date_str_to_timestamp(end_date, self._timezone)
12571261
request = OpenApiRequest(FINANCIAL_REPORT, biz_model=params)
12581262
response_content = self.__fetch_data(request)
12591263
if response_content:

0 commit comments

Comments
 (0)