finds.structured.ibes

IBES summary analysts earnings estimates

Copyright 2022-2024, Terence Lim

MIT License

class finds.structured.ibes.IBES(sql: SQL, bd: BusDay, name: str = 'IBES', identifier: str = 'ticker', verbose: int = 0)[source]

Bases: Structured

Provide interface to IBES analyst estimates structured datasets

Parameters:
  • sql – Connection to SQL database

  • bd – Custom business day calendar object

  • name – Name of dataset is “IBES”

  • identifer – Stocks identifier field name is “ticker”

Notes:

  • TICKER: IBES Ticker

  • STATPERS : IBES Statistical Period (monthly)

  • OFTIC: Official Ticker

  • FPEDATS: Forecast Period End Date

  • SDATES: Identification start date

build_lookup(source: str, target: str, date_field='sdates', dataset: str = 'links', fillna: Any = None) Any[source]

Build lookup function to return target identifier from source

get_linked(dataset: str, fields: List[str], date_field: str = 'statpers', link_perm: str = 'permno', link_date: str = 'sdates', where: str = '', limit: int | str | None = None) DataFrame[source]

Query an ibes table, and return with linked crsp permnos

Parameters:
  • dataset – Dataset to query

  • fields – Fields to return

  • date_field – Name of date field in ibes table to query

  • link_perm – Name of permno field in links table

  • link_date – Name of match date in links table

  • where – Sql where clause, as sql string

  • limit – Max number of records to return

Examples:

>>> ibes.get_linked('ident', fields=['cname'], date_field='statpers'):

Notes:

where fpi='6'  /* 1 is for annual forecasts, 6 is for quarterly */
and statpers < ANNDATS_ACT /* forecasts prior to earnings annoucement
and measure='EPS' and not missing(medest)
and not missing(fpedats)  and (fpedats-statpers)>=0;
(fpedats-statpers)>=0;
get_permnos(keys: List[str], date: int, link_perm: str = 'permno', link_date: str = 'sdates', permno: str = 'permno') DataFrame[source]

Return list of permnos mapped to IBES tickers as of a date

Parameters:
  • keys – Input list of IBES tickers to lookup

  • date – Prevailing date of link

Create links table by merging ‘ident’ and CRSP ‘names’ on cusip-8