Skip to content

Commit fde8536

Browse files
committed
Raise missingData in pandlCalculateAndStore.get_list_of_perc_pandl_series_for_strategy_all_instruments
1 parent 49789e9 commit fde8536

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

sysproduction/reporting/data/pandl.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,11 @@ def _get_pandl_for_instrument_across_contracts(
222222

223223
def get_period_perc_pandl_for_strategy_in_date_range(self, strategy_name: str):
224224
print("Getting p&l for %s" % strategy_name)
225-
pandl_df = self.get_df_of_perc_pandl_series_for_strategy_all_instruments(
226-
strategy_name
227-
)
228-
229-
if pandl_df is missing_data:
225+
try:
226+
pandl_df = self.get_df_of_perc_pandl_series_for_strategy_all_instruments(
227+
strategy_name
228+
)
229+
except missingData:
230230
return 0.0
231231

232232
pandl_df = pandl_df[self.start_date : self.end_date]
@@ -245,9 +245,6 @@ def get_df_of_perc_pandl_series_for_strategy_all_instruments(
245245
strategy_name
246246
)
247247

248-
if instrument_list is missing_data:
249-
return missing_data
250-
251248
pandl_df = pd.concat(pandl_list, axis=1)
252249
pandl_df.columns = instrument_list
253250

@@ -260,7 +257,7 @@ def get_list_of_perc_pandl_series_for_strategy_all_instruments(
260257
self.data, strategy_name
261258
)
262259
if len(instrument_list) == 0:
263-
return missing_data, missing_data
260+
raise missingData
264261

265262
pandl_list = [
266263
self.perc_pandl_series_for_strategy_instrument_vs_total_capital(

0 commit comments

Comments
 (0)