Jump to content
rwbta

get marketid from symbol name

Recommended Posts

Thank you for the info. That gets me started in the right direction. Unfortunately, CI doesn't provide samples how to use the limited reference info they do provide; so I apparently have many hours of trial and error ahead of me.

Share this post


Link to post

There is a work item to add tutorials and samples into the CIAPI reference - as it is a medium priority item this will be in the medium term future. If there are particular areas you are interested in seeing samples, post them here and they will be incorporated when that work item is implemented. Thanks!

 

Yours truly,

PM!

Share this post


Link to post

IMHO, everything in the api reference should have an example (not a tutorial) on how it is used. I understand that may not be financially feasible. At the very least, common issues should be addressed. At Microsoft's MSDN site often describes the information required to use a method; see: https://msdn.microsoft.com/en-us/library/system.datetime.parse(v=vs.110).aspx. It's not a tutorial and doesn't need to be. It does get to the specifics of how to use the parse method.

 

I find it hard to believe that many users or even developers would remember every numerical marketid and to what symbol it refers. Since the api requires the use of the marketid and not the symbol name, it seems to me, identifying the marketid from the symbol name should be much simpler than it appears to be. (I still haven't cracked that nut.)

 

In the online api reference, ListMarketInformationSearch is briefly described with an explanation of the parameters. One must then go to ListMarketInformationSearchResponseDTO to determine what is information is provided by the return data type. Sadly, that information is not provided; no less any information on how to access it. From there, one is directed to ApiMarketInformationDTO. Happily, it contains the word Name which is described as "market name" which I believe contains the symbol name. However, this page also fails to provide any information on how to access this information.

 

Again, imho, it should not be so difficult to determine what marketid is assigned to particular symbol.

Share this post


Link to post

Hello RWBTA,

 

Yes, the work item to add tutorials and samples stipulates adding an example for each service method call. 

 

What I meant in my question was if there were any specific areas you need covered? As an example ( ;)), since you have difficulties in using ListMarketInformation to retrieve the Market ID, that would be an additional specific example.

 

This is on top of the example showing the use of ListMarketInformation to retrieve all the market information - the general case since it includes the name anyway.

 

However, as I mentioned previously, the priority set for this work item means that it will be implemented in the medium term future though. 

Share this post


Link to post

Hi,

 

I ran into this problem today as I wanted to find the Nikkei 225 CFD marketid but the posts here didn't really help so I had a dig around in some old code and came across this, I've tidied it up a bit - hope this helps others.

 

// fetch all market and sub-market definitions

MarketInformationTagLookupResponseDTO tagLookup = rpcClient.Market.TagLookup();

foreach (ApiPrimaryMarketTagDTO marketTag in tagLookup.Tags)

{

  Debug.WriteLine(string.Format("Market {0}, {1}", marketTag.Name, marketTag.MarketTagId));

  foreach (ApiMarketTagDTO marketTagChild in marketTag.Children)

  {

    Debug.WriteLine(string.Format("Sub-Market {0}, {1}", marketTagChild.Name, marketTagChild.MarketTagId));

  }

}

Debug.WriteLine("---------------------------------------------------------------------------------");

 

// plug the chosen ID in here to get the sub-level

var swt = rpcClient.Market.SearchWithTags("", 94, false, false, true, true, false, false, 200, false);

ApiMarketDTO[] markets = swt.Markets;

for (int c = 0; c < markets.Count(); c++)

{

  Debug.WriteLine(string.Format("Market {0}, {1}", markets[c].MarketId, markets[c].Name));

}

Debug.WriteLine("---------------------------------------------------------------------------------");

You will get back a list of primary markets and from this I chose 94 and plugged this into the second API

​Sub-Market Indices Asia, 94

 

And then from this I found the CFD I was interested in:

Market 40055751, Japan 225 CFD 

 

 

Regards

David

 

Share this post


Link to post

David, thank you for sharing this information. It is a step in the right direction. Because it is so difficult to get answers to programming questions, I have left this project on the digital shelf for months. Because of lack of examples and information, I personally find it is very disappointing to work with CI. I can't help but wonder why the API was released to the public in the first place. CI doesn't really seem to be interested in helping developers make it work. Maybe is really is just for large scale corporate clients. In which case, this forum is pretty much moot. Just my opinion.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×