How can I obtain a ticker of a CFD for stock symbol (and also its category)?
How can I obtain a ticker of a CFD for stock symbol (and also its category)?
02 Feb 2021, 10:30
I'm using cTrader 3.8 with ICM broker.
I have "US Equities (CFDs)" category in cTrader under Trade - All Symbols category.
Now I'm doing something like this:
foreach (var symbol in Symbols)
{
var name = Symbols.GetSymbol(symbol).Name;
var description = Symbols.GetSymbolInfo(symbol).Description;
var id = Symbols.GetSymbolInfo(symbol).Id;
//Print($"{id}, {name}, {description}"); WHY??
Print(id + ", " + name + ", " + description);
}
But all I have in the output is something like this:
02/02/2021 08:21:10.308117, Morgan Stanley,
02/02/2021 08:21:09.699116, Chevron,
02/02/2021 08:21:09.262115, Coca Cola,
The description field is empty, and I can't found any other fields providing me with ticker info.
So the questions are:
- How to obtain a ticker for CFD stock?
- How to obtain a category for a symbol (in my example I want "US Equities (CFDs)" for stock symbols and "Forex" for forex symbols)
- Is it possible to obtain a list of categories ("US Equities (CFDs)", "Forex", ...) and all symbols for specific category?
- Why can't I use standart C# string interpolation? When I saving and building the file it removes $ from the beginning of the string ($"{id}, {name}, {description}" becomes "{id}, {name}, {description}" - no interpolation sign here)?
Thank you in advance.
Replies
chernish2
02 Feb 2021, 15:29
( Updated at: 21 Dec 2023, 09:22 )
RE:
I'm interested in CFD for stocks, not Forex.
So I would like to see MSFT for Microsoft, AAPL for Apple etc.
Is it possible?
PanagiotisCharalampous said:
Hi chernish2,
Are you using IC Markets? It looks fine to me.
Best Regards,
Panagiotis
@chernish2
PanagiotisCharalampous
02 Feb 2021, 16:52
Hi chernish2,
You did not answer my question. Who is your broker? I cannot see stocks on ICMarkets.
Best Regards,
Panagiotis
@PanagiotisCharalampous
chernish2
02 Feb 2021, 19:56
( Updated at: 21 Dec 2023, 09:22 )
RE:
Here we go.
PanagiotisCharalampous said:
Hi chernish2,
You did not answer my question. Who is your broker? I cannot see stocks on ICMarkets.
Best Regards,
Panagiotis
@chernish2
PanagiotisCharalampous
03 Feb 2021, 08:24
Hi chernish2,
It seems this broker has not set any descriptions for these symbols.
Best Regards,
Panagiotis
@PanagiotisCharalampous
chernish2
03 Feb 2021, 08:29
RE:
OK, but still: are these things possible:
- How to obtain a category for a symbol (in my example I want "US Equities (CFDs)" for stock symbols and "Forex" for forex symbols)?
- Is it possible to obtain a list of categories ("US Equities (CFDs)", "Forex", ...) and all symbols for specific category?
Since this broker definitely set categories I would like to access them from code.
PanagiotisCharalampous said:
Hi chernish2,
It seems this broker has not set any descriptions for these symbols.
Best Regards,
Panagiotis
@chernish2
PanagiotisCharalampous
04 Feb 2021, 10:15
Hi chernish2,
This information is not available via cTrader Automate API.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
02 Feb 2021, 15:25
Hi chernish2,
Are you using IC Markets? It looks fine to me.
Best Regards,
Panagiotis
Join us on Telegram
@PanagiotisCharalampous