Asset symbols are used for identifying a particular asset for online sources or broker APIs. They are given in the Symbol column of the asset list, but can also be set directly in the algo trading script. In the simplest case the symbol is identical to the asset name (f.i. "EUR/USD"). Different brokers use often different symbols for the same asset; for instance the DAX CFD has the symbol "GER30" on FXCM, "DE30/EUR" on Oanda, and "DEU.IDX/EUR" on Dukascopy. Zorro accepts a simple symbol, an extended symbol, or a combination of symbols. Extended symbols are needed when the asset is traded on several exchanges or requires additional information, such as expiration date or strike price. An asset can have a combination of up to three different symbols: the first one for trading, the second for retrieving live prices, and the third for retrieving historical prices.
An extended symbol is a text string in the format
Source:Root-Type-Exchange-Currency ("IB:AAPL-STK-SMART-USD").
Assets with an
expiration date, such as futures, have the format
Root-Type-Expiry-Class-Exchange-Currency
("SPY-FUT-20231218-SPY1C-GLOBEX-USD").
Stock or index options have
the format Root-Type-Expiry-Strike-P/C-Exchange-Currency
("AAPL-OPT-20191218-1350.0-C-GLOBEX-USD").
Future options have the format
Root-Type-Expiry-Strike-P/C-Class-Exchange.("ZS-FOP-20191218-900.0-C-OSD-ECBOT").
Forex symbols that need a particular exchange have the format
Currency/Countercurrency-Exchange ("NOK/USD-IDEALPRO").
Up to 3
symbols can be combined: SymbolTrade!SymbolLive!SymbolHist
("IB:*-STK-SMART-USD!STOOQ:*.US!STOOQ:*.US").
The symbols for futures and
option contracts are often not entered in the asset list, but internally generated frrom
the contract chain; the asset list then contains only
the symbol of the underlying. The contract symbols can be retrieved with the
strcon function. Parsing the symbol string is the job of the
broker plugin. Parts of symbols can be omitted, for instance
"SPY-FUT---GLOBEX-USD" determines a contract chain of SPY futures with
all trading classes and all expiration dates.
An asset can have multiple symbols that are separated by exclamation marks '!'. They are accessible in the script under the names SymbolTrade, SymbolLive, SymbolHist. If the Symbol field is empty or contains '*', the asset name is used for the symbol. If it contains 2 symbols, the first is used for trading and the second for live and historical price data from the broker or online source. Of 3 symbols, the first is used for trading, the second for live prices, the third for downloading historical prices. An empy symbol of a multiple symbol combination disables its function - for instance, "AAPL!!" allows trading, but does not retrieve live or historical prices from the broker. This can be used in special cases when no market data was subscribed or prices are retrieved by other means, like with the assetHistory or priceQuote functions.
* | Symbol identical to the asset name. |
*-STK-SMART-USD | General US stock or ETF, smart routing. |
STOOQ:*.US | General US stock or ETF, no trading, live and historical prices from STOOQ. |
TNOW-STK-SMART-USD!TNOW-STK-SMART-USD!YAHOO:TNOW.L | TNOW ETF, trading and pricing with current broker, historical prices from Yahoo. |
OandaReal:EUR/USD!FXCMDemo:EUR/USD | EUR/USD traded with OandaReal using prices from FXCMDemo. |
AAPL-OPT-20190918-1350.0-C-GLOBEX | AAPL Call option expiring Sep 18, 2019, at $1350 strike. |
DAX-FUT-20201218-FDAX-DTB-EUR | DAX future expiring Dec 18, 2020, trading class FDAX. |