FXCurveMarket#
-
class sigtech.framework.infra.analytics.fx.fx_market.FXCurveMarket
Baseclasses:
BaseFXMarket
Subclasses:
ExternalFXMarket
Class calculating yield curves used for forward rate calculation. It should only be used for USD-based FX forwards and implies forwards directly from the curves:
\[{FX}_t = {FX}_0 \frac{P_{for}(0, t)}{P_{dom}(0,t)}\]where the domestic curve is the usual OIS discounting curve, and the foreign curve is bootstrapped to match the market FX forwards and cross-currency swaps.
-
calculate_forward_rate(over, under, quote_date, maturity, mode='mid', transaction_type=None, spot_date=None, data_point=None, spot_data_point=None)
Calculate the forward rate for a given currency pair and maturity.
- Parameters:
over – Over currency.
under – Under currency.
quote_date – Quote date.
maturity – Maturity date.
mode –
'bid'
,'ask'
or'mid'
('mid'
is default).transaction_type – String identifier to indicate type of transaction, e.g.
'outright'
,'roll'
(optional).spot_date – Spot date (optional).
data_point – Data point (optional).
spot_data_point – Data point for spot, if different from forward curves data point. Used only if
quote_dates
aredtm.date
anddata_point
is present (optional).
- Returns:
Forward rate.
-
calculate_forward_rate_batch(over, under, quote_dates, maturities, mode='mid', transaction_type=None, spot_dates=None, data_point=None, spot_data_point=None)
Calculate the forward rates for a given currency pair and list of maturity dates.
- Parameters:
over – Over currency.
under – Under currency.
quote_dates – Quote dates. If datetimes are passed, the
spot_data_point
will be ignored, and latest available data, (anddata_point
if present) will be used.maturities – Maturity dates.
mode –
'bid'
,'ask'
or'mid'
('mid'
is default).transaction_type – String identifier to indicate type of transaction, e.g.
'outright'
,'roll'
(optional).spot_dates – Spot dates (optional).
data_point – Data point (optional).
spot_data_point – Data point for spot, if different from forward curves data point. Used only if
quote_dates
aredtm.date
anddata_point
is present (optional).
- Returns:
list.
-
day_count(currency, curve_day_count=None)
Return the day count given the currency.
- Parameters:
currency – Input currency.
curve_day_count – Curve day count (optional).
- Returns:
str.
-
dependencies(over: str, under: str, time: ~datetime.time, tz: <module 'pytz.tzinfo' from '/github/home/.cache/pypoetry/virtualenvs/sigtech-framework-GMC81NYz-py3.11/lib/python3.11/site-packages/pytz/tzinfo.py'>, start_dt: ~datetime.datetime, end_dt: ~datetime.datetime) list[sigtech.framework.internal.infra.mu.graph.registry.factory.Dependency]
Dependencies
-
discount_factor(currency, quote_date, start_date, end_date, mode='mid', data_point=None)
Calculate a discount factor.
- Parameters:
currency – Input currency.
quote_date – Quote date.
start_date – Period start date.
end_date – Period end date.
mode –
'bid'
,'ask'
or'mid'
('mid'
is default).data_point – Data point (optional).
- Returns:
Discount factor.
-
discount_factor_batch(currency, quote_dates, start_dates, end_dates, mode='mid', data_point=None)
Calculate a batch of discount factors.
- Parameters:
currency – Input currency.
quote_dates – List of quote dates.
start_dates – List of period start dates.
end_dates – List of period end dates.
mode –
'bid'
,'ask'
or'mid'
('mid'
is default).data_point – Data point (optional).
- Returns:
list.
-
generate_data_for_fx_curve_override(currency, quote_date, tenors=None, forward_dates=None, delivery_days=None, forward_points=None, forwards=None, data_point=None)
Output DataFrame consisting of two columns - delivery_days and depo_rates, used in FX curve creation. This function is useful only for overriding existing (or missing) FX curves in the framework FX Curve market. The inputs are flexible in terms of either tenors, forward dates, or delivery days (exactly one is required) and forward or forward points (exactly one is required).
- Parameters:
currency – Currency of the curve.
quote_date – Quote date.
tenors – List of tenors (e.g. [
'ON'
,'1D'
,'1M'
]) (Optional).forward_dates – List of delivery dates (Optional, instead of tenors, and delivery_days).
delivery_days – List of offsets from SpotDate (e.g. [-2, 7, 31]). (Optional instead of tenors or delivery_dates).
forward_points – List of (absolute) forward points (e.g. [0.0012, 0.0014, 0.0018]). (Optional instead of forwards).
forwards – List of FX Forwards corresponding to the delivery dates. (Optional instead of forward_points).
data_point – Data point (optional).
- Returns:
pd.DataFrame
-
get_available_data_points()
Return the list of available data points.
-
implied_depo(currency, quote_date, tenor, spot_date=None, data_point=None)
Compute the implied depo rate given quote date and tenor.
- Parameters:
currency – Input currency.
quote_date – Quote date.
tenor – Tenor identifier.
spot_date – Spot date (optional).
data_point – Data point (optional).
- Returns:
float.
-
implied_depo_batch(currency, quote_dates, tenor, spot_dates=None, data_point=None)
Compute the implied depo rate batch given a list of quote dates and tenor.
- Parameters:
currency – Input currency.
quote_dates – Quote dates.
tenor – Tenor identifier.
spot_dates – Spot dates (optional).
data_point – Data point (optional).
- Returns:
list.
-
static is_fx_forward_curve_name(name: str) bool
Check if the name resembles the identifier for a fx forward curve.
- Parameters:
name – string to check
- Returns:
bool flagging if it matches