Web Api Blog


Api to find List of all competitors of company based on its publicly traded stock symbol. IEX Trading api is a best an reliable, alternative to Yahoo Finance and Google Finance Api.

Find List of all competitors of company - IEX Trading Api

Finding List of all competitors of company - IEX Trading api using Postman:

Web Api Url: https://api.iextrading.com/1.0/stock/msft/peers

Api Response:


C# Code for finding List of all competitors of company

Step 1:

Create a console application

Step 2:

Add following nuget packages

<?xml version="1.0" encoding="utf-8"?>
  <package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net45" />
  <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net45" />

Step 3:

Write Web API Consumer for Get Request

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

namespace CompetitorsList
    class Program
        static void Main(string[] args)
            var symbol = "msft";
            var IEXTrading_API_PATH = "https://api.iextrading.com/1.0/stock/{0}/peers";

            IEXTrading_API_PATH = string.Format(IEXTrading_API_PATH, symbol);

            using (HttpClient client = new HttpClient())
                client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));

                //For IP-API
                client.BaseAddress = new Uri(IEXTrading_API_PATH);
                HttpResponseMessage response = client.GetAsync(IEXTrading_API_PATH).GetAwaiter().GetResult();
                if (response.IsSuccessStatusCode)
                    var peersList = response.Content.ReadAsAsync<List<string>>().GetAwaiter().GetResult();
                    foreach (var peer in peersList)
                        Console.WriteLine("Symbol: " + peer);


Note: IEX Trading is 100% Free and reliable api to get stock market data. The free API is built on a proven, high-performance system, and drives many of the applications we use within IEX. Usage of IEX Trading api - 100 requests per second.

Didn't find what you were looking for? Find more on List of all competitors of company based on it stock symbol - IEXTrading Api - C#