Classifications API

  • SECTIONS
  • Overview
  • API Definition
  • SDK Libraries
  • Notebooks
  • Code Snippet
  • Changelog
Overview

The Classifications API gives access to various Industry Classifications for a given list of securities. Beginning first with GICS Direct, the service will then expand to offering NAICS, SIC, RBICS, and more.

API Definition
SDK Libraries
Notebooks
Getting Started - Jupyter Notebook
Code Snippet
# Content API - Classifications API- gics - code snippet
# This snippet demonstrates basic features of the Classifications API by walking through the following steps:
#   1. Import Python packages
#   2. Enter your Username and API Key for authorization
#   3. For each Classifications API endpoint, create request objects and display the results in a Pandas DataFrame
#          a.Create a request object and set the parameters
#          b.Create a POST Request and Data Frame
# 1. Import the required packages
import requests
import json
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
from pandas.io.json import json_normalize
# 2. Create a connection object
# Enter your credentials for 'Username' and 'API Key' variables below.
# To generate an API key, visit (https://developer.factset.com/authentication) for more details on Authentication.
authorization = ('USERNAME-SERIALNUMBER','API-KEY')
# 3.0 Classifications API Endpoint Details
# 3.1 GICS -Gets the The Global Industry Classification Standard ("GICS") Sectors, Industry Group, Industry, and Sub-Industry Names and Numbers for a requested list of ids and date range.
# 3.1a `/classifications/v1/gics`  - Create a request object and set the parameters
gics_endpoint = 'https://api.factset.com/content/classifications/v1/gics'

gics_request = {
  "ids": [
    "AAPL-US"
  ],
  "startDate": "2018-12-31",
  "endDate": "2019-12-31",
  "frequency": "M",
  "calendar": "FIVEDAY"
}
headers = {'Accept': 'application/json','Content-Type': 'application/json'}
# 3.1b `/classifications/v1/gics` - Pull data, display DataFrame properties, show records
gics_post = json.dumps(gics_request)
gics_response = requests.post(url = gics_endpoint, data=gics_post, auth = authorization, headers = headers, verify= False )
print('HTTP Status: {}'.format(gics_response.status_code))
#create a dataframe from POST request, show dataframe properties
regions_data = gics_response.json()
regions_df = json_normalize(regions_data['data'])
print('COLUMNS:')
print('')
print(regions_df.dtypes)
print('')
print('RECORDS:',len(regions_df))
#Display the last 5 records for select columns
print(regions_df.tail())             
Changelog

1.0.1

Summary

Bug Fix: Enables GICS classifications for various global regions.

Bug Fixes

Minor Bug fix which resolves issue when trying to fetch GICS Classifications from various global regions. No changes to interface or service. Users will automatically pick up the global coverage if permissioned to do so.