Package: sec-cik-mapper
sec-cik-mappersec-cik-mapperis a Python package for generating mappings between stock and mutual fund identifier data provided by the SEC.FeaturesGenerate up-to-date mappings from the SEC as native Python dictionariesMappings for both stocks and mutual fundsMapping data exposed as a raw pandas dataframe for custom data processing and usageFull support for PEP 484-style type hints and themypy type checkerPre-generated mappings, updated daily, available from GitHub and jsDelivr for use outside of PythonSupport for Python 3.6+Quick StartInstallationInstall and update this package usingpip:$pipinstall-Usec-cik-mapperBasic UsageStocks>>>fromsec_cik_mapperimportStockMapper>>>frompathlibimportPath# Initialize a stock mapper instance>>>mapper=StockMapper()# Get mapping from CIK to tickers>>>mapper.cik_to_tickers{'0000320193':{'AAPL'},'0000789019':{'MSFT'},'0001652044':{'GOOG','GOOGL'},...}# Get mapping from ticker to CIK>>>mapper.ticker_to_cik{'AAPL':'0000320193','MSFT':'0000789019','GOOG':'0001652044',...}# Get mapping from CIK to company name>>>mapper.cik_to_company_name{'0000320193':'Apple Inc.','0000789019':'Microsoft Corp','0001652044':'Alphabet Inc.',...}# Get mapping from ticker to company name>>>mapper.ticker_to_company_name{'AAPL':'Apple Inc.','MSFT':'Microsoft Corp','GOOG':'Alphabet Inc.',...}# Get mapping from ticker to exchange>>>mapper.ticker_to_exchange{'AAPL':'Nasdaq','MSFT':'Nasdaq','GOOG':'Nasdaq',...}# Get mapping from exchange to tickers>>>mapper.exchange_to_tickers{'Nasdaq':{'CYRN','OHPAW','SANW',...},'NYSE':{'PLAG','TDW-WTB','RS',...},'OTC':{'ZICX','LTGJ','AVNI',...},...}# Get mapping from CIK to exchange>>>mapper.cik_to_exchange{'0000320193':'Nasdaq','0000789019':'Nasdaq','0001652044':'Nasdaq',...}# Get mapping from exchange to CIKs>>>mapper.exchange_to_ciks{'Nasdaq':{'0000779544','0001508171','0001060955',...},'NYSE':{'0000764478','0000008818','0001725057',...},'OTC':{'0001044676','0001592411','0001284452',...},...}# Save CIK, ticker, exchange, and company name mappings to a CSV file>>>csv_path=Path("example_mappings.csv")>>>mapper.save_metadata_to_csv(csv_path)# Get raw pandas dataframe>>>mapper.raw_dataframeCIKTickerNameExchange00000001750AIRAarCorpNYSE10000001800ABTAbbottLaboratoriesNYSE20000001961WDDDWorldsIncOTC30000002098ACUAcmeUnitedCorpNYSE40000002178AEAdamsResources&Energy,Inc.NYSE...............131670001894057PPYAPapayaGrowthOpportunityCorp.I131680001894370HMACHainanManasluAcquisitionCorp.131690001894630GHIXGoresHoldingsIx,Inc.131700001897941GTENGoresHoldingsX,Inc.131710001898416ALVOAlvotechLuxHoldingsS.A.S.[13172rowsx4columns]Mutual Funds>>>fromsec_cik_mapperimportMutualFundMapper>>>frompathlibimportPath# Initialize a mutual fund mapper instance>>>mapper=MutualFundMapper()# Get mapping from CIK to tickers>>>mapper.cik_to_tickers{'0000002110':{'CRBYX','CEFZX','CSSRX',...},'0000002646':{'IIBPX','IPISX','IIBTX',...},'0000002663':{'IMSXX','VMTXX','IVMXX',...},...}# Get mapping from ticker to CIK>>>mapper.ticker_to_cik{'LACAX':'0000002110','LIACX':'0000002110','ACRNX':'0000002110',...}# Get mapping from CIK to series ID>>>mapper.cik_to_series_ids{'0000002110':{'S000009184','S000033622','S000009185',...},'0000002646':{'S000008760'},'0000002663':{'S000008702'},...}# Get mapping from ticker to series ID>>>mapper.ticker_to_series_id{'LACAX':'S000009184','LIACX':'S000009184','ACRNX':'S000009184',...}# Get mapping from series ID to CIK>>>mapper.series_id_to_cik{'S000009184':'0000002110','S000009185':'0000002110','S000009186':'0000002110',...}# Get mapping from series ID to tickers>>>mapper.series_id_to_tickers{'S000009184':{'CEARX','CRBYX','ACRNX',...},'S000009185':{'ACINX','CACRX','CAIRX',...},'S000009186':{'LAUCX','LAUAX','CUSAX',...},...}# Get mapping from series ID to class IDs>>>mapper.series_id_to_class_ids{'S000009184':{'C000024956','C000122737','C000024957',...},'S000009185':{'C000024958','C000122739','C000097733',...},'S000009186':{'C000024962','C000024964','C000122740',...},...}# Get mapping from ticker to class ID>>>mapper.ticker_to_class_id{'LACAX':'C000024954','LIACX':'C000024956','ACRNX':'C000024957',...}# Get mapping from CIK to class IDs>>>mapper.cik_to_class_ids{'0000002110':{'C000024958','C000024969','C000024957',...},'0000002646':{'C000023849','C000074893','C000028785',...},'0000002663':{'C000023718','C000028786','C000076529',...},...}# Get mapping from class ID to CIK>>>mapper.class_id_to_cik{'C000024954':'0000002110','C000024956':'0000002110','C000024957':'0000002110',...}# Get mapping from class ID to ticker>>>mapper.class_id_to_ticker{'C000024954':'LACAX','C000024956':'LIACX','C000024957':'ACRNX',...}# Save CIK, ticker, series ID, and class ID mappings to a CSV file>>>csv_path=Path("mutual_fund_mappings.csv")>>>mapper.save_metadata_to_csv(csv_path)# Get raw pandas dataframe>>>mapper.raw_dataframeCIKTickerSeriesIDClassID00000002110ACFFXS000009188C00002497310000002110ACINXS000009185C00002496120000002110ACRNXS000009184C00002495730000002110ACTWXS000009187C00002496940000002110AUSAXS000009186C000024965...............292360001860434INNOS000073580C000230585292370001860434SIFIS000072556C000228889292380001860434SIHYS000072555C000228888292390001877493BTFS000074058C000231452292400001877493VBBS000075054C000233857[29241rowsx4columns]Supported MappingsMappings can be formed between the following SEC identifiers and metadata:KeyValueStockMapperMutualFundMapperCIKSet(Tickers)✅✅CIKCompany Name✅CIKExchange✅ExchangeSet(CIKs)✅ExchangeSet(Tickers)✅TickerCIK✅✅TickerCompany Name✅TickerExchange✅CIKSet(Series IDs)✅CIKSet(Class IDs)✅Class IDCIK✅Class IDTicker✅Series IDCIK✅Series IDSet(Class IDs)✅Series IDSet(Tickers)✅TickerClass ID✅TickerSeries ID✅Pre-generated MappingsPre-generated mappings are also available for download and use outside of Python (e.g. manually or via automated scripts/curl requests). These mappings are updated daily via afully automated daily CRON job, which fetches, transforms, validates, and uploads the latest mapping data from the SEC to GitHub (save location:sec-cik-mapper/mappings · GitHub). These mappings are available for download and usage from both GitHub and thejsDelivr CDN.Example UsageExamplecurlcommands, which download the specified mapping files and saves them to the current working directory:StocksHosted via GitHub:$curlhttps://raw.githubusercontent.com/jadchaar/sec-cik-mapper/main/mappings/stocks/mappings.csv-O$curlhttps://raw.githubusercontent.com/jadchaar/sec-cik-mapper/main/mappings/stocks/cik_to_exchange.json-O$curlhttps://raw.githubusercontent.com/jadchaar/sec-cik-mapper/main/mappings/stocks/cik_to_tickers.json-O$curlhttps://raw.githubusercontent.com/jadchaar/sec-cik-mapper/main/mappings/stocks/ticker_to_exchange.json-O$curlhttps://raw.githubusercontent.com/jadchaar/sec-cik-mapper/main/mappings/stocks/cik_to_company_name.json-O$curlhttps://raw.githubusercontent.com/jadchaar/sec-cik-mapper/main/mappings/stocks/ticker_to_cik.json-O$curlhttps://raw.githubusercontent.com/jadchaar/sec-cik-mapper/main/mappings/stocks/ticker_to_company_name.json-O$curlhttps://raw.githubusercontent.com/jadchaar/sec-cik-mapper/main/mappings/stocks/exchange_to_tickers.json-O$curlhttps://raw.githubusercontent.com/jadchaar/sec-cik-mapper/main/mappings/stocks/exchange_to_ciks.json-OHosted via jsDelivr CDN:$curlhttps://cdn.jsdelivr.net/gh/jadchaar/sec-cik-mapper@main/mappings/stocks/mappings.csv-O$curlhttps://cdn.jsdelivr.net/gh/jadchaar/sec-cik-mapper@main/mappings/stocks/cik_to_exchange.json-O$curlhttps://cdn.jsdelivr.net/gh/jadchaar/sec-cik-mapper@main/mappings/stocks/cik_to_tickers.json-O$curlhttps://cdn.jsdelivr.net/gh/jadchaar/sec-cik-mapper@main/mappings/stocks/ticker_to_exchange.json-O$curlhttps://cdn.jsdelivr.net/gh/jadchaar/sec-cik-mapper@main/mappings/stocks/cik_to_company_name.json-O$curlhttps://cdn.jsdelivr.net/gh/jadchaar/sec-cik-mapper@main/mappings/stocks/ticker_to_cik.json-O$curlhttps://cdn.jsdelivr.net/gh/jadchaar/sec-cik-mapper@main/mappings/stocks/ticker_to_company_name.json-O$curlhttps://cdn.jsdelivr.net/gh/jadchaar/sec-cik-mapper@main/mappings/stocks/exchange_to_tickers.json-O$curlhttps://cdn.jsdelivr.net/gh/jadchaar/sec-cik-mapper@main/mappings/stocks/exchange_to_ciks.json-OMutual FundsHosted via GitHub:$curlhttps://raw.githubusercontent.com/jadchaar/sec-cik-mapper/main/mappings/mutual_funds/ticker_to_class_id.json-O$curlhttps://raw.githubusercontent.com/jadchaar/sec-cik-mapper/main/mappings/mutual_funds/series_id_to_class_ids.json-O$curlhttps://raw.githubusercontent.com/jadchaar/sec-cik-mapper/main/mappings/mutual_funds/mappings.csv-O$curlhttps://raw.githubusercontent.com/jadchaar/sec-cik-mapper/main/mappings/mutual_funds/cik_to_class_ids.json-O$curlhttps://raw.githubusercontent.com/jadchaar/sec-cik-mapper/main/mappings/mutual_funds/cik_to_series_ids.json-O$curlhttps://raw.githubusercontent.com/jadchaar/sec-cik-mapper/main/mappings/mutual_funds/series_id_to_cik.json-O$curlhttps://raw.githubusercontent.com/jadchaar/sec-cik-mapper/main/mappings/mutual_funds/ticker_to_series_id.json-O$curlhttps://raw.githubusercontent.com/jadchaar/sec-cik-mapper/main/mappings/mutual_funds/cik_to_tickers.json-O$curlhttps://raw.githubusercontent.com/jadchaar/sec-cik-mapper/main/mappings/mutual_funds/class_id_to_cik.json-O$curlhttps://raw.githubusercontent.com/jadchaar/sec-cik-mapper/main/mappings/mutual_funds/series_id_to_tickers.json-O$curlhttps://raw.githubusercontent.com/jadchaar/sec-cik-mapper/main/mappings/mutual_funds/class_id_to_ticker.json-O$curlhttps://raw.githubusercontent.com/jadchaar/sec-cik-mapper/main/mappings/mutual_funds/ticker_to_cik.json-OHosted via jsDelivr CDN:$curlhttps://cdn.jsdelivr.net/gh/jadchaar/sec-cik-mapper@main/mappings/mutual_funds/ticker_to_class_id.json-O$curlhttps://cdn.jsdelivr.net/gh/jadchaar/sec-cik-mapper@main/mappings/mutual_funds/series_id_to_class_ids.json-O$curlhttps://cdn.jsdelivr.net/gh/jadchaar/sec-cik-mapper@main/mappings/mutual_funds/mappings.csv-O$curlhttps://cdn.jsdelivr.net/gh/jadchaar/sec-cik-mapper@main/mappings/mutual_funds/cik_to_class_ids.json-O$curlhttps://cdn.jsdelivr.net/gh/jadchaar/sec-cik-mapper@main/mappings/mutual_funds/cik_to_series_ids.json-O$curlhttps://cdn.jsdelivr.net/gh/jadchaar/sec-cik-mapper@main/mappings/mutual_funds/series_id_to_cik.json-O$curlhttps://cdn.jsdelivr.net/gh/jadchaar/sec-cik-mapper@main/mappings/mutual_funds/ticker_to_series_id.json-O$curlhttps://cdn.jsdelivr.net/gh/jadchaar/sec-cik-mapper@main/mappings/mutual_funds/cik_to_tickers.json-O$curlhttps://cdn.jsdelivr.net/gh/jadchaar/sec-cik-mapper@main/mappings/mutual_funds/class_id_to_cik.json-O$curlhttps://cdn.jsdelivr.net/gh/jadchaar/sec-cik-mapper@main/mappings/mutual_funds/series_id_to_tickers.json-O$curlhttps://cdn.jsdelivr.net/gh/jadchaar/sec-cik-mapper@main/mappings/mutual_funds/class_id_to_ticker.json-O$curlhttps://cdn.jsdelivr.net/gh/jadchaar/sec-cik-mapper@main/mappings/mutual_funds/ticker_to_cik.json-OContributingIf you encounter a bug or would like to see a new company filing or feature added tosec-cik-mapper, pleasefile an issueorsubmit a pull request.DocumentationFor full documentation, please visitsec-cik-mapper.readthedocs.io.