backtest_lib.engine.plan.TradeOrder#

class backtest_lib.engine.plan.TradeOrder(direction: TradeDirection, qty: int, security: str, price: float)#

Bases: object

Order describing a trade for a single security.

Trade orders are produced by plan generators and executed by a PlanExecutor. direction and qty together define the signed position change, while price is the execution price used to compute cash impact.

cost() float#

Return the cash impact of the trade.

property signed_qty: int#

Return signed quantity based on trade direction.