Ledger
- class app.portfolio.models.ledger.ledger.Ledger[source]
Bases:
Sequence
,NamedInstanceStoreEntityMixin
,AutomaticNamedEntity
Inheritance Diagram for Ledger
Methods
by_instrument
(instrument)Returns the ledger instance associated with the given instrument.
Convert the provided keyword arguments to an instance name.
Attributes
Returns the number of transactions in the ledger.
Configuration for the model, should be a dictionary conforming to
ConfigDict
.uid
entity_log
version
instance_parent
- classmethod by_instrument(instrument)[source]
Returns the ledger instance associated with the given instrument. If no ledger exists for the instrument, returns None.
- Return type:
- Parameters:
instrument (Instrument)
- classmethod calculate_instance_name_from_dict(data)[source]
Convert the provided keyword arguments to an instance name. This method should be implemented by subclasses to define how to derive the instance name.
-
instrument:
Instrument
- property length: int
Returns the number of transactions in the ledger. This is a computed property that provides the length of the transactions list.
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': True}
Configuration for the model, should be a dictionary conforming to
ConfigDict
.
-
transactions:
tuple
[Transaction
,...
]