HistoricalPricingContext

class HistoricalPricingContext(start=None, end=None, calendars=(), dates=None, is_async=None, is_batch=None, use_cache=None, visible_to_gs=None, request_priority=None, csa_term=None, market_data_location=None, timeout=None, show_progress=None, use_server_cache=None)[source]

A context for producing valuations over multiple dates

__init__(start=None, end=None, calendars=(), dates=None, is_async=None, is_batch=None, use_cache=None, visible_to_gs=None, request_priority=None, csa_term=None, market_data_location=None, timeout=None, show_progress=None, use_server_cache=None)[source]

A context for producing valuations over multiple dates

Parameters:
  • start (Union[int, date, None]) – start date

  • end (Union[int, date, None]) – end date (defaults to today)

  • calendars (Union[str, Tuple]) – holiday calendars

  • dates (Optional[Iterable[date]]) – a custom iterable of dates

  • is_async (Optional[bool]) – return immediately (True) or wait for results (False) (defaults to False)

  • is_batch (Optional[bool]) – use for calculations expected to run longer than 3 mins, to avoid timeouts. It can be used with is_async=True|False (defaults to False)

  • use_cache (Optional[bool]) – store results in the pricing cache (defaults to False)

  • visible_to_gs (Optional[bool]) – are the contents of risk requests visible to GS (defaults to False)

  • csa_term (Optional[str]) – the csa under which the calculations are made. Default is local ccy ois index

  • market_data_location (Optional[str]) – the location for sourcing market data (‘NYC’, ‘LDN’ or ‘HKG’ (defaults to LDN)

  • timeout (Optional[int]) – the timeout for batch operations

  • show_progress (Optional[bool]) – add a progress bar (tqdm)

  • use_server_cache (Optional[bool]) – cache query results on the GS servers

Examples

>>> from gs_quant.instrument import IRSwap
>>>
>>> ir_swap = IRSwap('Pay', '10y', 'DKK')
>>> with HistoricalPricingContext(10):
>>>     price_f = ir_swap.price()
>>>
>>> price_series = price_f.result()

Methods

__init__([start, end, calendars, dates, ...])

A context for producing valuations over multiple dates

calc(instrument, risk_measure)

Calculate the risk measure for the instrument.

clone(**kwargs)

default_value()

rtype:

object

Attributes

active_context

csa_term

is_async

is_batch

is_current

is_entered

market

market_data_location

pricing_date

Pricing date

use_cache

Cache results

visible_to_gs

Request contents visible to GS