Skip to content

CustomSymbols.Get

method · CustomSymbols · cAlgo.API Since 5.3

DesktopCLICloud

Returns a custom symbol by it's name.

Environment behaviour

CLI — not supported. Available to plugins only, and plugins cannot run in the CLI.

Cloud — not supported. Available to plugins only, and plugins cannot run in the cloud.

Definition

CustomSymbol Get(string name)
api.CustomSymbols.Get(name: str) -> CustomSymbol | None

Parameters

Name C# type Python type Description
name string str Name of custom symbol

Returns CustomSymbol — CustomSymbol if custom symbol found otherwise null.

Examples

var customSymbol = CustomSymbols.Get("MYEURUSD");
if (customSymbol == null)
    Print("Custom symbol MYEURUSD does not exist");
else
    Print("Custom symbol bid: {0}, ask: {1}", customSymbol.Bid, customSymbol.Ask);
customSymbol = api.CustomSymbols.Get("MYEURUSD")
if customSymbol is None:
    api.Print("Custom symbol MYEURUSD does not exist")
else:
    api.Print(f"Custom symbol bid: {customSymbol.Bid}, ask: {customSymbol.Ask}")