-
Notifications
You must be signed in to change notification settings - Fork 2
Transaction
Documentation > Transaction
A Transaction is an exchange of value between two or more Accounts. For example, the raising of an invoice, the incrurring of a liability, or the receipt of a payment. Many Transactions together, each touching the same Account, form an Account Ledger, and the cumulative sum of the Transactions form an Account Balance.
Transactions are composed of Entries, each of which includes a debit or credit (The fundamental Sides). The sum of all debits and credits in all the Entries that compose a Transaction must always equal zero.
Transactions may be retrieved and created in arbitrary units, either a Global Units or Custom Units. Amatino will transparently handle all unit conversions. For example, a Transaction could be created in Australian Dollars, touch an Account denominated in Pounds Sterling, and be retrieved in Bitcoin.
.session - Session
The underlying credentials used to retrieve this Transaction instance
.entity - Entity
The Entity which this Transaction describes
The time at which this Transaction was or is to be executed
A human-friendly description of this Transaction
Example: 'Recognise receipt of sweet loot'
.entries - List[Entry]
A list Entry instances that comprise this Transaction
The integer identifier of the GlobalUnit that denominates this Transaction, if any
Example: 5
The integer identifier of the CustomUnit that denominations this Transaction, if any
Example: None
.denomination - Denomination
The unit denominating this Transaction - Either a GlobalUnit or CustomUnit
Return a new Transaction, created using the supplied parameters
- entity: Entity
- time: datetime
- entries: List[Entry]
- denomination: Denomination
- description: Optional[str]
transaction = Transaction.create(
entity=mega_corp,
time=datetime.utcnow(),
entries=[
Entry(Side.debit, Decimal(10), asset_account),
Entry(Side.credit, Decimal(5), liability_account),
Entry(Side.credit, Decimal(5), another_account)
]
denomination=USD
)Return an existing Transaction.
Note that a Denomination is required - A Transaction may touch Accounts with heterogenous denominations, a circumstance under which default behaviour would be non-deterministic. Therefore, you are required to explicitly provide the denomination with which you wish to view the Transaction. You can get a convenient reference to .denomination from Account and other Transaction instances.
- entity: Entity
- id_: int
- denomination: Denomination
transaction = Transaction.retrieve(
entity=mega_corp,
id_=458923,
denomination=USD
)Return an updated Transaction. NB: The Transaction instance is not updated in place. The updated Transaction is returned.
All parameters are optional. Those that you do not supply will be set to existing values.
- time: Optional[datetime]
- entries: Optional[List[Entry]]
- denomination: Optional[Denomination]
- description: Optional[str]
updated_transaction = existing_transaction.update(
description='New, fancier description',
time=datetime.utcnow()
)Return None after destroying this Transaction, such that it will be no longer included in any view of this Entity's accounting information.
None
existing_transaction.delete()