quantOS-org / JAQS

http://www.quantos.org/jaqs/
Other
616 stars 343 forks source link

class EventBacktestInstance中实现的问题 #33

Open semigodking opened 6 years ago

semigodking commented 6 years ago

函数_get_dividend_info()总是会被run()调用,而其实现只是针对股票。如果标的是期货的话,就不行了啊。

    def _get_dividend_info(self):
        """
        Query dividend information of stocks for use of daily settlement.

        """
        if self.ctx.data_api is not None:
            symbol_str = ','.join(self.ctx.universe)
            df, msg = self.ctx.data_api.query_dividend(symbol_str, start_date=self.start_date, end_date=self.end_date)
            df.loc[:, 'shares'] = (df['share_ratio'] + df['share_trans_ratio']) # / 10.0
            df.loc[:, 'cash_tax'] = df['cash_tax'] # / 10.0
            self.df_dividend = df
        else:
            # TODO
            pass