Ledger

class app.portfolio.models.ledger.ledger.Ledger[source]

Bases: EmptyClass, NamedInstanceStoreMixin, Entity[LedgerRecord, LedgerJournal]

Inheritance diagram of Ledger

Inheritance Diagram for Ledger

Methods

by_instrument(instrument)

Return the ledger instance associated with the given instrument.

calculate_instance_name_from_dict(data[, ...])

Convert the provided keyword arguments to an instance name.

model_post_init(context)

Attributes

model_config

Configuration for the model, should be a dictionary conforming to ConfigDict.

instance_name

uid

entity_log

entity_dependents

instance_parent_weakref

classmethod by_instrument(instrument: __annotationlib_name_1__ | Uid) Self | None[source]

Return the ledger instance associated with the given instrument.

If no ledger exists for the instrument, returns None.

Parameters:

instrument (__annotationlib_name_1__ | Uid)

Return type:

Self | None

classmethod calculate_instance_name_from_dict(data: Mapping[str, Any], allow_missing_instrument: bool = False) str[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.

Parameters:
Return type:

str

model_config: ClassVar[ConfigDict] = {'extra': 'allow', 'frozen': True, 'serialize_by_alias': True, 'validate_assignment': True, 'validate_by_alias': True}

Configuration for the model, should be a dictionary conforming to ConfigDict.

model_post_init(context: Any) None
Parameters:

context (Any)

Return type:

None