Transaction

class qf_lib.backtesting.portfolio.transaction.Transaction(time: datetime.datetime, ticker: qf_lib.common.tickers.tickers.Ticker, quantity: float, price: float, commission: float)[source]

Bases: object

Encapsulates the notion of a filled Order, as returned from a Brokerage. Stores the quantity of an instrument actually filled and at what price. In addition, stores the commission of the trade from the Brokerage.

Parameters
  • time (datetime) – time when the order was filled

  • ticker (Ticker) – ticker identifying the asset

  • quantity (float) – filled quantity, positive for assets bought and negative for assets sold

  • price (float) – price at which the trade was filled

  • commission (float) – brokerage commission for carrying out the trade. It is always a positive number