Skip to content

GetSymbolInfos Method

GetSymbolInfos

Summary

Gets the required symbol info like symbol IDs, Symbol Names, etc.

Signature

1
public abstract SymbolInfo[] GetSymbolInfos(string[] symbolNames)

Parameters

Name Type Description
symbolNames string[] Names of the symbols you want to get their info

Return Value

SymbolInfo[]

Declaring Type

cAlgo.API.Symbols

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
 using cAlgo.API;
 namespace cAlgo
 {
     // This sample shows how to use Symbols collection to get symbols data
     [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
     public class SymbolsSample : Indicator
     {
         protected override void Initialize()
         {
             var scrollViewer = new ScrollViewer
             {
                 HorizontalAlignment = HorizontalAlignment.Center,
                 VerticalAlignment = VerticalAlignment.Center,
                 BackgroundColor = Color.Gold,
                 Opacity = 0.7,
                 HorizontalScrollBarVisibility = ScrollBarVisibility.Auto,
                 VerticalScrollBarVisibility = ScrollBarVisibility.Visible,
                 Height = 300
             };
             var grid = new Grid(Symbols.Count + 1, 2)
             {
                 BackgroundColor = Color.Gold,
                 HorizontalAlignment = HorizontalAlignment.Center,
                 VerticalAlignment = VerticalAlignment.Center,
             };
             scrollViewer.Content = grid;
             grid.AddChild(new TextBlock
             {
                 Text = "Name",
                 Margin = 5,
                 ForegroundColor = Color.Black,
                 FontWeight = FontWeight.ExtraBold
             }, 0, 0);
             grid.AddChild(new TextBlock
             {
                 Text = "Description",
                 Margin = 5,
                 ForegroundColor = Color.Black,
                 FontWeight = FontWeight.ExtraBold
             }, 0, 1);
             for (int iSymbol = 1; iSymbol < Symbols.Count + 1; iSymbol++)
             {
                 var symbolName = Symbols[iSymbol];
                 var symbol = Symbols.GetSymbol(symbolName);
                 if (!symbol.MarketHours.IsOpened()) continue;
                 grid.AddChild(new TextBlock
                 {
                     Text = symbolName,
                     Margin = 5,
                     ForegroundColor = Color.Black,
                     FontWeight = FontWeight.ExtraBold
                 }, iSymbol, 0);
                 grid.AddChild(new Button
                 {
                     Text = symbol.Description,
                     Margin = 5,
                     ForegroundColor = Color.Black,
                     FontWeight = FontWeight.ExtraBold
                 }, iSymbol, 1);
             }
             Chart.AddControl(scrollViewer);
         }
         public override void Calculate(int index)
         {
         }
     }
 }

Last update: July 1, 2022

Comments