diff --git a/rqalpha/data/base_data_source/storages.py b/rqalpha/data/base_data_source/storages.py index 2998c04e4..56144971c 100644 --- a/rqalpha/data/base_data_source/storages.py +++ b/rqalpha/data/base_data_source/storages.py @@ -100,14 +100,15 @@ def get_future_info(self, order_book_id, underlying_symbol): def _to_namedtuple(self, info): # type: (dict) -> FuturesTradingParameters - info['long_margin_ratio'], info['short_margin_ratio'] = info['margin_rate'], info['margin_rate'] - del info['margin_rate'], info['tick_size'] + futures_info = copy(info) + futures_info['long_margin_ratio'], futures_info['short_margin_ratio'] = futures_info['margin_rate'], futures_info['margin_rate'] + del futures_info['margin_rate'], futures_info['tick_size'] try: - del info['order_book_id'] + del futures_info['order_book_id'] except KeyError: - del info['underlying_symbol'] - info = FuturesTradingParameters(**info) - return info + del futures_info['underlying_symbol'] + futures_info = FuturesTradingParameters(**futures_info) + return futures_info @lru_cache(8) def get_tick_size(self, instrument): diff --git a/rqalpha/data/bundle.py b/rqalpha/data/bundle.py index a9be5d559..91fcc63cd 100644 --- a/rqalpha/data/bundle.py +++ b/rqalpha/data/bundle.py @@ -519,10 +519,10 @@ def update_futures_trading_parameters(self, path, fields, end_date): if recreate_futures_list: self.generate_futures_trading_parameters(path, fields, last_date, recreate_futures_list=recreate_futures_list) if end_date > last_date: - system_log.info(_("Futures historical trading parameters data is being updated, please wait......")) if rqdatac.get_previous_trading_date(end_date) == last_date: return else: + system_log.info(_("Futures historical trading parameters data is being updated, please wait......")) start_date = rqdatac.get_next_trading_date(last_date) df = rqdatac.futures.get_trading_parameters(self._order_book_ids, start_date, end_date, fields) if not(df is None or df.empty): diff --git a/rqalpha/mod/rqalpha_mod_sys_accounts/position_model.py b/rqalpha/mod/rqalpha_mod_sys_accounts/position_model.py index f851bc9e6..ba97624f0 100644 --- a/rqalpha/mod/rqalpha_mod_sys_accounts/position_model.py +++ b/rqalpha/mod/rqalpha_mod_sys_accounts/position_model.py @@ -191,9 +191,13 @@ def _handle_dividend_payable(self, trading_date): round_lot = self._instrument.round_lot amount = int(Decimal(amount) / Decimal(round_lot)) * round_lot if amount > 0: - self.apply_trade(Trade.__from_create__( + account = self._env.get_account(self._order_book_id) + trade = Trade.__from_create__( None, last_price, amount, SIDE.BUY, POSITION_EFFECT.OPEN, self._order_book_id - )) + ) + trade._commission = self._env.get_trade_commission(trade) + trade._tax = self._env.get_trade_tax(trade) + self._env.event_bus.publish_event(Event(EVENT.TRADE, account=account, trade=trade, order=None)) return dividend_value - amount * last_price else: return dividend_value diff --git a/setup.cfg b/setup.cfg index bd44d6f9e..ef2c827f7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -5,7 +5,7 @@ [metadata] name = rqalpha -version = 5.3.6 +version = 5.3.7 [versioneer] VCS = git