From ce23e9c5422d38b133ff26792f4639e6aeaf131f Mon Sep 17 00:00:00 2001 From: Karolina Cynk Date: Wed, 10 Jul 2024 17:04:50 +0200 Subject: [PATCH] Fixed open figi mapping for FX (#174) --- .../contract/contract_to_ticker_conversion/bbg_figi_mapper.py | 4 ++-- .../contract_to_ticker_conversion/test_bbg_figi_mapper.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/qf_lib/backtesting/contract/contract_to_ticker_conversion/bbg_figi_mapper.py b/qf_lib/backtesting/contract/contract_to_ticker_conversion/bbg_figi_mapper.py index 9958ec5d..ace5ef73 100644 --- a/qf_lib/backtesting/contract/contract_to_ticker_conversion/bbg_figi_mapper.py +++ b/qf_lib/backtesting/contract/contract_to_ticker_conversion/bbg_figi_mapper.py @@ -174,8 +174,8 @@ def _ticker_from_openfigi_response(self, contract_data: Dict[str, str], figi: st 'Equity': (SecurityType.STOCK, ['ticker', 'exchCode', 'marketSector']), 'Mutual Fund': (SecurityType.STOCK, ['ticker', 'exchCode', 'marketSector']), 'Future': (SecurityType.FUTURE, ['ticker', 'marketSector']), - 'CROSS': (SecurityType.FX, ['ticker', 'marketSector']), - 'SPOT': (SecurityType.FX, ['ticker', 'marketSector']), + 'CROSS': (SecurityType.FX, ['securityDescription']), + 'SPOT': (SecurityType.FX, ['securityDescription']), } try: diff --git a/qf_lib/tests/integration_tests/backtesting/contract/contract_to_ticker_conversion/test_bbg_figi_mapper.py b/qf_lib/tests/integration_tests/backtesting/contract/contract_to_ticker_conversion/test_bbg_figi_mapper.py index 8e7982a4..4fc73a20 100644 --- a/qf_lib/tests/integration_tests/backtesting/contract/contract_to_ticker_conversion/test_bbg_figi_mapper.py +++ b/qf_lib/tests/integration_tests/backtesting/contract/contract_to_ticker_conversion/test_bbg_figi_mapper.py @@ -50,9 +50,10 @@ def test_incorrect_figi_to_ticker__no_data_preloading(self): def test_figi_to_ticker__no_data_preloading(self): mapper = BloombergTickerMapper(data_caching=False) - figis = ["BBG000H4FSM0", "BBG000BDTBL9", "BBG0013HFN45"] + figis = ["BBG000H4FSM0", "BBG000BDTBL9", "BBG0013HQFX8", "BBG0013HFN45"] expected_tickers = [BloombergTicker("SPX Index", SecurityType.INDEX), BloombergTicker("SPY US Equity", SecurityType.STOCK), + BloombergTicker("EURCHF Curncy", SecurityType.FX), BloombergTicker("USDCHF Curncy", SecurityType.FX)] for figi, ticker in zip(figis, expected_tickers):