devcartel / pyrfa

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

Get all underlying RICs within a chain RIC #58

Closed kiranshm973 closed 2 years ago

kiranshm973 commented 2 years ago

Hi,

Is there a way to get all underlying RICs within a chain RIC? I am able to get a snapshot using marketPriceRequest for chain RIC 0#MIFID.xbp but not sure how to get all underlying RICs.

Thanks, Kiran

wiwat-tharateeraparb commented 2 years ago

Possible. Check out examples/chain.py

kiranshm973 commented 2 years ago

thanks

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.