FXCross#
-
class sigtech.framework.infra.analytics.fx.cross.FXCross
Class handling FX currency conversions.
Note
The over/under convention represents how much one
under
unit costs in terms ofover
units.over
is the over or quote currency. InEURUSD
, the over currency would beUSD
.under
is the under or base currency. InEURUSD
, the under currency would beEUR
.
-
clear_cache()
Clear the object cache.
-
convert(values, from_ccy, to_ccy, data_point=None)
Convert a daily timeseries from the source currency to the target currency using the
TradingManager
default data point / close time.- Parameters:
values – Input timeseries with a date index (no time or timezone).
from_ccy – Source currency.
to_ccy – Target currency.
data_point – Data point (optional).
- Returns:
pandas Series.
-
convert_at_d(value, d, from_ccy, to_ccy, fx_source='SNAP', field='MidPrice', data_point=None)
Convert the input value on date or datetime
d
from the source currency to the target currency.- Parameters:
value – Input value.
d – Reference date or datetime.
from_ccy – Source currency.
to_ccy – Target currency.
fx_source – FX source (default is
'SNAP'
).field – Field (default is
'MidPrice'
).data_point – Data point (optional).
- Returns:
Converted value.
-
convert_at_dt(value, dt, from_ccy, to_ccy, fx_source='SNAP', field='MidPrice')
Convert the input value on time
dt
from the source currency to the target currency.- Parameters:
value – Input value.
dt – Reference datetime.
from_ccy – Source currency.
to_ccy – Target currency.
fx_source – FX source (default is
'SNAP'
).field – Field (default is
'MidPrice'
).
- Returns:
Converted value.
-
dependencies(over: str, under: str, time: ~typing.Optional[~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 for an fx pair
-
static fx_pair_in_canonical_order(pair: str, check=True)
Return the FX pair in canonical order, e.g.
'jpyusd'
->'USDJPY'
,'eurusd'
->'EURUSD'
.- Parameters:
pair – FX pair in string format.
check – Flag to enable extra checks on the FX pair (length and case sensitive check) if set to True (default).
- Returns:
str.
-
get_available_data_points(fx_source='SNAP')
Return the list of available data points.
- Parameters:
fx_source – FX source (default is
'SNAP'
).- Returns:
list.
-
get_series(over, under, fx_source='SNAP', field=None, data_point=None, start_dt=None, end_dt=None)
Get a daily series of conversion values.
- Parameters:
over – Over currency.
under – Under currency.
fx_source – FX source (default is
'SNAP'
).field – Field (optional).
data_point – Data point (optional).
start_dt – start datetime, for use with intraday data_point only
end_dt – end datetime, for use with intraday data_point only
- Returns:
pandas Series.
-
get_value(d, over, under, fx_source='SNAP', field='MidPrice', data_point=None)
Get an individual FX cross conversion value.
- Parameters:
d – Reference date or datetime.
over – Over currency.
under – Under currency.
fx_source – FX source (default is
'SNAP'
).field – Field (default is
'MidPrice'
).data_point – Data point (optional).
- Returns:
Converted value.
-
classmethod is_flipped(over, under)
Determine whether over/under needs to be flipped to be in line with market quoting conventions.
- Parameters:
over – Over currency.
under – Under currency.
- Returns:
bool.