How to get RIC for a specific market using SEDOL in API

Using the API, I would like to return the RIC for a specific market given a SEDOL. For instance, if I look up BP6MXD8, it returns SHEL.L, but I am looking for SHELl.BS.

rdp.get_data(['BP6MXD8','0989529','0144403','0540528','B10RZP7'], ["TR.ExchangeMarketIdCode",'TR.RICCode'])

Tagged:

Answers

  • Hi @MarkJoseph.Canada ,

    I'd like to update to the latest version of the data library, https://developers.lseg.com/en/api-catalog/lseg-data-platform/lseg-data-library-for-python

    With this library, the code below can be used to convert symbology

    import lseg.data as ld
    from lseg.data.discovery import (
    convert_symbols,
    SymbolTypes,
    )

    ld.open_session()

    response = convert_symbols(
    symbols=['BP6MXD8','0989529','0144403','0540528','B10RZP7'],
    from_symbol_type=SymbolTypes.SEDOL
    )
    response
    image.png

    I'm retrieving all symbols of these RICs and "SHELl.BS" have no SEDOL symbol returned as below.

    response = convert_symbols(
    symbols=['SHELl.BS', 'SHEL.L'],
    from_symbol_type=SymbolTypes.RIC
    )
    response
    image.png

    However, RIC "SHELl.BS" is from exchange BATS TRADING EUROPE

    image.png

    So I've tried the workaround using search function with ticker symbol starts with ticker symbol mapped with the SEDOL and got the result as below, is this what you're looking for?

    ld.discovery.search(
    view = ld.discovery.Views.EQUITY_QUOTES,
    top = 10,
    filter = "(AssetState ne 'DC' and SearchAllCategoryv2 eq 'Equities' and (ExchangeName xeq 'BATS TRADING EUROPE' and (TickerSymbol in 'SHEL*')))",
    select = "ExchangeName,RIC,,SEDOL,TickerSymbol"
    )
    image.png
  • Here's the full code for the workaround

    import lseg.data as ld
    from lseg.data.discovery import (
    convert_symbols,
    SymbolTypes,
    )

    ld.open_session()

    # get result of convert_symbols response = convert_symbols(
    symbols=['BP6MXD8','0989529','0144403','0540528','B10RZP7'],
    from_symbol_type=SymbolTypes.SEDOL
    )
    # convert ticker symbol in result to list and use it to make the filter string tickers = response['TickerSymbol'].to_list() filter_ticker = ''
    for ticker in tickers:
    if ticker == tickers[len(tickers)-1]:
    filter_ticker += f"TickerSymbol eq '{ticker}*'"
    else:
    filter_ticker += f"TickerSymbol eq '{ticker}*' or "
    # use search function ld.discovery.search(
    view = ld.discovery.Views.EQUITY_QUOTES,
    top = 10,
    filter = f"(AssetState ne 'DC' and SearchAllCategoryv2 eq 'Equities' and (ExchangeName xeq 'BATS TRADING EUROPE' and ({filter_ticker})))",
    select = "ExchangeName,RIC,,SEDOL,TickerSymbol"
    )
    image.png