Skip to main content

pyratings - Working with credit ratings, professionally and efficiently

Documentation

The full documentation can be found at https://hsbc.github.io/pyratings/.
A “Getting started” section shows the relevant functions provided by pyratings in order to compute an average credit rating for a portfolio with multiple securities.

Capabilities

This library consists of functions, which will be helpful in order to work with credit ratings in a pandas.DataFrame.
pyratings offers the following capabilities:
  • Preparing regular ratings for further processing, i.e. stripping off of rating watches.

  • Transform long- and short-term ratings into rating scores and vice versa.

  • Compute best/second best/worst ratings on a security level basis within a portfolio context.

  • Compute average ratings/rating scores on a portfolio level.

  • Compute Weighted Average Rating Factor (WARF) on a portfolio level.

  • Compute WARF buffer, i.e. distance from current WARF to next maxWARF.

Transformations from ratings to scores/WARF and vice versa will take place according to the following translation table:

Long-term ratings

Moody’s

S&P

Fitch

ICE

DBRS

Bloomberg

Score

WARF

MinWARF*

MaxWARF*

Aaa

AAA

AAA

AAA

AAA

AAA

1

1

1

5

Aa1

AA+

AA+

AA+

AAH

AA+

2

10

5

15

Aa2

AA

AA

AA

AA

AA

3

20

15

30

Aa3

AA-

AA-

AA-

AAL

AA-

4

40

30

55

A1

A+

A+

A+

AH

A+

5

70

55

95

A2

A

A

A

A

A

6

120

95

150

A3

A-

A-

A-

AL

A-

7

180

150

220

Baa1

BBB+

BBB+

BBB+

BBBH

BBB+

8

260

220

310

Baa2

BBB

BBB

BBB

BBB

BBB

9

360

310

485

Baa3

BBB-

BBB-

BBB-

BBBL

BBB-

10

610

485

775

Ba1

BB+

BB+

BB+

BBH

BB+

11

940

775

1145

Ba2

BB

BB

BB

BB

BB

12

1350

1145

1558

Ba3

BB-

BB-

BB-

BBL

BB-

13

1766

1558

1993

B1

B+

B+

B+

BH

B+

14

2220

1993

2470

B2

B

B

B

B

B

15

2720

2470

3105

B3

B-

B-

B-

BL

B-

16

3490

3105

4130

Caa1

CCC+

CCC+

CCC+

CCCH

CCC+

17

4770

4130

5635

Caa2

CCC

CCC

CCC

CCC

CCC

18

6500

5635

7285

Caa3

CCC-

CCC-

CCC-

CCCL

CCC-

19

8070

7285

9034

Ca

CC

CC

CC

CC

CC

20

9998

9034

9998.5

C

C

C

C

C

C

21

9999

9998.5

9999.5

D

D

D

D

D

DDD

22

10000

9999.5

10000

MinWARF is inclusive, while MaxWARF is exclusive.

Short-term ratings

Moody’s

S&P

Fitch

DBRS

Score

P-1

A-1+

F1+

R-1 (high)

1

—

—

—

R-1 (mid)

2

—

—

—

R-1 (low)

3

—

A-1

F1

R-2 (high)

5

—

—

—

R-2 (mid)

6

P-2

A-2

F2

R-2 (low)

7

—

—

—

R-3 (high)

8

P-3

A-3

F3

R-3 (mid)

9

—

—

—

R-3 (low)

10

NP

B

—

R-4

12

—

—

—

R-5

15

—

C

—

—

18

—

D

—

D

22

Dependencies

This library supports Python >= 3.9.
Under the hood pyratings only depends on the basic python libraries that are used for matrix and dataframe manipulation:
  • numpy

  • pandas

Metadata

Release files for pyratings 0.5.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyratings 0.5.4
File Size Uploaded Provenance Actions
pyratings-0.5.4.tar.gz 21.2 kB Without provenance Details for pyratings-0.5.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyratings 0.5.4
File Interpreter ABI Platform Actions
pyratings-0.5.4-py3-none-any.whl Python 3 none any Details for pyratings-0.5.4-py3-none-any.whl

Total release size: 42.0 kB

Release files / pyratings-0.5.4.tar.gz

Download URL pyratings-0.5.4.tar.gz
Size 21.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c196a8393bc622b8cc422c65b7150d1c99070af2fd4748e05d4b007af6e99909
BLAKE2b-256 checksum
How to use checksums
5347fb83d24a98a86d26b7524528abaace9b4056162709935b643b32bf8e338d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / pyratings-0.5.4-py3-none-any.whl

Download URL pyratings-0.5.4-py3-none-any.whl
Size 20.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3141c1ab9450825a1c7f8b165cf9eb0326e7af0799f8a633146685a86dacb2d0
BLAKE2b-256 checksum
How to use checksums
b2e8b6c1b5aa90f537fd5d5580598df49e5eb0335eed860b17a0995635924f12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Security for pyratings 0.5.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page