Unofficial research mirror of the Pydantic documentation (MIT licence) for an academic study. Some details differ from the official documentation, so do not rely on this site for real projects. Official docs: docs.pydantic.dev. About this study.
Skip to content

Currency

Currency definitions that are based on the ISO4217.

ISO4217

Bases: str

ISO4217 parses Currency in the ISO 4217 format.

from pydantic import BaseModel

from pydantic_extra_types.currency_code import ISO4217


class Currency(BaseModel):
    alpha_3: ISO4217


currency = Currency(alpha_3='AED')
print(currency)
# > alpha_3='AED'

Currency

Bases: str

Currency parses currency subset of the ISO 4217 format. It excludes bonds testing codes and precious metals.

from pydantic import BaseModel

from pydantic_extra_types.currency_code import Currency


class currency(BaseModel):
    alpha_3: Currency


cur = currency(alpha_3='AED')
print(cur)
# > alpha_3='AED'