Do we have an option to retrieve SDC New issues data in API?

Mae
Mae LSEG
edited February 20 in Eikon Data APIs

Client provided code:

import eikon as ek
import pandas as pd
import logging
import time # Configure logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')   # Set your Eikon API key
API_KEY = ''
ek.set_app_key(API_KEY)   # Define fields to query
fields = [
    'TR.NIBPSToBenchmark',
    'TR.NIBenchmarkTreasuryDesc',
    #"TR.NICollateralAssetType(Concat='|')",
    #"TR.NICollateralAssetTypeNation(Concat='|')",
    'TR.NIConversionCurrency',
    'TR.NICouponPaymentFrequency',
    'TR.NICouponRate',
    'TR.NICouponType',
    'TR.NIEbitLtmBeforeOffering',
    'TR.NIEbitdaBeforeOffering',
    'TR.NIFinalMaturityYearPrint',
    'TR.NIIsDualCurrencyIssue',
    'TR.NIIsOverSubscribed',
    'TR.NIIsSupranational',
    'TR.NIIssueDate()',
    "TR.NIIssueType(Concat = '|')",
    'TR.NIIssuer',
    #'TR.NIIssuerEmployee',
    #'TR.NIIssuerEmployeeDate',
    "TR.NIIssuerExchTicker(Concat = '|')",
    #'TR.NIIssuerNaics',
    'TR.NIIssuerNaics2022',
    'TR.NIIssuerNation',
    'TR.NIIssuerShortName',
    'TR.NIIssuerUltParentNation',
    #'TR.NIIssuerUltParentPrimayTickerSymbol',
    'TR.NIIssuerUltParentShortName',
    'TR.NIIssuerUltParent', 
    #'TR.NIIssuerUltParentNaics', 
    'TR.NIIssuerUltParentNaics2022',
    'TR.NIMarketValueBeforeOffer',
    'TR.NIOfferCurrency',
    'TR.NIOfferPrice',
    'TR.NIPkgOfferCurrency',
    #"TR.NIPrimaryStockExch(Concat = '|')",
    'TR.NIPrimaryTickerSymbol',
    "TR.NIPrimaryUseOfProceeds(Concat = '|')",
    'TR.NIPrincipalAmtAllMkts',
    'TR.NIPrincipalAmtThisMkt',
    'TR.NIProceedsAmtAllMkts',
    #'TR.NIProceedsAmtInclOverallotSoldAllMkts',
    'TR.NIRedemptionHasPerpetualMaturity',
    'TR.NIRedemptionMaturityDate',
    #'TR.NIRedemptionMaturityDatePrint',
    #'TR.NIRedemptionMaturityType',
    'TR.NIRedemptionNumOfYrToMaturity',
    "TR.NITargetMarket(Concat ='|')",
    #'TR.NITotalAssetsBeforeOffering',
    #'TR.NITotalDebtAfter',
    #'TR.NITotalRevenuesBeforeOffering',
    'TR.NITransactionStatus', 
    'TR.NIPubMid', 
    'TR.NIPubStatus', 
    'TR.NIIssuerPublicStatus', 
    'TR.NIIssuerUltParentPublicStatus', 
    'TR.NIIssuerPublicMid', 
    'TR.NIRatingsMoodysDebt', 
    'TR.NIRatingsFitchLongTermDebt', 
    'TR.NIRatingsIsHighYieldRated', 
    'TR.NIRatingsMoodysSeniorOSDebt', 
    #'TR.NIRedemptionOfferYieldToMaturityOrPutPct', 
    #'TR.NIPfdStockYieldPct', 
    'TR.NIOfferPricePct', 
    'TR.NIOfferPriceUniform', 
    'TR.NIIssuerSEDOL',
    'TR.NIIssuerUltParentSEDOL',
    'TR.NIIssuerUltParentSDCCusip',
    'TR.NISDCCusip',
    'TR.NIIssuerCusip9',
    'TR.NIISINAtOffer',
    #"TR.NIHasCouponFrequencyMismatch",
    #"TR.NICouponFloatLimitation",
    #"TR.NICouponTypeSector",
    #"TR.NICouponDayCountConvention",
    #"TR.NIFloatingRateCouponFreq",
    #"TR.NIFirstCouponDate",
    #"TR.NIInitialCouponPayment",
    #"TR.NIIsFloatingRateIssue",
    #"TR.NIFloatingRateIndex",
    #"TR.NIFloatingRateFloatSpread",
    #"TR.NIPkgDealId",
    #"TR.NIPkgOfferCurrency",
    #"TR.NISdcPackageNumber",
    #"TR.NINumTranchesInPackage",
    #"TR.NIIsMainTranche",
    #"TR.NIHasMultBookRunnersAcrossTranches",
    #"TR.NIParticipant",
    #"TR.NIDealID",
    #"TR.DealEventDealId",
    "TR.NIProceedsAmtThisMkt"
]   # Define years range
years = range(1996, 1998)   # Loop through each year
for year in years:
    # Define date ranges for each quarter
    date_ranges = [
        (f'{year}0101', f'{year}0331', 'Q1'),
        (f'{year}0401', f'{year}0630', 'Q2'),
        (f'{year}0701', f'{year}0930', 'Q3'),
        (f'{year}1001', f'{year}1231', 'Q4')
    ]

    # Loop through each quarter of the year
    for start_date, end_date, quarter in date_ranges:
        # Set universe of search to bond new issuance
        universe = (f"SCREEN(U(IN(DEALS)/*UNV:DEALSBOND*/), TR.NIisECM = False, "
                    f"BETWEEN(TR.NIIssueDate(IncludeNull = True), {start_date}, {end_date})/*dt:Date*/)")           # Fetch data with retry mechanism
        retries = 3
        for attempt in range(retries):
            try:
                df_issuance, err = ek.get_data(universe, fields)

                if err:
                    logging.error(f"Error fetching data for {start_date} to {end_date}: {err}")
                    if attempt < retries - 1:
                        logging.info(f"Retrying... ({attempt + 1}/{retries})")
                        time.sleep(10)  # Wait before retrying
                    continue

                # Log the shape of the DataFrame instead of displaying it
                logging.info(f"Fetched data for {start_date} to {end_date}: {df_issuance.shape[0]} rows")                   # Export dataset to Excel
                output_file = f"SDC New Issues/New Issues_{start_date}_to_{end_date}.xlsx"
                df_issuance.to_excel(output_file, header=True, index=True)
                logging.info(f"Data for {start_date} to {end_date} saved to {output_file}")
                break  # Exit the retry loop if successful               except Exception as e:
                logging.error(f"Exception occurred for {start_date} to {end_date} on attempt {attempt + 1}: {e}")
                if attempt < retries - 1:
                    logging.info(f"Retrying... ({attempt + 1}/{retries})")
                    time.sleep(10)  # Wait before retrying

Answers

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @Mae

    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 MyAccount. 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 can ask for the TR.XXX fields that can provide the required data or the Workspace application that can retrieve the required data. Then, I can check if the data can be retrieved via the Python code.