How to find all the instruments under the curve Index

156 views Asked by At

I am using blpapi to find all the instruments under curve index

def curveListRequest(): #Return all govts with the given ticker, matured or not
    req = create_request(service='//blp/instruments', request='curveListRequest')
    req.set("query","SOFR") #keep it empty to find all
    req.set("maxResults", 10)

result following

result CID: {[ valueType=AUTOGEN classId=0 value=3 ]}
RequestId: 9b3f7e8a-0e3b-4b7b-a7b4-c499e9f4b2a3
CurveListResponse = {
    results[] = {
        results = {
            curve = "YCSW0490 Index"
            description = "USD SOFR (vs. FIXED RATE)"
            country = "US"
            currency = "USD"
            curveid = "S490"
            type[] = {
                IRS
            }
            subtype[] = {
                RATE
            }
            publisher = "Bloomberg"
            bbgid = ""
        }
        results = {
            curve = "YCGT0806 Index"
            description = "US SOFR Swap Spreads Curve"
            country = "US"
            currency = "USD"
            curveid = "I806"
            type[] = {
                IRS
            }
            subtype[] = {
                SPREAD, SPREAD
            }
            publisher = "Bloomberg"
            bbgid = ""
        }
    }
  }

Now i want to search for all the available securities under curve index such as YCSW0490 Index

i am assuming i need to use this but i am unable to find security under any of the curve index

def allInstruments(): #Return all govts with the given ticker, matured or not
    req = create_request(service='//blp/instruments', request='instrumentListRequest')
    req.set('query', "")
    req.set('maxResults', 10)
1

There are 1 answers

0
DS_London On

Once you have the curve ticker eg YCSW0490 Index then use either of the bulk data fields (CURVE_TENOR_RATES or PAR_CURVE) and extract the curve members using the xbbg function bds():

from xbbg import blp

curveTicker = 'YCSW0490 Index'
bbgFld = 'PAR_CURVE'
constituents = blp.bds(curveTicker,bbgFld)

print(constituents)

which yields (partially, in Jupyter):

                          ticker tenor        date point_type      rate   
YCSW0490 Index  USOSFR1Z  Curncy  1 WK  2023-12-22       SWAP  5.xxxxx  \
YCSW0490 Index  USOSFR2Z  Curncy  2 WK  2023-12-29       SWAP  5.xxxxx   
YCSW0490 Index  USOSFR3Z  Curncy  3 WK  2024-01-05       SWAP  5.xxxxx   
YCSW0490 Index  USOSFRA   Curncy  1 MO  2024-01-16       SWAP  5.xxxxx   
YCSW0490 Index  USOSFRB   Curncy  2 MO  2024-02-15       SWAP  5.xxxxx   

                discount_factor  flavor price_condition score  
YCSW0490 Index         0.9xxxxx       0             Mid        
YCSW0490 Index         0.9xxxxx       0             Mid        
YCSW0490 Index         0.9xxxxx       0             Mid        
YCSW0490 Index         0.9xxxxx       0             Mid        
YCSW0490 Index         0.9xxxxx       0             Mid