Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rqsdk 727 #852

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion rqalpha/data/bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
8 changes: 6 additions & 2 deletions rqalpha/mod/rqalpha_mod_sys_accounts/position_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down