Instruments and Custom Symbols

DocumentationMarkets

Instruments and Custom Symbols

The engine refuses to price a symbol it does not recognise. That is deliberate: a stock ticker priced as if it were a currency pair produces a result that looks fine and is nonsense. Data, Instruments is where you tell it what the symbol actually is.

When you need one

You do not need a custom symbol for anything in OrionQuant's archive: currency pairs, gold and silver, the cash indices, US shares, energy, copper and ten coins. Those are in the built in table, and so are WTIUSD, BCOUSD and NGCUSD.

You need one for a stock, an ETF, a future, an index the picker does not carry, or a coin pair that is not shaped like one. You also need one whenever your broker's contract differs from the default: a CFD on the same index at a different contract size is a different instrument as far as a fill is concerned.

The specification

New Symbol opens the editor. A template fills in a plausible set of values for a class of instrument, and then you correct the ones your broker states differently.

The Basic fields are the ones that change a result:

FieldWhat it decides
SymbolThe name a run and a strategy use. 1 to 16 letters or digits
DigitsDecimal places in a quote
Pip sizeWhat "one pip" means, and therefore every pip figure in the report
Contract sizeUnits per lot. The single largest lever on position size
Base and quote currencyHow profit is converted into the account currency

Under Show advanced sit the rest: tick size and tick value, margin percent, swap long and short, commission per lot, the minimum, maximum and step of a lot, trading hours, expiry date, exchange and settlement type.

Margin percent is worth a note. Left empty, the run uses the account leverage set in the settings panel. Fill it in only when the broker states a requirement for this instrument, and the engine uses that number instead.

Contract size and pip size are the two that quietly ruin a backtest. A contract size that is off by a factor of ten produces a return that is off by a factor of ten, and nothing in the report will look wrong. Copy them from your broker's specification page, not from memory.

Importing history

The built in download serves what OrionQuant's archive holds, and a custom symbol is usually something it does not hold. So a custom symbol usually arrives with its own data.

Save the symbol first, then use the import panel on the same page. The file is an OHLCV CSV:

timestamp,open,high,low,close,volume
2024-01-02T00:00:00Z,4742.10,4759.30,4738.55,4755.20,118422

Timestamps are ISO 8601 in UTC. The columns are matched by name, and anything the importer does not recognise is mapped by hand before the import runs. It reads the spacing between rows to work out the timeframe and tells you which one it found, counts the rows it could not parse rather than dropping them silently, and reports how many bars ended up on disk.

Use for runs then points the Backtest and Optimization configuration at that symbol and that range, so the next run does not have to be set up by hand. Clear data removes the imported bars again and says how much disk it freed.

Imported bars are bars, so a run on this instrument is capped at the bar based accuracy tiers. There are no ticks to replay.

Where a plugin fits instead

A CSV is a snapshot. If the instrument is one you will keep testing, a data source plugin fetches it on demand and keeps the cache current. See Plugins API and External Data.

Deleting one

Delete removes the specification. The data imported under it stays on disk until the cache is cleared, so deleting a symbol by mistake costs the specification and not the download.

OrionQuant