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

RC2_SYMBOL_TICKER

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

Symbol()’s ticker must be a string literal, and may be given either positionally or as ticker= — not both.

What it means

A ticker on a Symbol() is a compile-time constraint, not a runtime value: it is baked into the compiled strategy as a RequiredTicker attribute that the binder enforces when a subscriber deploys. So it has to be readable at compile time — a plain string literal. A bare name, a variable, or an expression can’t be one, and the transpiler refuses rather than leaving the slot unconstrained.

The same diagnostic covers the second shape: naming the ticker twice, once positionally and once through ticker=. There is no rule for which one wins, so neither does.

Why it happens

Most often, the quotes are simply missing — the ticker looks like an identifier:

class Unquoted(Strategy):
trade = Symbol(SPY)
sizing = FixedCapital()
def execute(self):
if self.trade.is_flat:
self.buy(self.trade)

The other shape is an edit that never finished — the positional form was left in place while ticker= was added:

class TickerTwice(Strategy):
trade = Symbol("SPY", ticker="SPY")
sizing = FixedCapital()
def execute(self):
if self.trade.is_flat:
self.buy(self.trade)

How to fix it

Quote the ticker, and give it exactly once — positionally or as ticker=, your choice.

class Locked(Strategy):
trade = Symbol("SPY")
sizing = FixedCapital()
def execute(self):
if self.trade.is_flat:
self.buy(self.trade)

The keyword form is identical in meaning, and is the one to use when you are also pinning a session or a broker:

class LockedKwarg(Strategy):
trade = Symbol(ticker="SPY", session=USEquityDaily)
sizing = FixedCapital()
def execute(self):
if self.trade.is_flat:
self.buy(self.trade)

If the point was to let the subscriber choose the instrument, drop the ticker entirely — Symbol() is the fully open slot, and the more you leave unset the more reusable the strategy is.