ForwardPointMarket
ForwardPointMarket#
-
class sigtech.framework.infra.analytics.fx.fx_market.ForwardPointMarket
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 + {FXPoint}_t\]where the points are interpolated from the market quoted ones, and converted from quoting convention to the values compatible with FX spot.
Given that there is no default discounting associated with the FX forward points, the class also provides alternative ways of discounting the FX forward instrument, depending on the
FORWARD_DISCOUNTING_INSTRUMENT
configuration setting, either via discount curve (provided as discounting instrument inconfig
), or via a cash rate (using the latest fixing as a flat rate):\[P(0,t) = e^{-rt}\]-
dependencies(over: str, under: str, time: datetime.time, tz: <module 'pytz.tzinfo' from '/github/home/.cache/pypoetry/virtualenvs/sigtech-framework-GMC81NYz-py3.9/lib/python3.9/site-packages/pytz/tzinfo.py'>, start_dt: datetime.datetime, end_dt: datetime.datetime) list[sigtech.framework.internal.infra.mu.graph.registry.factory.Dependency]
Dependencies
-
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.
-
calculate_forward_rate(over, under, quote_date, maturity, mode='mid', transaction_type=None, spot_date=None, 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).
- Returns
Forward rate.
-
calculate_forward_rate_batch(over, under, quote_dates, maturities, mode='mid', transaction_type=None, spot_dates=None, 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.
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).
- Returns
list.
-
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.
-
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.
-
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.
-
ROLL_OFFSET = {'12M': (1990-01-01 2 dtype: int64, {'months': 12}), '1M': (1990-01-01 2 dtype: int64, {'months': 1}), '1W': (1990-01-01 2 dtype: int64, {'weeks': 1}), '1Y': (1990-01-01 2 dtype: int64, {'years': 1}), '2M': (1990-01-01 2 dtype: int64, {'months': 2}), '3M': (1990-01-01 2 dtype: int64, {'months': 3}), '3M_IMM': (1990-01-01 5 2017-04-14 6 dtype: int64, None), '6M': (1990-01-01 2 dtype: int64, {'months': 6}), '9M': (1990-01-01 2 dtype: int64, {'months': 9}), 'ON': (1990-01-01 0 dtype: int64, {'BD': 1}), 'SN': (1990-01-01 2 dtype: int64, {'BD': 1}), 'TN': (1990-01-01 1 dtype: int64, {'BD': 1})}
Roll offset: how many business days are rolled before forward maturity.
-
property default_data_point
Return the default data point.
-
forward_ticker(over, under, tenor)
Return the FX forward ticker.
- Parameters
over – Over currency.
under – Under currency.
tenor – Tenor identifier.
- Returns
str.
-
fx_curve_name(currency)
Return the FX curve name given an input currency.
- Parameters
currency – Input currency.
- Returns
str.
-
static fx_forward_convention(over, under)
Return a tuple (over, under, notional multiplier) following the market notional convention for FX forward trading. It assumes the long is
under
.- Parameters
over – Over currency.
under – Under currency.
- Returns
tuple.
-
fx_forward_date(over, under, spot_date, fwd_tenor=None)
Return the FX forward maturity date in line with the convention.
- Parameters
over – Over currency.
under – Under currency.
spot_date – Spot date.
fwd_tenor – Tenor identifier (optional).
- Returns
date.
-
static fx_forward_delta_cutoff(over, under)
Return the FX forward delta cutoff for a currency pair.
- Parameters
over – Over currency.
under – Under currency.
- Returns
str.
-
fx_holiday_calendar_and_fixing_delay(over, under)
Return the FX holiday calendar identifier and the fixing delay.
If none of the currency is the base currency USD, the max of the two fixing delays is used to define the spot date.
- Parameters
over – Over currency.
under – Under currency.
- Returns
tuple.
-
fx_schedule(over, under)
Return the trade schedule for a currency pair.
- Parameters
over – Over currency.
under – Under currency.
- Returns
Schedule object.
-
fx_spot_date(over, under, quote_date)
Return the FX spot date.
- Parameters
over – Over currency.
under – Under currency.
quote_date – Quote date.
- Returns
Spot date.
-
fx_spot_date_inverse(over, under, spot_date)
Return the date for which
spot_date
represents the FX spot date. Ifspot_date
is not a valid spot date, the date for which the spot date does not exceedspot_date
is returned.- Parameters
over – Over currency.
under – Under currency.
spot_date – Spot date.
- Returns
date.
-
generate_forward_dates(over, under, spot_date, tenors)
Return the FX forward maturity dates given a list of tenor identifiers.
- Parameters
over – Over currency.
under – Under currency.
spot_date – Spot date.
tenors – Tenor identifiers.
- Returns
list.
-
generate_fwd_forward_dates(over, under, spot_date, tenor_lists)
Generate a list of forward tenor dates given a list of forward tenors, e.g. (
'1W'
,'1W'
).- Parameters
over – Over currency.
under – Under currency.
spot_date – Spot date.
tenor_lists – Forward tenors.
- Returns
list.
-
static get_available_data_points()
Return the list of available data points.
-
get_next_forward_maturity(d, strategy)
Return the next forward maturity date given a reference date and a strategy.
- Parameters
d – Reference date.
strategy – Strategy object.
- Returns
Date.
-
hedge_schedule(start_date, end_date, over, under, forward_tenor)
Return the schedule given a currency pair, period and forward tenor.
- Parameters
start_date – Period start date.
end_date – Period end date.
over – Over currency.
under – Under currency.
forward_tenor – Forward tenor.
- Returns
Schedule.
-
classmethod instance(universe_name=None)
Return the singleton instance of this class. If one for the given universe does not exist, create it.
-
is_forward_deliverable(over, under)
Check if the forward is deliverable.
- Parameters
over – Over currency.
under – Under currency.
- Returns
bool.
-
schedule_stub(over, under, group_name=None)
Return the schedule stub for a currency pair.
- Parameters
over – Over currency.
under – Under currency.
group_name – Group name (optional).
- Returns
ScheduleStub
object.
-
static spot_ticker(over, under)
Return the FX spot ticker.
- Parameters
over – Over currency.
under – Under currency.
- Returns
str.