Skip to content

Commit

Permalink
Merge pull request #909 from ricequant/RQSDK-767
Browse files Browse the repository at this point in the history
benchmark support NULL
  • Loading branch information
Cuizi7 authored Dec 27, 2024
2 parents 48b4e51 + 1f962fb commit 18b8e9c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions rqalpha/mod/rqalpha_mod_sys_analyser/mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def start_up(self, env, mod_config):
self._plot_store = PlotStore(env)
export_as_api(self._plot_store.plot)

NULL_OID = "null"
NULL_OID = {"null", "NULL"}

def generate_benchmark_daily_returns_and_portfolio(self, event):
_s = self._env.config.base.start_date
Expand All @@ -131,7 +131,7 @@ def generate_benchmark_daily_returns_and_portfolio(self, event):
self._benchmark_daily_returns = np.zeros(len(trading_dates))
weights = 0
for order_book_id, weight in self._benchmark:
if order_book_id == self.NULL_OID:
if order_book_id in self.NULL_OID:
daily_returns = np.zeros(len(trading_dates))
else:
ins = self._env.data_proxy.instrument(order_book_id)
Expand Down Expand Up @@ -353,7 +353,7 @@ def tear_down(self, code, exception=None):
summary["benchmark_symbol"] = self._env.data_proxy.instrument(benchmark_obid).symbol
else:
summary["benchmark"] = ",".join(f"{o}:{w}" for o, w in self._benchmark)
summary["benchmark_symbol"] = ",".join(f"{self._env.data_proxy.instrument(o).symbol if o != self.NULL_OID else 'null'}:{w}" for o, w in self._benchmark)
summary["benchmark_symbol"] = ",".join(f"{self._env.data_proxy.instrument(o).symbol if o not in self.NULL_OID else 'null'}:{w}" for o, w in self._benchmark)

risk_free_rate = data_proxy.get_risk_free_rate(self._env.config.base.start_date, self._env.config.base.end_date)
risk = Risk(
Expand Down

0 comments on commit 18b8e9c

Please sign in to comment.