def on_finish(self): last_year = str(now_pd_timestamp().year) codes = [item.code for item in self.entities] need_filleds = get_dividend_financing( provider=self.provider, codes=codes, return_type='domain', session=self.session, filters=[DividendFinancing.rights_raising_fund.is_(None)], end_timestamp=last_year) for item in need_filleds: df = get_rights_issue_detail( provider=self.provider, entity_id=item.entity_id, columns=[ RightsIssueDetail.timestamp, RightsIssueDetail.rights_raising_fund ], start_timestamp=item.timestamp, end_timestamp="{}-12-31".format(item.timestamp.year)) if df_is_not_null(df): item.rights_raising_fund = df['rights_raising_fund'].sum() self.session.commit() super().on_finish()
def test_000778_rights_issue_detail(): result = get_rights_issue_detail(session=session, provider='eastmoney', return_type='domain', codes=['000778'], end_timestamp='2018-09-30', order=RightsIssueDetail.timestamp.desc()) assert len(result) == 2 latest: RightsIssueDetail = result[0] assert latest.timestamp == to_pd_timestamp('2001-09-10') assert latest.rights_issues == 43570000 assert latest.rights_raising_fund == 492300000 assert latest.rights_issue_price == 11.3