How to retrieve Historical Data for Bid-Ask Yield and Bid-Ask Spread forBonds

Options

I want to download the Bid-Ask Yield spread.
But I am not sure which field I need to use.

Below is my python code to download the bid, ask,mid yields.

I hope you can help me to find an appropriate field for bid-ask spread.

Currently using below

fields = ['B_YLD_1', 'A_YLD_1', 'MID_YLD_1', 'YLDTOMAT']


fields_length = len(fields)
st = "2000-01-01"
ed = "2025-12-31"
for idx in tqdm(range(fields_length), 'Retrieving the historical data'):
field = fields[idx]
df_ylds = rd.get_history(
universe=rrps_isin_lists,
fields=[field],
start= st,
end=ed,
interval="1D"
)
df_ylds = df_ylds.dropna(axis=1, how='all')
df_ylds.to_csv(rf'./Refinitiv/Output/{20250625}_{field}_df.csv')

Answers

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @gina.dulla

    Thank you for reaching out to us.

    This forum is dedicated to software developers using LSEG APIs. The moderators on this forum do not have deep expertise in every bit of content available through LSEG products, which is required to answer content questions such as this one.

    The best resource for content questions is the Helpdesk support team, which can be reached by submitting queries through LSEG Support. The support team will either have the required content expertise ready available or can reach out to relevant content experts to get the answer for you.

    You need to ask for the Excel formula, such as =RDP.Data, that can be used to retrieve the required data.

    Then, we can help you converting that formula to Python code.

  • Hello @Jirapongse

    Just need assistance in Code Creator or Codebook if we do have workaround on how to retrieve Bid-Ask Spread , just checking if we do have any API Script or log that we can use?

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @gina.dulla

    The data depends on instruments.

    The best resource for content questions is the Helpdesk support team,

    You need to ask for the Excel formula, such as =RDP.Data, that can be used to retrieve the required data.

    Then, we can help you converting that formula to Python code.

    You may use the Data Item Browser tool to search for fields and parameters.