RC2_ENTRY_EXTRA_ARG
Entry verbs (
buy,sell_short) take exactly one positional arg — the symbol slot.
What it means
Entry verbs are auto-sized from the class-level sizing declaration. They take exactly one positional argument: the trading symbol. Everything else (stop, reason, sizing overrides) is a keyword arg.
Why it happens
You probably tried to pass quantity positionally — habit from self.sell(self.trade, qty):
class Bad(Strategy): trade = Symbol() sizing = FixedCapital()
def execute(self): if self.trade.is_flat: self.buy(self.trade, 100) # ❌ — second positional argHow to fix it
To override the sizing model on this trade, use the kwarg that matches the model:
class QuantityOverride(Strategy): trade = Symbol() sizing = FixedQuantity()
def execute(self): if self.trade.is_flat: self.buy(self.trade, qty=100) # ✅ FixedQuantity → qty=class CapitalOverride(Strategy): trade = Symbol() sizing = FixedCapital()
def execute(self): if self.trade.is_flat: self.buy(self.trade, percent=50) # ✅ FixedCapital → percent=If you just want the default-sized entry, pass the symbol and nothing else:
class DefaultSized(Strategy): trade = Symbol() sizing = FixedCapital()
def execute(self): sma = SMA(20, on=self.trade) if self.trade.is_flat: self.buy(self.trade, stop=sma.value) # ✅ uses the sizing model if self.trade.is_short: self.buy_to_cover(self.trade, self.trade.position, reason="Cover")