Web Api Blog

 
 
 

Api to find companies news based on its publicly traded stock symbol. IEX Trading api is a best an reliable, alternative to Yahoo Finance and Google Finance Api.

Find Company news - IEX Trading Api

Api to List company news - IEX Trading api using Postman:

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

Api Response:

[
{
datetime: "2017-12-31T14:45:17-05:00",
headline: "Berkshire To Score On Any Apple Special Dividend",
source: "SeekingAlpha",
url: "https://api.iextrading.com/1.0/stock/msft/article/5201587755855840",
summary: " Warren Buffett's Berkshire Hathaway ( BRK.A ) ( BRK.B ) has built an equity arsenal of various companies. Famously never having sold a share of Coca-Cola ( KO ), Mr. Buffett is the preeminent buy-and-hold investor. The Seeking Alpha community has covered Berkshire's top holdings well in fa…",
related: "AAPL,BRK.A,BRK.B,Computer Hardware,CON31167138,MSFT,NASDAQ01,Computing and Information Technology"
},
{
datetime: "2017-12-31T12:46:44-05:00",
headline: "Year-End Portfolio Summary: Keepers Carry The Portfolio",
source: "SeekingAlpha",
url: "https://api.iextrading.com/1.0/stock/msft/article/6639399085253512",
summary: " My last portfolio update was published on October 16 and reflected the status of the holdings as of early October. Since then there have been some changes in the holdings of the portfolio. This posting will address the changes that have occurred stock-by-stock and the general portfolio philo…",
related: "BA,BCE,BCE:CA,CON31055,CON31055110,EMR,ENB,ENB:CA,GE,GIS,HON,HTA,IND310,JNJ,KMB,MCD,MMM,MSFT,NASDAQ01,NEM,NMC:CA,TSXTSX01,WOMPOLIX"
},
{
datetime: "2017-12-31T09:00:48-05:00",
headline: "The Lovable Losers Of 2017",
source: "SeekingAlpha",
url: "https://api.iextrading.com/1.0/stock/msft/article/7318368058868642",
summary: " Special Offer Ends Tonight At Midnight : The Universal is my premium service on Seeking Alpha designed to generate consistent returns and attractive income over time while also protecting your hard-earned savings through any future bear market. On January 1, 2018, the rates for new s…",
related: "AAPL,AMZN,Computer Hardware,CON31167138,FB,GOOG,GOOGL,IYZ,MSFT,NASDAQ01,SPY,Computing and Information Technology,XLE,XLF,XLK,XLP,XLRE,XLU,XLV,XLY,XOM"
},
{
datetime: "2017-12-30T13:38:10-05:00",
headline: "Dividend Strategy 2018: Time To Curb Your Enthusiasm?",
source: "SeekingAlpha",
url: "https://api.iextrading.com/1.0/stock/msft/article/6430852218901865",
summary: " Following a two year hibernation, stocks have roared back to life with a vengeance following the 2016 election. While many were probably surprised by the 8% "Trump rally" of late 2016, another 20% on top of that (S&P 500) in 2017 has probably left those naysayers further dumbfounded. A p…",
related: "AL,BLK,CON31056,DIS,FUN,GGN,GLPI,HDLV,IJH,IJR,IND310,Market,MGP,MIC,MSFT,NASDAQ01,NYLD,OHI,PK,RCL,RENTLSER,SIX,SPY,VT,VTI,WOMPOLIX"
},
{
datetime: "2017-12-29T19:05:28-05:00",
headline: "Boeing, Caterpillar top Dow 2017 standings; GE lags far behind",
source: "SeekingAlpha",
url: "https://api.iextrading.com/1.0/stock/msft/article/6569259942187351",
summary: " Boeing (NYSE: BA ) tops the final 2017 results for the 30 stocks on the Dow Jones average, as the company easily surpassed the number of new net orders it amassed in 2016. More news on: The Boeing Company, Caterpillar Inc., Visa Inc., Read more … ",
related: "AAPL,AXP,BA,CAT,CON31055,CON31055110,CSCO,CVX,DIS,DWDP,GE,GS,HD,IBM,IND310,INTC,JNJ,JPM,KO,MCD,MMM,MRK,MSFT,NASDAQ01,NKE,NYSE0001,PFE,PG,TRV,UNH,UTX,V,VZ,WMT,WOMPOLIX,XOM"
},
{
datetime: "2017-12-29T15:10:00-05:00",
headline: "Facebook A.I. researchers figured out how to make avatars look like they're playing music",
source: "CNBC",
url: "https://api.iextrading.com/1.0/stock/msft/article/5498483846092462",
summary: "No summary available.",
related: "AAPL,FB,GOOGL,MSFT"
},
{
datetime: "2017-12-29T06:31:00-05:00",
headline: "Best Buy Today: Apple Or Microsoft? Why?",
source: "SeekingAlpha",
url: "https://api.iextrading.com/1.0/stock/msft/article/7625407412109199",
summary: " Cuddling with Comsat The investing futility of emotional satisfactions earned by owning a favorite stock, instead of ones that can pay lifes bills (housing, education, retirement, age-medical) ones you know are coming, was dramatized in Adam Smith&#x2019…",
related: "AAPL,Computer Hardware,CON31167138,MSFT,NASDAQ01,Computing and Information Technology"
},
{
datetime: "2017-12-29T04:59:49-05:00",
headline: "Sure-Thing Dividends Can Brighten Your Retirement Picture",
source: "SeekingAlpha",
url: "https://api.iextrading.com/1.0/stock/msft/article/8769075865111506",
summary: " Colorado Wealth Managements (CWMs) recent SA article How To Retire Without Sucker Yields got us thinking. The temptation is always there. Surely it wouldnt hurt to buy a few abnormally high-yielding stocks, right? Just a few of these in the portfolio…",
related: "CAH,CMP,COLORADO,DUK,ENB,ENB:CA,GIS,GSK,HCN,Healthcare,MED20641,MED20641092,MSFT,NASDAQ01,O,SO,T,TGT,TSXTSX01,UVV,VZ,XOM"
},
{
datetime: "2017-12-29T03:53:01-05:00",
headline: "Microsoft Beat Its Dot-Com Market Cap This Year, And Cloud Computing Means More Growth Is Coming",
source: "SeekingAlpha",
url: "https://api.iextrading.com/1.0/stock/msft/article/6717514616711395",
summary: " Microsoft (NASDAQ: MSFT ) has had an excellent year that has seen steady growth in products ranging from traditional Office offerings to gaming, and especially for cloud computing. While Microsoft is now richly valued, nonetheless the apparent continuing exponential growth of cloud computin…",
related: "AMZN,Big Data,Computer Software,GOOG,INT31168144,MSFT,NASDAQ01,ONL31168,Software,Computing and Information Technology,WOMPOLIX"
},
{
datetime: "2017-12-28T16:17:08-05:00",
headline: "International Blockchain Machines",
source: "SeekingAlpha",
url: "https://api.iextrading.com/1.0/stock/msft/article/6005144403609343",
summary: " With all of the hype over cryptocurrencies and blockchain in the last month, International Business Machines ( IBM ) could make the name change to International Blockchain Machines and see a significant pop in the stock. Such a name change wouldn't be absolutely misplaced either unlike some …",
related: "AMZN,BRO10321,CAP10321053,Financial and Business Services,IBM,MSFT,NASDAQ01,RIOT,WMT"
},
{
datetime: "2017-12-28T15:50:00-05:00",
headline: "Bill Gates says people with these 3 skills will be successful in the future job market",
source: "CNBC",
url: "https://api.iextrading.com/1.0/stock/msft/article/5544649923344659",
summary: "No summary available.",
related: "MSFT"
}
]

C# Code api for company news


Step 1:

Create a console application


Step 2:

Add following nuget packages

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

Step 3:

Create a C# POCO class for storing Json Response.

public class CompanyNews
    {
        public DateTime datetime { get; set; }
        public string headline { get; set; }
        public string source { get; set; }
        public string url { get; set; }
        public string summary { get; set; }
        public string related { get; set; }
    }

Step 4:

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 CompanyNewsInfo
{
    class Program
    {
        static void Main(string[] args)
        {
            var symbol = "msft";
            var IEXTrading_API_PATH = "https://api.iextrading.com/1.0/stock/{0}/news";

            IEXTrading_API_PATH = string.Format(IEXTrading_API_PATH, symbol);

            using (HttpClient client = new HttpClient())
            {
                client.DefaultRequestHeaders.Accept.Clear();
                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 companyNewsList = response.Content.ReadAsAsync<List<CompanyNews>>().GetAwaiter().GetResult();
                    foreach (var companyNews in companyNewsList)
                    {
                        if (companyNews != null)
                        {
                            Console.WriteLine("Headline: " + companyNews.headline);
                            Console.WriteLine("Summary: " + companyNews.summary);
                            Console.WriteLine("News url: " + companyNews.url);
                            Console.WriteLine("Source: " + companyNews.source);
                            Console.WriteLine("Related: " + companyNews.related);
                        }
                    }                                    
                }
            }
        }
    }

    public class CompanyNews
    {
        public DateTime datetime { get; set; }
        public string headline { get; set; }
        public string source { get; set; }
        public string url { get; set; }
        public string summary { get; set; }
        public string related { get; set; }
    }
}

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 Get Companies news Info based on it stock symbol - IEXTrading Api - C#