using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri(“https://morning-star.p.rapidapi.com/market/v2/auto-complete?q=TSLA”),
Headers =
{
{ “X-RapidAPI-Key”, “c276db9e1bmshb517603b1a8de5fp184c33jsne542522030aa” },
{ “X-RapidAPI-Host”, “morning-star.p.rapidapi.com” },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
How do I change this if I want to search on the Canadian stock exchange TSX? I tried looking for XEI (an ETF). I tried various version such as XEI.TO, XEI.TSX, etc.
The endpoint is mapped to the search bar on top of MS; You may try and experience the same. You should try the followings instead.
querystring = {“q”: “Tesla"}
querystring = {“q”: “Alphabet"}
querystring = {“q”: “Meta"}
Thanks I am using the market/v2/auto-complete endpoint - does the querystring actually allow for multiple values as I get this {‘count’: 0, ‘pages’: 0, ‘results’: []} when using the below :
I am sorry that I cannot help you with coding. This API reproduces PUBLIC data and features of morningstar.COM version
Regards.
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri(“https://morning-star.p.rapidapi.com/market/v2/auto-complete?q=TSLA”),
Headers =
{
{ “X-RapidAPI-Key”, “c276db9e1bmshb517603b1a8de5fp184c33jsne542522030aa” },
{ “X-RapidAPI-Host”, “morning-star.p.rapidapi.com” },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
How do I change this if I want to search on the Canadian stock exchange TSX? I tried looking for XEI (an ETF). I tried various version such as XEI.TO, XEI.TSX, etc.
Well,
The endpoint is mapped to the search bar on top of MS; You may try and experience the same. You should try the followings instead.
querystring = {“q”: “Tesla"}
querystring = {“q”: “Alphabet"}
querystring = {“q”: “Meta"}
Regards.
Thanks I am using the market/v2/auto-complete endpoint - does the querystring actually allow for multiple values as I get this {‘count’: 0, ‘pages’: 0, ‘results’: []} when using the below :
querystring = {“q”: “Tesla, Alphabet, Meta”}
Hello,
You have to use …/market/v2/auto-complete endpoint to make your own mapping table for symbol/performanceId pair.
Regards.