Skip to content

transaction_log

TransactionLog: append-only transaction history with fast lookup indices.

Classes:

  • TransactionLog

    Append-only log of Transaction records with secondary index support.

TransactionLog

TransactionLog()

Append-only log of Transaction records with secondary index support.

Methods:

  • all

    Return all transactions in insertion order.

  • by_date

    Return all transactions on date.

  • by_instrument

    Return all transactions for instrument_id.

  • by_position

    Return all transactions for position_id.

  • by_type

    Return all transactions of tx_type.

  • get

    Return the transaction with tx_id; raise KeyError if absent.

  • record

    Append a single transaction to the log.

  • record_batch

    Append multiple transactions to the log in order.

all

all() -> list[Any]

Return all transactions in insertion order.

by_date

by_date(date: date) -> list[Any]

Return all transactions on date.

by_instrument

by_instrument(instrument_id: str) -> list[Any]

Return all transactions for instrument_id.

by_position

by_position(position_id: str) -> list[Any]

Return all transactions for position_id.

by_type

by_type(tx_type: Any) -> list[Any]

Return all transactions of tx_type.

get

get(tx_id: str) -> Any

Return the transaction with tx_id; raise KeyError if absent.

record

record(transaction: Any) -> None

Append a single transaction to the log.

record_batch

record_batch(transactions: Any) -> None

Append multiple transactions to the log in order.