RC2_OVERRIDE_INVALID
תוכן זה אינו זמין עדיין בשפה שלך.
Override kwarg (
qty=orpercent=) doesn’t match the sizing model.
What it means
Each sizing model accepts exactly one override kwarg, and rejects the other:
| Sizing model | qty= |
percent= |
|---|---|---|
FixedQuantity |
✅ Allowed | ❌ RC2_OVERRIDE_INVALID |
FixedCapital |
❌ RC2_OVERRIDE_INVALID |
✅ Allowed |
Compounding |
❌ RC2_OVERRIDE_INVALID |
✅ Allowed |
Why it happens
class Bad(Strategy): trade = Symbol() sizing = FixedCapital()
def execute(self): if self.trade.is_flat: self.buy(self.trade, qty=100) # ❌ qty= on FixedCapitalFixedCapital computes quantity from dollars and price. Override by adjusting the percentage; qty= doesn’t make sense in that model.
How to fix it
Match the kwarg to the sizing model:
class CapitalSized(Strategy): trade = Symbol() sizing = FixedCapital()
def execute(self): if self.trade.is_flat: self.buy(self.trade, percent=50) # ✅ 50% of initial capitalclass QuantitySized(Strategy): trade = Symbol() sizing = FixedQuantity()
def execute(self): if self.trade.is_flat: self.buy(self.trade, qty=100) # ✅ 100 contractsclass CompoundSized(Strategy): trade = Symbol() sizing = Compounding()
def execute(self): if self.trade.is_flat: self.buy(self.trade, percent=80) # ✅ 80% of current equityOr drop the override entirely and let the declared sizing model do the work:
class Declared(Strategy): trade = Symbol() sizing = FixedCapital(percent=80)
def execute(self): if self.trade.is_flat: self.buy(self.trade) # ✅ 80%, as declaredpercent= is always a replacement of the class-level setting, not multiplicative.