File tree Expand file tree Collapse file tree 3 files changed +20
-17
lines changed
sysproduction/reporting/data Expand file tree Collapse file tree 3 files changed +20
-17
lines changed Original file line number Diff line number Diff line change @@ -287,9 +287,13 @@ def get_relative_pathname_from_list(path_as_list: List[str]) -> str:
287
287
paths_or_files = path_as_list [1 :]
288
288
289
289
if len (paths_or_files ) == 0 :
290
- directory_name_of_package = os .path .dirname (
291
- import_module (package_name ).__file__
292
- )
290
+ base_dir = os .getenv ("PYSYS_CODE" )
291
+ if base_dir is not None :
292
+ directory_name_of_package = os .path .join (base_dir , package_name )
293
+ else :
294
+ directory_name_of_package = os .path .dirname (
295
+ import_module (package_name ).__file__
296
+ )
293
297
return directory_name_of_package
294
298
295
299
last_item_in_list = path_as_list .pop ()
Original file line number Diff line number Diff line change 2
2
import pandas as pd
3
3
from dataclasses import dataclass
4
4
5
- from syscore .constants import named_object , missing_data
5
+ from syscore .constants import named_object
6
+ from syscore .exceptions import missingData
6
7
from sysdata .config .instruments import generate_matching_duplicate_dict
7
8
from sysdata .config .production_config import get_production_config
8
9
from sysproduction .reporting .data .constants import (
@@ -401,10 +402,11 @@ def get_data_for_markets(data):
401
402
def get_existing_bad_markets (data ):
402
403
production_config = data .config
403
404
404
- excluded_markets_config_element = production_config .get_element_or_missing_data (
405
- "exclude_instrument_lists"
406
- )
407
- if excluded_markets_config_element is missing_data :
405
+ try :
406
+ excluded_markets_config_element = production_config .get_element (
407
+ "exclude_instrument_lists"
408
+ )
409
+ except missingData :
408
410
print ("NO BAD MARKETS IN CONFIG!" )
409
411
existing_bad_markets = []
410
412
else :
Original file line number Diff line number Diff line change @@ -222,11 +222,11 @@ def _get_pandl_for_instrument_across_contracts(
222
222
223
223
def get_period_perc_pandl_for_strategy_in_date_range (self , strategy_name : str ):
224
224
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 :
230
230
return 0.0
231
231
232
232
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(
245
245
strategy_name
246
246
)
247
247
248
- if instrument_list is missing_data :
249
- return missing_data
250
-
251
248
pandl_df = pd .concat (pandl_list , axis = 1 )
252
249
pandl_df .columns = instrument_list
253
250
@@ -260,7 +257,7 @@ def get_list_of_perc_pandl_series_for_strategy_all_instruments(
260
257
self .data , strategy_name
261
258
)
262
259
if len (instrument_list ) == 0 :
263
- return missing_data , missing_data
260
+ raise missingData
264
261
265
262
pandl_list = [
266
263
self .perc_pandl_series_for_strategy_instrument_vs_total_capital (
You can’t perform that action at this time.
0 commit comments