sbti-finance-tool 1.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sbti_finance_tool-1.1.1/LICENSE +21 -0
- sbti_finance_tool-1.1.1/PKG-INFO +129 -0
- sbti_finance_tool-1.1.1/README.md +113 -0
- sbti_finance_tool-1.1.1/SBTi/__init__.py +8 -0
- sbti_finance_tool-1.1.1/SBTi/configs.py +187 -0
- sbti_finance_tool-1.1.1/SBTi/data/__init__.py +14 -0
- sbti_finance_tool-1.1.1/SBTi/data/bloomberg.py +73 -0
- sbti_finance_tool-1.1.1/SBTi/data/cdp.py +50 -0
- sbti_finance_tool-1.1.1/SBTi/data/csv.py +90 -0
- sbti_finance_tool-1.1.1/SBTi/data/data_provider.py +59 -0
- sbti_finance_tool-1.1.1/SBTi/data/excel.py +85 -0
- sbti_finance_tool-1.1.1/SBTi/data/iss.py +50 -0
- sbti_finance_tool-1.1.1/SBTi/data/msci.py +50 -0
- sbti_finance_tool-1.1.1/SBTi/data/sbti.py +332 -0
- sbti_finance_tool-1.1.1/SBTi/data/trucost.py +50 -0
- sbti_finance_tool-1.1.1/SBTi/data/urgentem.py +48 -0
- sbti_finance_tool-1.1.1/SBTi/inputs/current-Companies-Taking-Action.xlsx +0 -0
- sbti_finance_tool-1.1.1/SBTi/inputs/regression_model_summary.xlsx +0 -0
- sbti_finance_tool-1.1.1/SBTi/inputs/sr15_mapping.xlsx +0 -0
- sbti_finance_tool-1.1.1/SBTi/interfaces.py +171 -0
- sbti_finance_tool-1.1.1/SBTi/portfolio_aggregation.py +199 -0
- sbti_finance_tool-1.1.1/SBTi/portfolio_coverage_tvp.py +40 -0
- sbti_finance_tool-1.1.1/SBTi/target_validation.py +389 -0
- sbti_finance_tool-1.1.1/SBTi/temperature_score.py +708 -0
- sbti_finance_tool-1.1.1/SBTi/utils.py +314 -0
- sbti_finance_tool-1.1.1/pyproject.toml +54 -0
- sbti_finance_tool-1.1.1/sbti_finance_tool.egg-info/PKG-INFO +129 -0
- sbti_finance_tool-1.1.1/sbti_finance_tool.egg-info/SOURCES.txt +35 -0
- sbti_finance_tool-1.1.1/sbti_finance_tool.egg-info/dependency_links.txt +1 -0
- sbti_finance_tool-1.1.1/sbti_finance_tool.egg-info/requires.txt +7 -0
- sbti_finance_tool-1.1.1/sbti_finance_tool.egg-info/top_level.txt +1 -0
- sbti_finance_tool-1.1.1/setup.cfg +4 -0
- sbti_finance_tool-1.1.1/setup.py +36 -0
- sbti_finance_tool-1.1.1/test/test_e2e.py +361 -0
- sbti_finance_tool-1.1.1/test/test_edge_cases.py +138 -0
- sbti_finance_tool-1.1.1/test/test_portfolio_coverage_tvp.py +46 -0
- sbti_finance_tool-1.1.1/test/test_temperature_score.py +217 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 World Resources Institute; Science Based Targets initiative
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sbti-finance-tool
|
|
3
|
+
Version: 1.1.1
|
|
4
|
+
Summary: This package helps companies and financial institutions to assess the temperature alignment of current targets, commitments, and investment and lending portfolios, and to use this information to develop targets for official validation by the SBTi.'
|
|
5
|
+
Author: sbti
|
|
6
|
+
Author-email: finance@sciencebasedtargets.org
|
|
7
|
+
Requires-Python: >=3.7.1
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: openpyxl>=2.5.0
|
|
11
|
+
Requires-Dist: pandas>=1.0.0
|
|
12
|
+
Requires-Dist: numpy<2.0.0,>=1.20.0
|
|
13
|
+
Requires-Dist: pydantic>=1.0.0
|
|
14
|
+
Requires-Dist: requests>=2.0.0
|
|
15
|
+
Requires-Dist: six>=1.16.0
|
|
16
|
+
Requires-Dist: xlrd>=2.0.0
|
|
17
|
+
Dynamic: author
|
|
18
|
+
Dynamic: author-email
|
|
19
|
+
Dynamic: description
|
|
20
|
+
Dynamic: description-content-type
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
Dynamic: requires-dist
|
|
23
|
+
Dynamic: requires-python
|
|
24
|
+
Dynamic: summary
|
|
25
|
+
|
|
26
|
+
> Visit https://sciencebasedtargets.github.io/SBTi-finance-tool/ for the full documentation
|
|
27
|
+
|
|
28
|
+
> If you have any additional questions or comments send a mail to: finance@sciencebasedtargets.org
|
|
29
|
+
|
|
30
|
+
# SBTi Temperature Alignment tool
|
|
31
|
+
|
|
32
|
+
This package helps companies and financial institutions to assess the temperature alignment of current
|
|
33
|
+
targets, commitments, and investment and lending portfolios, and to use this information to develop
|
|
34
|
+
targets for official validation by the SBTi.
|
|
35
|
+
|
|
36
|
+
This tool can be used either as a standalone Python package, a REST API or as a simple webapp which provides a simple skin on the API.
|
|
37
|
+
So, the SBTi toolkit caters for three types of usage:
|
|
38
|
+
|
|
39
|
+
- Users can integrate the Python package in their codebase
|
|
40
|
+
- The tool can be included as a Microservice (containerised REST API) in any IT infrastructure (in the cloud or on premise)
|
|
41
|
+
- As an webapp, exposing the functionality with a simple user interface.
|
|
42
|
+
|
|
43
|
+
To following diagram provides an overview of the different parts of the toolkit:
|
|
44
|
+
|
|
45
|
+
+-------------------------------------------------+
|
|
46
|
+
| UI : Simple user interface on top of API |
|
|
47
|
+
| Install: via dockerhub |
|
|
48
|
+
| docker.io/sbti/ui:latest |
|
|
49
|
+
| |
|
|
50
|
+
| +-----------------------------------------+ |
|
|
51
|
+
| | REST API: Dockerized FastAPI/NGINX | |
|
|
52
|
+
| | Source : github.com/OFBDABV/SBTi_api | |
|
|
53
|
+
| | Install: via source or dockerhub | |
|
|
54
|
+
| | docker.io/sbti/sbti/api:latest | |
|
|
55
|
+
| | | |
|
|
56
|
+
| | +---------------------------------+ | |
|
|
57
|
+
| | | | | |
|
|
58
|
+
| | |Core : Python Module | | |
|
|
59
|
+
| | |Source : github.com/ScienceBasedTargets/ |
|
|
60
|
+
| | | SBTi-finance-tool | | |
|
|
61
|
+
| | |Install: via source or PyPi | | |
|
|
62
|
+
| | | | | |
|
|
63
|
+
| | +---------------------------------+ | |
|
|
64
|
+
| +-----------------------------------------+ |
|
|
65
|
+
+-------------------------------------------------+
|
|
66
|
+
|
|
67
|
+
As shown above the API is dependent on the Python Repo, in the same way the UI requires the API backend. These dependencies are scripted in the Docker files.
|
|
68
|
+
|
|
69
|
+
> This repository only contains the Python module. If you'd like to use the REST API, please refer to [this repository](https://github.com/ScienceBasedTargets/SBTi-finance-tool_api) or the same repository on [Dockerhub](https://docker.io/sbti/sbti/api:latest).
|
|
70
|
+
|
|
71
|
+
## Structure
|
|
72
|
+
|
|
73
|
+
The folder structure for this project is as follows:
|
|
74
|
+
|
|
75
|
+
.
|
|
76
|
+
├── .github # Github specific files (Github Actions workflows)
|
|
77
|
+
├── app # FastAPI app files for the API endpoints
|
|
78
|
+
├── docs # Documentation files (Sphinx)
|
|
79
|
+
├── config # Config files for the Docker container
|
|
80
|
+
├── SBTi # The main Python package for the temperature alignment tool
|
|
81
|
+
└── test # Automated unit tests for the SBTi package (Nose2 tests)
|
|
82
|
+
|
|
83
|
+
## Installation
|
|
84
|
+
|
|
85
|
+
The SBTi package may be installed using PIP. If you'd like to install it locally use the following command. For testing or production please see the deployment section for further instructions
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
pip install -e .
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
For installing the latest stable release in PyPi run:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
pip install sbti
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Development
|
|
98
|
+
|
|
99
|
+
To set up the local dev environment with all dependencies, [install poetry](https://python-poetry.org/docs/#osx--linux--bashonwindows-install-instructions) and run
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
poetry install
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
This will create a virtual environment inside the project folder under `.venv`.
|
|
106
|
+
|
|
107
|
+
### Testing
|
|
108
|
+
|
|
109
|
+
Each class should be unit tested. The unit tests are written using the Nose2 framework.
|
|
110
|
+
The setup.py script should have already installed Nose2, so now you may run the tests as follows:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
nose2 -v
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Publish to PyPi
|
|
117
|
+
|
|
118
|
+
The package should be published to PyPi when any changes to main are merged.
|
|
119
|
+
|
|
120
|
+
Update package
|
|
121
|
+
|
|
122
|
+
1. bump version in `pyproject.toml` based on semantic versioning principles
|
|
123
|
+
2. run `poetry build`
|
|
124
|
+
3. run `poetry publish`
|
|
125
|
+
4. check whether package has been successfully uploaded
|
|
126
|
+
|
|
127
|
+
**Initial Setup**
|
|
128
|
+
|
|
129
|
+
- Create account on [PyPi](https://pypi.org/)
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
> Visit https://sciencebasedtargets.github.io/SBTi-finance-tool/ for the full documentation
|
|
2
|
+
|
|
3
|
+
> If you have any additional questions or comments send a mail to: financialinstitutions@sciencebasedtargets.org
|
|
4
|
+
|
|
5
|
+
# SBTi Temperature Alignment tool
|
|
6
|
+
|
|
7
|
+
This package helps companies and financial institutions to assess the temperature alignment of current
|
|
8
|
+
targets, commitments, and investment and lending portfolios, and to use this information to develop
|
|
9
|
+
targets for official validation by the SBTi.
|
|
10
|
+
|
|
11
|
+
This tool can be used either as a standalone Python package, a REST API or as a simple webapp which provides a simple skin on the API.
|
|
12
|
+
So, the SBTi toolkit caters for three types of usage:
|
|
13
|
+
|
|
14
|
+
- Users can integrate the Python package in their codebase
|
|
15
|
+
- The tool can be included as a Microservice (containerised REST API) in any IT infrastructure (in the cloud or on premise)
|
|
16
|
+
- As an webapp, exposing the functionality with a simple user interface.
|
|
17
|
+
|
|
18
|
+
To following diagram provides an overview of the different parts of the toolkit:
|
|
19
|
+
|
|
20
|
+
+-------------------------------------------------+
|
|
21
|
+
| UI : Simple user interface on top of API |
|
|
22
|
+
| Install: via dockerhub |
|
|
23
|
+
| docker.io/sbti/ui:latest |
|
|
24
|
+
| |
|
|
25
|
+
| +-----------------------------------------+ |
|
|
26
|
+
| | REST API: Dockerized FastAPI/NGINX | |
|
|
27
|
+
| | Source : github.com/OFBDABV/SBTi_api | |
|
|
28
|
+
| | Install: via source or dockerhub | |
|
|
29
|
+
| | docker.io/sbti/sbti/api:latest | |
|
|
30
|
+
| | | |
|
|
31
|
+
| | +---------------------------------+ | |
|
|
32
|
+
| | | | | |
|
|
33
|
+
| | |Core : Python Module | | |
|
|
34
|
+
| | |Source : github.com/ScienceBasedTargets/ |
|
|
35
|
+
| | | SBTi-finance-tool | | |
|
|
36
|
+
| | |Install: via source or PyPi | | |
|
|
37
|
+
| | | | | |
|
|
38
|
+
| | +---------------------------------+ | |
|
|
39
|
+
| +-----------------------------------------+ |
|
|
40
|
+
+-------------------------------------------------+
|
|
41
|
+
|
|
42
|
+
As shown above the API is dependent on the Python Repo, in the same way the UI requires the API backend. These dependencies are scripted in the Docker files.
|
|
43
|
+
|
|
44
|
+
> This repository only contains the Python module. If you'd like to use the REST API, please refer to [this repository](https://github.com/ScienceBasedTargets/SBTi-finance-tool-api) or the same repository on [Dockerhub](https://docker.io/sbti/sbti/api:latest).
|
|
45
|
+
|
|
46
|
+
## Structure
|
|
47
|
+
|
|
48
|
+
The folder structure for this project is as follows:
|
|
49
|
+
|
|
50
|
+
.
|
|
51
|
+
├── .github # Github specific files (Github Actions workflows)
|
|
52
|
+
├── app # FastAPI app files for the API endpoints
|
|
53
|
+
├── docs # Documentation files (Sphinx)
|
|
54
|
+
├── config # Config files for the Docker container
|
|
55
|
+
├── SBTi # The main Python package for the temperature alignment tool
|
|
56
|
+
└── test # Automated unit tests for the SBTi package (Nose2 tests)
|
|
57
|
+
|
|
58
|
+
## Installation
|
|
59
|
+
|
|
60
|
+
The SBTi package may be installed using PIP. If you'd like to install it locally use the following command. For testing or production please see the deployment section for further instructions
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install -e .
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
For installing the latest stable release in PyPi run:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pip install sbti-finance-tool
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Development
|
|
73
|
+
|
|
74
|
+
To set up the local dev environment with all dependencies, [install poetry](https://python-poetry.org/docs/#osx--linux--bashonwindows-install-instructions) and run
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
poetry install
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
This will create a virtual environment inside the project folder under `.venv`.
|
|
81
|
+
|
|
82
|
+
### SBTi Companies Taking Action (CTA) Data
|
|
83
|
+
|
|
84
|
+
The tool supports multiple formats of the SBTi CTA file:
|
|
85
|
+
- **Per-company format** (default, recommended): One row per company with aggregated target status
|
|
86
|
+
- **Per-target format**: Multiple rows per company with detailed target information
|
|
87
|
+
- **Legacy format**: Original Title Case column format
|
|
88
|
+
|
|
89
|
+
The tool automatically detects and handles all formats, defaulting to the per-company format for consistency.
|
|
90
|
+
|
|
91
|
+
### Testing
|
|
92
|
+
|
|
93
|
+
Each class should be unit tested. The unit tests are written using the Nose2 framework.
|
|
94
|
+
The setup.py script should have already installed Nose2, so now you may run the tests as follows:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
nose2 -v
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Publish to PyPi
|
|
101
|
+
|
|
102
|
+
The package should be published to PyPi when any changes to main are merged.
|
|
103
|
+
|
|
104
|
+
Update package
|
|
105
|
+
|
|
106
|
+
1. bump version in `pyproject.toml` based on semantic versioning principles
|
|
107
|
+
2. run `poetry build`
|
|
108
|
+
3. run `poetry publish`
|
|
109
|
+
4. check whether package has been successfully uploaded
|
|
110
|
+
|
|
111
|
+
**Initial Setup**
|
|
112
|
+
|
|
113
|
+
- Create account on [PyPi](https://pypi.org/)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This package helps companies and financial institutions to assess the temperature alignment of current
|
|
3
|
+
targets, commitments, and investment and lending portfolios, and to use this information to develop
|
|
4
|
+
targets for official validation by the SBTi.
|
|
5
|
+
"""
|
|
6
|
+
from . import data
|
|
7
|
+
from . import utils
|
|
8
|
+
from . import temperature_score
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This file defines the constants used throughout the different classes. In order to redefine these settings whilst using
|
|
3
|
+
the module, extend the respective config class and pass it to the class as the "constants" parameter.
|
|
4
|
+
"""
|
|
5
|
+
import os
|
|
6
|
+
|
|
7
|
+
from SBTi.interfaces import ETimeFrames, EScope
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ColumnsConfig:
|
|
11
|
+
# Define a constant for each column used in the
|
|
12
|
+
COMPANY_ID = "company_id"
|
|
13
|
+
COMPANY_ISIN = "company_isin"
|
|
14
|
+
COMPANY_LEI = "company_lei"
|
|
15
|
+
COMPANY_ISIC = "isic"
|
|
16
|
+
REGRESSION_PARAM = "param"
|
|
17
|
+
REGRESSION_INTERCEPT = "intercept"
|
|
18
|
+
MARKET_CAP = "company_market_cap"
|
|
19
|
+
INVESTMENT_VALUE = "investment_value"
|
|
20
|
+
COMPANY_ENTERPRISE_VALUE = "company_enterprise_value"
|
|
21
|
+
COMPANY_EV_PLUS_CASH = "company_ev_plus_cash"
|
|
22
|
+
COMPANY_TOTAL_ASSETS = "company_total_assets"
|
|
23
|
+
TARGET_REFERENCE_NUMBER = "target_type"
|
|
24
|
+
SCOPE = "scope"
|
|
25
|
+
SR15 = "sr15"
|
|
26
|
+
REDUCTION_FROM_BASE_YEAR = "reduction_from_base_year"
|
|
27
|
+
START_YEAR = "start_year"
|
|
28
|
+
VARIABLE = "variable"
|
|
29
|
+
SLOPE = "slope"
|
|
30
|
+
TIME_FRAME = "time_frame"
|
|
31
|
+
MODEL = "model"
|
|
32
|
+
ANNUAL_REDUCTION_RATE = "annual_reduction_rate"
|
|
33
|
+
EMISSIONS_IN_SCOPE = "emissions_in_scope"
|
|
34
|
+
TEMPERATURE_SCORE = "temperature_score"
|
|
35
|
+
COMPANY_NAME = "company_name"
|
|
36
|
+
OWNED_EMISSIONS = "owned_emissions"
|
|
37
|
+
COUNTRY = "country"
|
|
38
|
+
SECTOR = "sector"
|
|
39
|
+
GHG_SCOPE12 = "ghg_s1s2"
|
|
40
|
+
GHG_SCOPE3 = "ghg_s3"
|
|
41
|
+
COMPANY_REVENUE = "company_revenue"
|
|
42
|
+
CASH_EQUIVALENTS = "company_cash_equivalents"
|
|
43
|
+
TARGET_CLASSIFICATION = "target_classification"
|
|
44
|
+
REDUCTION_AMBITION = "reduction_ambition"
|
|
45
|
+
BASE_YEAR = "base_year"
|
|
46
|
+
END_YEAR = "end_year"
|
|
47
|
+
SBTI_VALIDATED = "sbti_validated"
|
|
48
|
+
ACHIEVED_EMISSIONS = "achieved_reduction"
|
|
49
|
+
ISIC = "isic"
|
|
50
|
+
INDUSTRY_LVL1 = "industry_level_1"
|
|
51
|
+
INDUSTRY_LVL2 = "industry_level_2"
|
|
52
|
+
INDUSTRY_LVL3 = "industry_level_3"
|
|
53
|
+
INDUSTRY_LVL4 = "industry_level_4"
|
|
54
|
+
COVERAGE_S1 = "coverage_s1"
|
|
55
|
+
COVERAGE_S2 = "coverage_s2"
|
|
56
|
+
COVERAGE_S3 = "coverage_s3"
|
|
57
|
+
INTENSITY_METRIC = "intensity_metric"
|
|
58
|
+
INTENSITY_METRIC_SR15 = "intensity_metric"
|
|
59
|
+
TARGET_TYPE_SR15 = "target_type"
|
|
60
|
+
SR15_VARIABLE = "sr15_variable"
|
|
61
|
+
REGRESSION_MODEL = "Regression_model"
|
|
62
|
+
BASEYEAR_GHG_S1 = "base_year_ghg_s1"
|
|
63
|
+
BASEYEAR_GHG_S2 = "base_year_ghg_s2"
|
|
64
|
+
BASEYEAR_GHG_S3 = "base_year_ghg_s3"
|
|
65
|
+
REGION = "region"
|
|
66
|
+
ENGAGEMENT_TARGET = "engagement_target"
|
|
67
|
+
|
|
68
|
+
# SR15 mapping columns
|
|
69
|
+
PARAM = "param"
|
|
70
|
+
INTERCEPT = "intercept"
|
|
71
|
+
|
|
72
|
+
# Output columns
|
|
73
|
+
WEIGHTED_TEMPERATURE_SCORE = "weighted_temperature_score"
|
|
74
|
+
CONTRIBUTION_RELATIVE = "contribution_relative"
|
|
75
|
+
CONTRIBUTION = "contribution"
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class PortfolioAggregationConfig:
|
|
79
|
+
COLS = ColumnsConfig
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class TemperatureScoreConfig(PortfolioAggregationConfig):
|
|
83
|
+
|
|
84
|
+
"""
|
|
85
|
+
This factor determines what part of the temperature for a not SBTi-validated company should be the TS and what part
|
|
86
|
+
should be the default score.
|
|
87
|
+
The calculated temperature score should not be lower than the current level of
|
|
88
|
+
global warning which is expressed through the temperature floor constant.
|
|
89
|
+
"""
|
|
90
|
+
|
|
91
|
+
SBTI_FACTOR = 1
|
|
92
|
+
FALLBACK_SCORE: float = 3.2
|
|
93
|
+
TEMPERATURE_FLOOR: float = 0.0 # Set to 1.3 once the method paper has been updated
|
|
94
|
+
FILE_SR15_MAPPING = os.path.join(
|
|
95
|
+
os.path.dirname(os.path.realpath(__file__)), "inputs", "sr15_mapping.xlsx"
|
|
96
|
+
)
|
|
97
|
+
FILE_REGRESSION_MODEL_SUMMARY = os.path.join(
|
|
98
|
+
os.path.dirname(os.path.realpath(__file__)),
|
|
99
|
+
"inputs",
|
|
100
|
+
"regression_model_summary.xlsx",
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
DEFAULT_INDUSTRY = "Others"
|
|
104
|
+
|
|
105
|
+
VALUE_TARGET_REFERENCE_ABSOLUTE = "absolute"
|
|
106
|
+
VALUE_TARGET_REFERENCE_INTENSITY = "intensity"
|
|
107
|
+
VALUE_TARGET_REFERENCE_INTENSITY_BASE = "int"
|
|
108
|
+
|
|
109
|
+
SLOPE_MAP = {
|
|
110
|
+
ETimeFrames.SHORT: "slope5",
|
|
111
|
+
ETimeFrames.MID: "slope15",
|
|
112
|
+
ETimeFrames.LONG: "slope30",
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
INTENSITY_MAPPINGS = {
|
|
116
|
+
("Revenue", EScope.S1S2): "INT.emKyoto_gdp",
|
|
117
|
+
("Revenue", EScope.S3): "INT.emKyoto_gdp",
|
|
118
|
+
("Product", EScope.S1S2): "INT.emKyoto_gdp",
|
|
119
|
+
("Product", EScope.S3): "INT.emKyoto_gdp",
|
|
120
|
+
("Cement", EScope.S1S2): "INT.emKyoto_gdp",
|
|
121
|
+
("Cement", EScope.S3): "INT.emKyoto_gdp",
|
|
122
|
+
("Oil", EScope.S1S2): "INT.emCO2EI_PE",
|
|
123
|
+
("Oil", EScope.S3): "INT.emCO2EI_PE",
|
|
124
|
+
("Steel", EScope.S1S2): "INT.emKyoto_gdp",
|
|
125
|
+
("Steel", EScope.S3): "INT.emKyoto_gdp",
|
|
126
|
+
("Aluminum", EScope.S1S2): "INT.emKyoto_gdp",
|
|
127
|
+
("Aluminum", EScope.S3): "INT.emKyoto_gdp",
|
|
128
|
+
("Power", EScope.S1S2): "INT.emCO2EI_elecGen",
|
|
129
|
+
("Power", EScope.S3): "INT.emCO2EI_elecGen",
|
|
130
|
+
}
|
|
131
|
+
ABSOLUTE_MAPPINGS = {
|
|
132
|
+
("B06", EScope.S1S2): "Emissions|Kyoto Gases",
|
|
133
|
+
("B06", EScope.S3): "Emissions|Kyoto Gases",
|
|
134
|
+
("C23", EScope.S1S2): "Emissions|CO2|Energy and Industrial Processes",
|
|
135
|
+
("C23", EScope.S3): "Emissions|Kyoto Gases",
|
|
136
|
+
("C24", EScope.S1S2): "Emissions|CO2|Energy and Industrial Processes",
|
|
137
|
+
("C24", EScope.S3): "Emissions|Kyoto Gases",
|
|
138
|
+
("D35", EScope.S1S2): "Emissions|CO2|Energy and Industrial Processes",
|
|
139
|
+
("D35", EScope.S3): "Emissions|Kyoto Gases",
|
|
140
|
+
("H49", EScope.S1S2): "Emissions|Kyoto Gases",
|
|
141
|
+
("H49", EScope.S3): "Emissions|Kyoto Gases",
|
|
142
|
+
("H50", EScope.S1S2): "Emissions|Kyoto Gases",
|
|
143
|
+
("H50", EScope.S3): "Emissions|Kyoto Gases",
|
|
144
|
+
("H51", EScope.S1S2): "Emissions|Kyoto Gases",
|
|
145
|
+
("H51", EScope.S3): "Emissions|Kyoto Gases",
|
|
146
|
+
("H52", EScope.S1S2): "Emissions|Kyoto Gases",
|
|
147
|
+
("H52", EScope.S3): "Emissions|Kyoto Gases",
|
|
148
|
+
("H53", EScope.S1S2): "Emissions|Kyoto Gases",
|
|
149
|
+
("H53", EScope.S3): "Emissions|Kyoto Gases",
|
|
150
|
+
("other", EScope.S1S2): "Emissions|Kyoto Gases",
|
|
151
|
+
("other", EScope.S3): "Emissions|Kyoto Gases",
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
TEMPERATURE_RESULTS = "temperature_results"
|
|
155
|
+
INVESTMENT_VALUE = "investment_value"
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
class PortfolioCoverageTVPConfig(PortfolioAggregationConfig):
|
|
159
|
+
FILE_TARGETS = os.path.join(
|
|
160
|
+
os.path.dirname(os.path.realpath(__file__)),
|
|
161
|
+
"inputs",
|
|
162
|
+
"current-Companies-Taking-Action.xlsx",
|
|
163
|
+
)
|
|
164
|
+
# Temporary URL until the SBTi website is updated
|
|
165
|
+
CTA_FILE_URL = "https://files.sciencebasedtargets.org/production/files/companies-excel.xlsx" # Default to per-company
|
|
166
|
+
CTA_FILE_URL_PER_COMPANY = "https://files.sciencebasedtargets.org/production/files/companies-excel.xlsx"
|
|
167
|
+
CTA_FILE_URL_PER_TARGET = "https://files.sciencebasedtargets.org/production/files/targets-excel.xlsx"
|
|
168
|
+
OUTPUT_TARGET_STATUS = "sbti_target_status"
|
|
169
|
+
OUTPUT_WEIGHTED_TARGET_STATUS = "weighted_sbti_target_status"
|
|
170
|
+
VALUE_TARGET_NO = "No target"
|
|
171
|
+
VALUE_TARGET_SET = "Near-term"
|
|
172
|
+
VALUE_ACTION_COMMITTED = "Commitment"
|
|
173
|
+
VALUE_ACTION_TARGET = "Target"
|
|
174
|
+
|
|
175
|
+
TARGET_SCORE_MAP = {
|
|
176
|
+
VALUE_TARGET_NO: 0,
|
|
177
|
+
VALUE_ACTION_COMMITTED: 0,
|
|
178
|
+
VALUE_TARGET_SET: 100,
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
# SBTi targets overview (TVP coverage)
|
|
182
|
+
COL_COMPANY_NAME = "Company Name"
|
|
183
|
+
COL_COMPANY_ISIN = "ISIN"
|
|
184
|
+
COL_COMPANY_LEI = "LEI"
|
|
185
|
+
COL_ACTION = "Action"
|
|
186
|
+
COL_TARGET = "Target"
|
|
187
|
+
COL_DATE_PUBLISHED = "Date Published"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module contains classes that create connections to data providers.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from .data_provider import DataProvider
|
|
6
|
+
from .csv import CSVProvider
|
|
7
|
+
from .excel import ExcelProvider
|
|
8
|
+
from .bloomberg import Bloomberg
|
|
9
|
+
from .cdp import CDP
|
|
10
|
+
from .iss import ISS
|
|
11
|
+
from .trucost import Trucost
|
|
12
|
+
from .urgentem import Urgentem
|
|
13
|
+
|
|
14
|
+
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
from typing import Optional, List
|
|
2
|
+
|
|
3
|
+
import requests
|
|
4
|
+
|
|
5
|
+
from SBTi.data.data_provider import DataProvider
|
|
6
|
+
from SBTi.interfaces import IDataProviderTarget, IDataProviderCompany
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Bloomberg(DataProvider):
|
|
10
|
+
"""
|
|
11
|
+
Data provider skeleton for Bloomberg.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
def _request(self, endpoint: str, data: dict) -> Optional[object]:
|
|
15
|
+
"""
|
|
16
|
+
Request data from the server.
|
|
17
|
+
Note: This request does in no way reflect the actual implementation, this is only a stub to show what a
|
|
18
|
+
potential API request COULD look like.
|
|
19
|
+
|
|
20
|
+
:param endpoint: The endpoint of the API
|
|
21
|
+
:param data: The data to send as a body
|
|
22
|
+
:return: The returned data, None in case of an error.
|
|
23
|
+
"""
|
|
24
|
+
try:
|
|
25
|
+
headers = {"Authorization": "Basic: {}:{}".format("username", "password")}
|
|
26
|
+
r = requests.post(
|
|
27
|
+
"{}{}".format("host", endpoint), json=data, headers=headers
|
|
28
|
+
)
|
|
29
|
+
if r.status_code == 200:
|
|
30
|
+
return r.json()
|
|
31
|
+
except Exception as e:
|
|
32
|
+
return None
|
|
33
|
+
return None
|
|
34
|
+
|
|
35
|
+
def get_targets(self, company_ids: List[str]) -> List[IDataProviderTarget]:
|
|
36
|
+
"""
|
|
37
|
+
Get all relevant targets for a list of company ids (ISIN). This method should return a list of
|
|
38
|
+
IDataProviderTarget instances.
|
|
39
|
+
|
|
40
|
+
:param company_ids: A list of company IDs (ISINs)
|
|
41
|
+
:return: A list containing the targets
|
|
42
|
+
"""
|
|
43
|
+
# TODO: Make an API request
|
|
44
|
+
# TODO: Transform the result into a dataframe
|
|
45
|
+
# TODO: Make sure the columns align with those defined in the docstring
|
|
46
|
+
raise NotImplementedError
|
|
47
|
+
|
|
48
|
+
def get_company_data(self, company_ids: List[str]) -> List[IDataProviderCompany]:
|
|
49
|
+
"""
|
|
50
|
+
Get all relevant data for a list of company ids (ISIN). This method should return a list of IDataProviderCompany
|
|
51
|
+
instances.
|
|
52
|
+
|
|
53
|
+
:param company_ids: A list of company IDs (ISINs)
|
|
54
|
+
:return: A list containing the company data
|
|
55
|
+
"""
|
|
56
|
+
# TODO: Make an API request
|
|
57
|
+
# TODO: Transform the result into a dataframe
|
|
58
|
+
# TODO: Make sure the columns align with those defined in the docstring
|
|
59
|
+
raise NotImplementedError
|
|
60
|
+
|
|
61
|
+
def get_sbti_targets(self, companies: list) -> list:
|
|
62
|
+
"""
|
|
63
|
+
For each of the companies, get the status of their target (Target set, Committed or No target) as it's known to
|
|
64
|
+
the SBTi.
|
|
65
|
+
|
|
66
|
+
:param companies: A list of companies. Each company should be a dict with a "company_name" and "company_id"
|
|
67
|
+
field.
|
|
68
|
+
:return: The original list, enriched with a field called "sbti_target_status"
|
|
69
|
+
"""
|
|
70
|
+
# TODO: Make an API request
|
|
71
|
+
# TODO: Extract the SBTi target status from the response
|
|
72
|
+
# TODO: Enrich the original list with this data
|
|
73
|
+
raise NotImplementedError
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
from typing import List
|
|
2
|
+
|
|
3
|
+
from SBTi.data.data_provider import DataProvider
|
|
4
|
+
from SBTi.interfaces import IDataProviderCompany, IDataProviderTarget
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class CDP(DataProvider):
|
|
8
|
+
"""
|
|
9
|
+
Data provider skeleton for CDP.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
def get_targets(self, company_ids: List[str]) -> List[IDataProviderTarget]:
|
|
13
|
+
"""
|
|
14
|
+
Get all relevant targets for a list of company ids (ISIN). This method should return a list of
|
|
15
|
+
IDataProviderTarget instances.
|
|
16
|
+
|
|
17
|
+
:param company_ids: A list of company IDs (ISINs)
|
|
18
|
+
:return: A list containing the targets
|
|
19
|
+
"""
|
|
20
|
+
# TODO: Make an API request
|
|
21
|
+
# TODO: Transform the result into a dataframe
|
|
22
|
+
# TODO: Make sure the columns align with those defined in the docstring
|
|
23
|
+
raise NotImplementedError
|
|
24
|
+
|
|
25
|
+
def get_company_data(self, company_ids: List[str]) -> List[IDataProviderCompany]:
|
|
26
|
+
"""
|
|
27
|
+
Get all relevant data for a list of company ids (ISIN). This method should return a list of IDataProviderCompany
|
|
28
|
+
instances.
|
|
29
|
+
|
|
30
|
+
:param company_ids: A list of company IDs (ISINs)
|
|
31
|
+
:return: A list containing the company data
|
|
32
|
+
"""
|
|
33
|
+
# TODO: Make an API request
|
|
34
|
+
# TODO: Transform the result into a dataframe
|
|
35
|
+
# TODO: Make sure the columns align with those defined in the docstring
|
|
36
|
+
raise NotImplementedError
|
|
37
|
+
|
|
38
|
+
def get_sbti_targets(self, companies: list) -> list:
|
|
39
|
+
"""
|
|
40
|
+
For each of the companies, get the status of their target (Target set, Committed or No target) as it's known to
|
|
41
|
+
the SBTi.
|
|
42
|
+
|
|
43
|
+
:param companies: A list of companies. Each company should be a dict with a "company_name" and "company_id"
|
|
44
|
+
field.
|
|
45
|
+
:return: The original list, enriched with a field called "sbti_target_status"
|
|
46
|
+
"""
|
|
47
|
+
# TODO: Make an API request
|
|
48
|
+
# TODO: Extract the SBTi target status from the response
|
|
49
|
+
# TODO: Enrich the original list with this data
|
|
50
|
+
raise NotImplementedError
|