Skip to content

Commit

Permalink
fix #148
Browse files Browse the repository at this point in the history
  • Loading branch information
Cuizi7 committed Jun 29, 2017
1 parent 5edff36 commit 9592e4a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions docs/source/api/extend_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ get_dividend - 分红数据
:param date: 查询日期,默认为策略当前日期。如指定,则应保证该日期不晚于策略当前日期
:type date: `str` | `date` | `datetime` | `pandas.Timestamp`

:return: `pandas.DataFrame` - 查询时间段内某个股票的分红数据
:return: `numpy.ndarray` - 查询时间段内某个股票的分红数据

* declaration_announcement_date: 分红宣布日,上市公司一般会提前一段时间公布未来的分红派息事件
* book_closure_date: 股权登记日
Expand All @@ -408,12 +408,12 @@ get_dividend - 分红数据
get_dividend('000001.XSHE', start_date='20130104')
#[Out]
# book_closure_date dividend_cash_before_tax \
#declaration_announcement_date
#2013-06-14 2013-06-19 0.9838
# ex_dividend_date payable_date round_lot
#declaration_announcement_date
#2013-06-14 2013-06-20 2013-06-20 10.0
#array([(20130614, 20130619, 20130620, 20130620, 1.7 , 10),
# (20140606, 20140611, 20140612, 20140612, 1.6 , 10),
# (20150407, 20150410, 20150413, 20150413, 1.74, 10),
# (20160608, 20160615, 20160616, 20160616, 1.53, 10)],
# dtype=[('announcement_date', '<u4'), ('book_closure_date', '<u4'), ('ex_dividend_date', '<u4'), ('payable_date', '<u4'), ('dividend_cash_before_tax', '<f8'), ('round_lot', '<u4')])
get_split - 拆分数据
------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions rqalpha/api/api_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -760,13 +760,13 @@ def get_dividend(order_book_id, start_date, *args, **kwargs):
start_date, dt
))
order_book_id = assure_order_book_id(order_book_id)
df = env.data_proxy.get_dividend(order_book_id)
if df is None:
array = env.data_proxy.get_dividend(order_book_id)
if array is None:
return None

sd = start_date.year * 10000 + start_date.month * 100 + start_date.day
ed = dt.year * 10000 + dt.month * 100 + dt.day
return df[(df['announcement_date'] >= sd) & (df['announcement_date'] <= ed)]
return array[(array['announcement_date'] >= sd) & (array['announcement_date'] <= ed)]


@export_as_api
Expand Down

0 comments on commit 9592e4a

Please sign in to comment.