Skip to main content

FactSet ESG client library for Python

Project description

FactSet

FactSet ESG client library for Python

PyPi Apache-2 license

FactSet ESG (powered by FactSet Truvalue Labs) applies machine learning to uncover risks and opportunities from companies' Environmental, Social and Governance (ESG) behavior, which are aggregated and categorized into continuously updated, material ESG scores. The service focuses on company ESG behavior from external sources and includes both positive and negative events that go beyond traditional sources of ESG risk data.

FactSet ESG extracts, analyzes, and generates scores from millions of documents each month collected from more than 100,000 data sources in over 13 languages. Sources include news, trade journals, NGOs, watchdog groups, trade blogs, industry reports and social media. Products deliver investable insights by revealing value and risk factors from unstructured data at the speed of current events.

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 1.1.0
  • Package version: 0.9.1
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

Requirements

  • Python >= 3.6

Installation

Poetry

poetry add fds.sdk.utils fds.sdk.FactSetESG

pip

pip install fds.sdk.utils fds.sdk.FactSetESG

Usage

  1. Generate authentication credentials.
  2. Setup Python environment.
    1. Install and activate python 3.6+. If you're using pyenv:

      pyenv install 3.9.7
      pyenv shell 3.9.7
      
    2. (optional) Install poetry.

  3. Install dependencies.
  4. Run the following:
from fds.sdk.utils.authentication import ConfidentialClient
import fds.sdk.FactSetESG
from fds.sdk.FactSetESG.api import sasb_api
from fds.sdk.FactSetESG.model.error_response import ErrorResponse
from fds.sdk.FactSetESG.model.sasb_ranks_request import SasbRanksRequest
from fds.sdk.FactSetESG.model.sasb_ranks_response import SasbRanksResponse
from fds.sdk.FactSetESG.model.sasb_scores_all_request import SasbScoresAllRequest
from fds.sdk.FactSetESG.model.sasb_scores_all_response import SasbScoresAllResponse
from fds.sdk.FactSetESG.model.sasb_scores_request import SasbScoresRequest
from fds.sdk.FactSetESG.model.sasb_scores_response import SasbScoresResponse
from pprint import pprint

# See configuration.py for a list of all supported configuration parameters.

# Examples for each supported authentication method are below,
# choose one that satisfies your use case.

# (Preferred) OAuth 2.0: FactSetOAuth2
# See https://github.com/FactSet/enterprise-sdk#oauth-20
# for information on how to create the app-config.json file
# See https://github.com/FactSet/enterprise-sdk-utils-python#authentication
# for more information on using the ConfidentialClient class
configuration = fds.sdk.FactSetESG.Configuration(
    fds_oauth_client = ConfidentialClient('/path/to/app-config.json')
)

# Basic authentication: FactSetApiKey
# See https://github.com/FactSet/enterprise-sdk#api-key
# for information how to create an API key
# configuration = fds.sdk.FactSetESG.Configuration(
#     username = 'USERNAME-SERIAL',
#     password = 'API-KEY'
# )

# Enter a context with an instance of the API client
with fds.sdk.FactSetESG.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = sasb_api.SASBApi(api_client)
    ids = ["AAPL-USA"] # [str] | Security or Entity identifiers. FactSet Identifiers, tickers, CUSIP, SEDOL, and ISIN are accepted inputs. <p>***ids limit** =  1000 per request*</p> *<p>Make note, GET Method URL request lines are also limited to a total length of 8192 bytes (8KB). In cases where the service allows for thousands of ids, which may exceed this request line limit of 8KB, its advised for any requests with large request lines to be requested through the respective \"POST\" method.</p>* 
categories = ["ALLCATEGORIES","MATERIALITY"] # [str] | The Categories representing overall or composite rankings from all underlying 26 SASB Categories.  ### SASB Categories |**SASB Category Inputs**|**Description**| |---|---| |**ALLCATEGORIES**|**All Categories** - The company's overall SASB Rank. This value is equal to the cumulative average of all 26 SASB categories. |**MATERIALITY**|**Materiality** - The composite rank of all 'material' SASB categories for the given entity. For more information on SASB's Materiality Map, visit [materiality.sasb.org](https://materiality.sasb.org/)|  ### Helper Input **ALL** = Simply gives the ability to request all categories in a single request without having to explicitly list each available category.   (optional) (default to ["ALL"])
start_date = "2018-12-31" # str | The start date requested for a given date range in **YYYY-MM-DD** format. If left blank, the API will default to latest available completed period.  (optional)
end_date = "2019-12-31" # str | The end date requested for a given date range in **YYYY-MM-DD** format. If left blank, the API will default to latest available completed period.  (optional)
frequency = "D" # str | Controls the display frequency of the data returned.   * **D** = Daily   * **W** = Weekly, based on the last day of the week of the start date.   * **M** = Monthly, based on the last trading day of the month.   * **CY** = Calendar Annual, based on the last trading day of the calendar year.  (optional) (default to "D")

    try:
        # Gets ESG Rankings for a requested list of ids and dates.
        api_response = api_instance.get_sasb_ranks(ids, categories=categories, start_date=start_date, end_date=end_date, frequency=frequency)
        pprint(api_response)
    except fds.sdk.FactSetESG.ApiException as e:
        print("Exception when calling SASBApi->get_sasb_ranks: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://api.factset.com/content

Class Method HTTP request Description
SASBApi get_sasb_ranks GET /factset-esg/v1/sasb-ranks Gets ESG Rankings for a requested list of ids and dates.
SASBApi get_sasb_ranks_post POST /factset-esg/v1/sasb-ranks Get ESG Ranks for a large list of ids and specified date range.
SASBApi get_sasb_scores GET /factset-esg/v1/sasb-scores Gets short-term, long-term, and momentum scores based on the 26 ESG categories defined by the Sustainability Accounting Standards Board (SASB).
SASBApi get_sasb_scores_all GET /factset-esg/v1/sasb-scores-all Gets a flat key value array of scores for named categories of the input scoreType(s).
SASBApi get_sasb_scores_all_post POST /factset-esg/v1/sasb-scores-all Gets a flat key value array of scores for named categories of the input score type(s).
SASBApi get_sasb_scores_post POST /factset-esg/v1/sasb-scores For a large list of ids, gets short-term, long-term, and momentum scores based on the 26 ESG categories defined by the Sustainability Accounting Standards Board (SASB).
SDGApi get_sdg_scores GET /factset-esg/v1/sdg-scores Gets short-term, long-term, and momentum scores based on the 16 Sustainable Development Goals categories defined by the United Nations.
SDGApi get_sdg_scores_post POST /factset-esg/v1/sdg-scores Gets short-term, long-term, and momentum scores based on the 16 Sustainable Development Goals categories defined by United Nations.

Documentation For Models

Documentation For Authorization

FactSetApiKey

  • Type: HTTP basic authentication

FactSetOAuth2

  • Type: OAuth
  • Flow: application
  • Authorization URL:
  • Scopes: N/A

Notes for Large OpenAPI documents

If the OpenAPI document is large, imports in fds.sdk.FactSetESG.apis and fds.sdk.FactSetESG.models may fail with a RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:

Solution 1: Use specific imports for apis and models like:

  • from fds.sdk.FactSetESG.api.default_api import DefaultApi
  • from fds.sdk.FactSetESG.model.pet import Pet

Solution 2: Before importing the package, adjust the maximum recursion limit as shown below:

import sys
sys.setrecursionlimit(1500)
import fds.sdk.FactSetESG
from fds.sdk.FactSetESG.apis import *
from fds.sdk.FactSetESG.models import *

Contributing

Please refer to the contributing guide.

Copyright

Copyright 2022 FactSet Research Systems Inc

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fds.sdk.FactSetESG-0.9.1-py3-none-any.whl (155.9 kB view details)

Uploaded Python 3

File details

Details for the file fds.sdk.FactSetESG-0.9.1-py3-none-any.whl.

File metadata

  • Download URL: fds.sdk.FactSetESG-0.9.1-py3-none-any.whl
  • Upload date:
  • Size: 155.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.15

File hashes

Hashes for fds.sdk.FactSetESG-0.9.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0064f4b893f05d91338cbbc8c4a82f173036f8c4776bdbe93327612de1156613
MD5 671f5078b3e0f812357c318fba53fc72
BLAKE2b-256 1ad2de81b710010bb252aaf5f167d7601aef03b9cfada11cfac86aa0672c7cd5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page