devcartel / pyrfa

Open sourced Python API for Refinitiv (Thomson Reuters) Enterprise Platform.
http://devcartel.com/pyrfa
MIT License
52 stars 16 forks source link

Trying to get constituent rics of 0#MIFID.xbo #59

Open zwedwin opened 2 years ago

zwedwin commented 2 years ago

hi @wiwat-tharateeraparb I have tried to implement this recursively but am running into issues

here is my implementation

def get_all_children(chain_ric, visited, rics):
    children, _ = expand_chain_ric(chain_ric)
    if chain_ric.endswith('.xbo') and not chain_ric.startswith('0#'):
        rics.add(chain_ric)
    children = [child for child in children if child not in visited]
    print('CHAIN RIC:   ' + chain_ric)
    if children:
        for child in children:
            if child in visited:
                pass
            visited.append(child)
            get_all_children(child, visited, rics)
    return None

I appear to be missing some RICs however. I am expecting ~3500 constituent rics but I am only getting ~2000. From what I understand pyfra is no longer officially supported by refinitiv could this be causing the issue here? Are there RICS that "live on an island" so to speak and can only be accessed if you have the address? Thanks for your help.

zwedwin commented 2 years ago

Using the expand_chain_ric() found in the examples.