contango.trading.execution.backtest.fill_behavior.rules.partial_position_rule
contango.trading.execution.backtest.fill_behavior.rules.partial_position_rule
PartialPositionRule
Bases: FillRule[RuleContext]
Rule that only allows full trades (no partial trades). This means that you must sell all of the shares you bought in a previous order every time.
validate
validate(context: RuleContext) -> bool
Returns True if there is currently a position & the desired quantity is negative, and adding the current posiiton and desired quantity correctly results in no position.
Source code in src\contango\trading\execution\backtest\fill_behavior\rules\partial_position_rule.py
16 17 18 19 20 21 22 23 24 25 26 27 | |