def _currencypair_to_tdapi_fx_vol_swap_asset(asset_spec: ASSET_SPEC) -> str: asset = _asset_from_spec(asset_spec) bbid = asset.get_identifier(AssetIdentifier.BLOOMBERG_ID) # for each currency, get a dummy asset for checking availability result = CURRENCY_TO_DUMMY_FFO_BBID_VOL_SWAPS.get(bbid, asset.get_marquee_id()) return result
def _currency_to_tdapi_crosscurrency_swap_rate_asset( asset_spec: ASSET_SPEC) -> str: asset = _asset_from_spec(asset_spec) bbid = asset.get_identifier(AssetIdentifier.BLOOMBERG_ID) # for each currency, get a dummy asset for checking availability result = CURRENCY_TO_DUMMY_CROSSCURRENCY_SWAP_BBID.get( bbid, asset.get_marquee_id()) return result
def _currency_to_mdapi_basis_swap_rate_asset(asset_spec: ASSET_SPEC) -> str: asset = _asset_from_spec(asset_spec) bbid = asset.get_identifier(AssetIdentifier.BLOOMBERG_ID) # for each currency, get a dummy asset for checking availability if bbid == 'EUR': result = 'MAGRG2VT11GQ2RQ9' elif bbid == 'GBP': result = 'MAHCYNB3V75JC5Q8' elif bbid == 'JPY': result = 'MAXVRBEZCJVH0C4V' elif bbid == 'USD': result = 'MAQB1PGEJFCET3GG' else: return asset.get_marquee_id() return result
def cross_stored_direction_for_fx_vol( asset_spec: ASSET_SPEC) -> Union[str, Asset]: asset = _asset_from_spec(asset_spec) result = asset try: if asset.asset_class is AssetClass.FX: bbid = asset.get_identifier(AssetIdentifier.BLOOMBERG_ID) if bbid is not None: cross = _cross_stored_direction_helper(bbid) if cross != bbid: cross_asset = SecurityMaster.get_asset( cross, AssetIdentifier.BLOOMBERG_ID) result = cross_asset except TypeError: result = asset return _currencypair_to_tdapi_fxo_asset(result)
def _currency_to_mdapi_swap_rate_asset(asset_spec: ASSET_SPEC) -> str: asset = _asset_from_spec(asset_spec) bbid = asset.get_identifier(AssetIdentifier.BLOOMBERG_ID) # for each currency, get a dummy asset for checking availability if bbid == 'CHF': result = 'MAW25BGQJH9P6DPT' elif bbid == 'EUR': result = 'MAA9MVX15AJNQCVG' elif bbid == 'GBP': result = 'MA6QCAP9B7ABS9HA' elif bbid == 'JPY': result = 'MAEE219J5ZP0ZKRK' elif bbid == 'SEK': result = 'MAETMVTPNP3199A5' elif bbid == 'USD': result = 'MAFRSWPAF5QPNTP2' else: return asset.get_marquee_id() return result