def price(mocker, priceable: Priceable): set_session() mocker.return_value = [[[{'value': 0.01}]]] result = priceable.dollar_price() assert result == 0.01 risk_request = risk.RiskRequest( positions=(risk.RiskPosition(priceable, 1),), measures=(risk.DollarPrice,), pricingLocation=PricingContext.current.market_data_location, pricingAndMarketDataAsOf=PricingContext.current._pricing_market_data_as_of, waitForResults=True) mocker.assert_called_with(risk_request)
def price(mocker, priceable: Priceable): set_session() mocker.return_value = [[[[{'$type': 'Risk', 'val': 0.01}]]]] current = PricingContext.current result = priceable.dollar_price() assert result == 0.01 risk_requests = (risk.RiskRequest( positions=(RiskPosition(instrument=priceable, quantity=1),), measures=(risk.DollarPrice,), pricing_and_market_data_as_of=(PricingDateAndMarketDataAsOf(pricing_date=current.pricing_date, market=current.market),), parameters=RiskRequestParameters(raw_results=True), wait_for_results=True),) mocker.assert_called_with(risk_requests)
def price(mocker, priceable: Priceable): set_session() mocker.return_value = [[[[{'$type': 'Risk', 'val': 0.01}]]]] result = priceable.dollar_price() assert result == 0.01 risk_requests = (risk.RiskRequest( positions=(risk.RiskPosition(priceable, 1), ), measures=(risk.DollarPrice, ), pricing_location=PricingContext.current.market_data_location, pricing_and_market_data_as_of=PricingContext.current. _pricing_market_data_as_of, parameters=RiskRequestParameters(raw_results=True), wait_for_results=True), ) mocker.assert_called_with(risk_requests)