דלגו לתוכן
פתיחת RaamTrade

RC2_PARAM_UNKNOWN_KWARG

תוכן זה אינו זמין עדיין בשפה שלך.

Param '<name>' does not accept that keyword argument. Valid: min, max, opt_min, opt_max, opt_step, choices, type, title.

What it means

Param() takes a default plus exactly eight keywords: min and max (hard bounds), opt_min, opt_max, opt_step (the optimizer grid), choices (a fixed set of options, which makes the parameter an enum), type (the optional verbose kind) and title (the setting’s title on the run form). Anything else is refused.

This one used to be silent. Before the kwarg set was closed, an unrecognised keyword was dropped on the floor: Param(5, mni=2) compiled clean, the Param had no lower bound, and the optimizer happily swept below the value the author thought they had fenced off. A bound that is silently ignored is indistinguishable from a bound that was never written — except in the results, months later. So a misspelled keyword now fails the compile.

Why it happens

A transposed letter. This is the exact case the old behaviour hid:

class TypoKwarg(Strategy):
period = Param(20, mni=2, max=200)
trade = Symbol()
sizing = FixedCapital()
def execute(self):
sma = SMA(self.period, on=self.trade)
if sma.value > 0 and self.trade.is_flat:
self.buy(self.trade)

Or a plausible name the language doesn’t use — the optimizer keywords all carry the opt_ prefix:

class InventedKwarg(Strategy):
period = Param(20, min=2, max=200, step=5)
trade = Symbol()
sizing = FixedCapital()
def execute(self):
sma = SMA(self.period, on=self.trade)
if sma.value > 0 and self.trade.is_flat:
self.buy(self.trade)

How to fix it

Spell the five exactly. All of them are optional, and any subset is fine.

class AllKwargs(Strategy):
period = Param(20, min=2, max=200, opt_min=5, opt_max=50, opt_step=5)
trade = Symbol()
sizing = FixedCapital()
def execute(self):
sma = SMA(self.period, on=self.trade)
if sma.value > 0 and self.trade.is_flat:
self.buy(self.trade)

There is no description=, label=, or unit=. To show the member words instead of the Param’s name, give it a title=.