Skip to content

Commit

Permalink
Chore: Make release 1.0.109
Browse files Browse the repository at this point in the history
  • Loading branch information
martinroberson authored and Vanden Bon, David V [GBM Public] committed Aug 12, 2024
1 parent 1107568 commit b8f6251
Show file tree
Hide file tree
Showing 3 changed files with 156 additions and 3 deletions.
5 changes: 3 additions & 2 deletions gs_quant/backtests/generic_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ def new_pricing_context(self):
is_batch=is_batch, use_historical_diddles_only=True)

context._max_concurrent = 10000
context._dates_per_batch = 200

return context

Expand Down Expand Up @@ -792,7 +793,7 @@ def _price_semi_det_triggers(self, backtest, risks):
p.results = port.calc(tuple(risks))

def _process_triggers_and_actions_for_date(self, d, strategy, backtest, risks):
logger.info(f'{d}: Processing triggers and actions')
logger.debug(f'{d}: Processing triggers and actions')
# path dependent
for trigger in strategy.triggers:
if trigger.calc_type == CalcType.path_dependent:
Expand Down Expand Up @@ -892,7 +893,7 @@ def _calc_new_trades(self, backtest, risks):
leaves = []
for leaf in portfolio:
if leaf.name not in trades_for_date:
logger.info(f'{day}: new portfolio position {leaf} scheduled for calculation')
logger.debug(f'{day}: new portfolio position {leaf.name} scheduled for calculation')
leaves.append(leaf)

if len(leaves):
Expand Down
111 changes: 110 additions & 1 deletion gs_quant/test/timeseries/test_measures.py
Original file line number Diff line number Diff line change
Expand Up @@ -4601,7 +4601,17 @@ def test_weighted_average_valuation_curve_for_calendar_strip():
def test_fundamental_metrics():
replace = Replacer()
mock_spx = Index('MA890', AssetClass.Equity, 'SPX')
mock_rb = CustomBasket(GsAsset(AssetClass.Equity, AssetType.Research_Basket, 'GSTEST01'))
mock_rb = CustomBasket(GsAsset(AssetClass.Equity, AssetType.Research_Basket, 'GSTEST01', None, None, None, None,
None, None, None, None, None, None, None, None, None, None, None, None, None, None,
None, None, {'flagship': True}))
mock_non_flagship = CustomBasket(GsAsset(AssetClass.Equity, AssetType.Research_Basket, 'GSTEST01', None, None, None,
None, None, None, None, None, None, None, None, None, None, None, None,
None, None, None, None, None, {'flagship': False}))
mock_basket_no_parameters = CustomBasket(GsAsset(AssetClass.Equity, AssetType.Research_Basket, 'GSTEST01'))
mock_basket_no_flagship_parameter = CustomBasket(GsAsset(AssetClass.Equity, AssetType.Research_Basket, 'GSTEST01',
None, None, None, None, None, None, None, None, None,
None, None, None, None, None, None, None, None, None,
None, None, {}))
replace('gs_quant.timeseries.measures.GsDataApi.get_market_data', mock_eq)
period = '1y'
direction = tm.FundamentalMetricPeriodDirection.FORWARD
Expand Down Expand Up @@ -4744,6 +4754,105 @@ def test_fundamental_metrics():
with pytest.raises(NotImplementedError):
tm.current_constituents_sales_per_share(..., period, direction, real_time=True)

with pytest.raises(NotImplementedError):
tm.current_constituents_dividend_yield(mock_non_flagship, period, direction)

with pytest.raises(NotImplementedError):
tm.current_constituents_earnings_per_share(mock_non_flagship, period, direction)

with pytest.raises(NotImplementedError):
tm.current_constituents_earnings_per_share_positive(mock_non_flagship, period, direction)

with pytest.raises(NotImplementedError):
tm.current_constituents_net_debt_to_ebitda(mock_non_flagship, period, direction)

with pytest.raises(NotImplementedError):
tm.current_constituents_price_to_book(mock_non_flagship, period, direction)

with pytest.raises(NotImplementedError):
tm.current_constituents_price_to_cash(mock_non_flagship, period, direction)

with pytest.raises(NotImplementedError):
tm.current_constituents_price_to_earnings(mock_non_flagship, period, direction)

with pytest.raises(NotImplementedError):
tm.current_constituents_price_to_earnings_positive(mock_non_flagship, period, direction)

with pytest.raises(NotImplementedError):
tm.current_constituents_price_to_sales(mock_non_flagship, period, direction)

with pytest.raises(NotImplementedError):
tm.current_constituents_return_on_equity(mock_non_flagship, period, direction)

with pytest.raises(NotImplementedError):
tm.current_constituents_sales_per_share(mock_non_flagship, period, direction)

with pytest.raises(NotImplementedError):
tm.current_constituents_dividend_yield(mock_basket_no_parameters, period, direction)

with pytest.raises(NotImplementedError):
tm.current_constituents_earnings_per_share(mock_basket_no_parameters, period, direction)

with pytest.raises(NotImplementedError):
tm.current_constituents_earnings_per_share_positive(mock_basket_no_parameters, period, direction)

with pytest.raises(NotImplementedError):
tm.current_constituents_net_debt_to_ebitda(mock_basket_no_parameters, period, direction)

with pytest.raises(NotImplementedError):
tm.current_constituents_price_to_book(mock_basket_no_parameters, period, direction)

with pytest.raises(NotImplementedError):
tm.current_constituents_price_to_cash(mock_basket_no_parameters, period, direction)

with pytest.raises(NotImplementedError):
tm.current_constituents_price_to_earnings(mock_basket_no_parameters, period, direction)

with pytest.raises(NotImplementedError):
tm.current_constituents_price_to_earnings_positive(mock_basket_no_parameters, period, direction)

with pytest.raises(NotImplementedError):
tm.current_constituents_price_to_sales(mock_basket_no_parameters, period, direction)

with pytest.raises(NotImplementedError):
tm.current_constituents_return_on_equity(mock_basket_no_parameters, period, direction)

with pytest.raises(NotImplementedError):
tm.current_constituents_sales_per_share(mock_basket_no_parameters, period, direction)

with pytest.raises(NotImplementedError):
tm.current_constituents_dividend_yield(mock_basket_no_flagship_parameter, period, direction)

with pytest.raises(NotImplementedError):
tm.current_constituents_earnings_per_share(mock_basket_no_flagship_parameter, period, direction)

with pytest.raises(NotImplementedError):
tm.current_constituents_earnings_per_share_positive(mock_basket_no_flagship_parameter, period, direction)

with pytest.raises(NotImplementedError):
tm.current_constituents_net_debt_to_ebitda(mock_basket_no_flagship_parameter, period, direction)

with pytest.raises(NotImplementedError):
tm.current_constituents_price_to_book(mock_basket_no_flagship_parameter, period, direction)

with pytest.raises(NotImplementedError):
tm.current_constituents_price_to_cash(mock_basket_no_flagship_parameter, period, direction)

with pytest.raises(NotImplementedError):
tm.current_constituents_price_to_earnings(mock_basket_no_flagship_parameter, period, direction)

with pytest.raises(NotImplementedError):
tm.current_constituents_price_to_earnings_positive(mock_basket_no_flagship_parameter, period, direction)

with pytest.raises(NotImplementedError):
tm.current_constituents_price_to_sales(mock_basket_no_flagship_parameter, period, direction)

with pytest.raises(NotImplementedError):
tm.current_constituents_return_on_equity(mock_basket_no_flagship_parameter, period, direction)

with pytest.raises(NotImplementedError):
tm.current_constituents_sales_per_share(mock_basket_no_flagship_parameter, period, direction)

replace.restore()


Expand Down
43 changes: 43 additions & 0 deletions gs_quant/timeseries/measures.py
Original file line number Diff line number Diff line change
Expand Up @@ -3632,6 +3632,10 @@ def current_constituents_dividend_yield(asset: Asset, period: str, period_direct
if real_time:
raise NotImplementedError('real-time current_constituents_dividend_yield not implemented')

if not asset.get_entity().get('parameters', {'flagship': False}).get('flagship', False):
raise NotImplementedError('current_constituents_dividend_yield not implemented for this basket. '
'Only available for flagship baskets')

mqid = asset.get_marquee_id()
metric = DataMeasure.CURRENT_CONSTITUENTS_DIVIDEND_YIELD.value

Expand Down Expand Up @@ -3667,6 +3671,9 @@ def current_constituents_earnings_per_share(asset: Asset, period: str,
if real_time:
raise NotImplementedError('real-time current_constituents_earnings_per_share not implemented')

if not asset.get_entity().get('parameters', {'flagship': False}).get('flagship', False):
raise NotImplementedError('current_constituents_earnings_per_share not implemented for this basket. '
'Only available for flagship baskets')
mqid = asset.get_marquee_id()
metric = DataMeasure.CURRENT_CONSTITUENTS_EARNINGS_PER_SHARE.value

Expand Down Expand Up @@ -3702,6 +3709,10 @@ def current_constituents_earnings_per_share_positive(asset: Asset, period: str,
if real_time:
raise NotImplementedError('real-time current_constituents_earnings_per_share_positive not implemented')

if not asset.get_entity().get('parameters', {'flagship': False}).get('flagship', False):
raise NotImplementedError('current_constituents_earnings_per_share_positive not implemented for this basket. '
'Only available for flagship baskets')

mqid = asset.get_marquee_id()
metric = DataMeasure.CURRENT_CONSTITUENTS_EARNINGS_PER_SHARE_POSITIVE.value

Expand Down Expand Up @@ -3737,6 +3748,10 @@ def current_constituents_net_debt_to_ebitda(asset: Asset, period: str,
if real_time:
raise NotImplementedError('real-time current_constituents_net_debt_to_ebitda not implemented')

if not asset.get_entity().get('parameters', {'flagship': False}).get('flagship', False):
raise NotImplementedError('current_constituents_net_debt_to_ebitda not implemented for this basket. '
'Only available for flagship baskets')

mqid = asset.get_marquee_id()
metric = DataMeasure.CURRENT_CONSTITUENTS_NET_DEBT_TO_EBITDA.value

Expand Down Expand Up @@ -3771,6 +3786,10 @@ def current_constituents_price_to_book(asset: Asset, period: str, period_directi
if real_time:
raise NotImplementedError('real-time current_constituents_price_to_book not implemented')

if not asset.get_entity().get('parameters', {'flagship': False}).get('flagship', False):
raise NotImplementedError('current_constituents_price_to_book not implemented for this basket. '
'Only available for flagship baskets')

mqid = asset.get_marquee_id()
metric = DataMeasure.CURRENT_CONSTITUENTS_PRICE_TO_BOOK.value

Expand Down Expand Up @@ -3805,6 +3824,10 @@ def current_constituents_price_to_cash(asset: Asset, period: str, period_directi
if real_time:
raise NotImplementedError('real-time current_constituents_price_to_cash not implemented')

if not asset.get_entity().get('parameters', {'flagship': False}).get('flagship', False):
raise NotImplementedError('current_constituents_price_to_cash not implemented for this basket. '
'Only available for flagship baskets')

mqid = asset.get_marquee_id()
metric = DataMeasure.CURRENT_CONSTITUENTS_PRICE_TO_CASH.value

Expand Down Expand Up @@ -3840,6 +3863,10 @@ def current_constituents_price_to_earnings(asset: Asset, period: str,
if real_time:
raise NotImplementedError('real-time current_constituents_price_to_earnings not implemented')

if not asset.get_entity().get('parameters', {'flagship': False}).get('flagship', False):
raise NotImplementedError('current_constituents_price_to_earnings not implemented for this basket. '
'Only available for flagship baskets')

mqid = asset.get_marquee_id()
metric = DataMeasure.CURRENT_CONSTITUENTS_PRICE_TO_EARNINGS.value

Expand Down Expand Up @@ -3875,6 +3902,10 @@ def current_constituents_price_to_earnings_positive(asset: Asset, period: str,
if real_time:
raise NotImplementedError('real-time current_constituents_price_to_earnings_positive not implemented')

if not asset.get_entity().get('parameters', {'flagship': False}).get('flagship', False):
raise NotImplementedError('current_constituents_price_to_earnings_positive not implemented for this basket. '
'Only available for flagship baskets')

mqid = asset.get_marquee_id()
metric = DataMeasure.CURRENT_CONSTITUENTS_PRICE_TO_EARNINGS_POSITIVE.value

Expand Down Expand Up @@ -3909,6 +3940,10 @@ def current_constituents_price_to_sales(asset: Asset, period: str, period_direct
if real_time:
raise NotImplementedError('real-time current_constituents_price_to_sales not implemented')

if not asset.get_entity().get('parameters', {'flagship': False}).get('flagship', False):
raise NotImplementedError('current_constituents_price_to_sales not implemented for this basket. '
'Only available for flagship baskets')

mqid = asset.get_marquee_id()
metric = DataMeasure.CURRENT_CONSTITUENTS_PRICE_TO_SALES.value

Expand Down Expand Up @@ -3943,6 +3978,10 @@ def current_constituents_return_on_equity(asset: Asset, period: str, period_dire
if real_time:
raise NotImplementedError('real-time current_constituents_return_on_equity not implemented')

if not asset.get_entity().get('parameters', {'flagship': False}).get('flagship', False):
raise NotImplementedError('current_constituents_return_on_equity not implemented for this basket. '
'Only available for flagship baskets')

mqid = asset.get_marquee_id()
metric = DataMeasure.CURRENT_CONSTITUENTS_RETURN_ON_EQUITY.value

Expand Down Expand Up @@ -3977,6 +4016,10 @@ def current_constituents_sales_per_share(asset: Asset, period: str, period_direc
if real_time:
raise NotImplementedError('real-time current_constituents_sales_per_share not implemented')

if not asset.get_entity().get('parameters', {'flagship': False}).get('flagship', False):
raise NotImplementedError('current_constituents_sales_per_share not implemented for this basket. '
'Only available for flagship baskets')

mqid = asset.get_marquee_id()
metric = DataMeasure.CURRENT_CONSTITUENTS_SALES_PER_SHARE.value

Expand Down

0 comments on commit b8f6251

Please sign in to comment.