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

RQAlpha==5.3.7 #855

Merged
merged 12 commits into from
Mar 7, 2024
13 changes: 7 additions & 6 deletions rqalpha/data/base_data_source/storages.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
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
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

[metadata]
name = rqalpha
version = 5.3.6
version = 5.3.7

[versioneer]
VCS = git
Expand Down
Loading