backtest_lib.trade#
- backtest_lib.trade(direction: str | TradeDirection, qty: int, security: str) MakeTradeDecision#
Create a decision to trade a specific quantity.
This is part of the strategy output language for explicit trades. Use it when you want a single-buy/sell instruction rather than a target portfolio expressed via
target_weights().- Parameters:
direction – Buy or sell direction. Accepts
"buy","sell", or aTradeDirection.qty – Quantity to trade.
security – Security identifier to trade.
- Returns:
MakeTradeDecision describing the trade.