credmark.cmf.types.fiat_currency.Currency

DTO class Currency(*_args, address, symbol=None, name=None, fiat=None)[source]

Bases: Account

Converter for any Fungible Token and FiatCurrency. It’s used as inputs to price models.

It can be constructed with a string (containing an address or symbol) or with kwargs address or symbol:

# The following constructions are equivalent:

c = Currency('CMK')

c = Currency('0x68cfb82eacb9f198d508b514d898a403c449533e')

c = Currency(symbol='CMK')

c = Currency(address='0x68cfb82eacb9f198d508b514d898a403c449533e')

Show JSON schema
{
   "title": "Currency",
   "description": "Converter for any Fungible Token and FiatCurrency.\nIt's used as inputs to price models.\n\nIt can be constructed with a string (containing an address or symbol)\nor with kwargs ``address`` or ``symbol``::\n\n    # The following constructions are equivalent:\n\n    c = Currency('CMK')\n\n    c = Currency('0x68cfb82eacb9f198d508b514d898a403c449533e')\n\n    c = Currency(symbol='CMK')\n\n    c = Currency(address='0x68cfb82eacb9f198d508b514d898a403c449533e')",
   "type": "object",
   "properties": {
      "address": {
         "title": "Address",
         "type": "string",
         "pattern": "^0x[a-fA-F0-9]{40}$",
         "format": "evm-address"
      },
      "symbol": {
         "title": "Symbol",
         "type": "string"
      },
      "name": {
         "title": "Name",
         "type": "string"
      },
      "fiat": {
         "title": "Fiat",
         "type": "boolean"
      }
   },
   "required": [
      "address"
   ],
   "examples": [
      {
         "address": "0x1F98431c8aD98523631AE4a59f267346ea31F984"
      },
      {
         "symbol": "CMK"
      }
   ]
}

Config
  • schema_extra: dict = {‘examples’: [{‘address’: ‘0x1F98431c8aD98523631AE4a59f267346ea31F984’}, {‘symbol’: ‘CMK’}]}

Fields
Parameters
Return type

None

field address: Address [Required]
Constraints
  • type = string

  • pattern = ^0x[a-fA-F0-9]{40}$

  • format = evm-address

field fiat: Optional[bool] = None
field name: Optional[str] = None
field symbol: Optional[str] = None
to_accounts()
classmethod validate(value)[source]
property models