-
Notifications
You must be signed in to change notification settings - Fork 2
CustomUnit
Documentation > CustomUnit
Custom Units are units of account created by Amatino users. Their scope is limited to the Entity in which they are created. They can be used anywhere a Global Unit would be used, allowing you to denominate Transactions and Accounts as you please.
Custom Unit identifiers need not be unique with reference to Global Units. Therefore, it is possible to create a Custom Unit substitute of a Global Unit. For example, a USD Custom Unit using a preferred source of foreign exchange rates, with higher temporal resolution, or some other desired characteristic.
.session - Session
The Session used to initialise this CustomUnit
.entity - Entity
The Entity of which this CustomUnit is a member
The integer identifier of this Custom Unit, unique within an Entity
Example: 420
A string short-hand name for this Custom Unit
Example: 'BTC'
A human readable long-form name for this Custom Units
Example: Bitcoin
An integer sorting priority useful when displaying this CustomUnit in lists
Example: 0
A long-form description of this Custom Unit
Example: BTC @ 0600UTC per CoinBase
The integer number of base-10 digits required to store this CustomUnit's smallest fractional unit. For example, a U.S. Dollar has an exponent of 2, as its smallest fractional unit is one-hundredth - a cent.
Example: 6
Return a newly created CustomUnit
- entity: Entity
- name: str
- code: str
- exponent: int
- description: Optional[str]
- priority: Optional[int]
btc = CustomUnit.create(
entity=mega_corp,
name='Bitcoin',
code='BTC',
exponent=6
)Return an existing CustomUnit
- entity: Entity
- custom_unit_id: int
btc = CustomUnit.retrieve(
entity=mega_corp,
custom_unit_id=420
)Return a CustomUnit whose metadata have been updated. NB that the original CustomUnit instance is not updated in place. The returned CustomUnit instance is updated.
All parameters are optional. Those parameters that you don't supply will
- name: Optional[str]
- code: Optional[str]
- priority: Optional[int]
- description: Optional[str]
- exponent: Optional[str]
updated_btc = original_btc.update(
description='New, fancier description'
)
### `.delete()` -> None
_Not yet implemented_