Пример #1
0
        public void GetQuoteAndCompanyInformationInBatchQuery()
        {
            var iex        = new IEXClient();
            var types      = new[] { "company", "quote" };
            var resultList = iex.GetBatchData(symbols, types);

            resultList.ShouldNotBeNull();
            resultList.Count.ShouldBe(symbols.Length);

            var aapl = resultList.FirstOrDefault();

            aapl.ShouldNotBeNull();
            aapl.company.ShouldNotBeNull();
            aapl.company.companyName.ShouldNotBeNull();
            aapl.company.symbol.ShouldNotBeNull();

            string symbol = aapl.company.symbol;

            symbol.ShouldBe("AAPL");

            aapl.quote.ShouldNotBeNull();
            aapl.quote.Close.ShouldNotBeNull();
            double close = aapl.quote.Close ?? 0;

            close.ShouldBeGreaterThan(0);
        }
Пример #2
0
        public IEXClientFixture()
        {
            Client = new IEXClient(CredsHelper.GetIEXToken(), logger: null, useCache: false);

            var t = Client.GetOptions("AMD");

            t.Wait();

            Options = t.Result;

            var dt = Client.GetOptionDetails("AMD", "20210806");

            dt.Wait();

            OptionDetails = dt.Result;

            var price = Client.GetPrice("AMD");

            price.Wait();

            Price = price.Result.Success;

            var search = Client.Search("stitch", 5);

            search.Wait();

            SearchResults = search.Result.Success;

            var advancedStats = Client.GetAdvancedStats("GOOGL");

            advancedStats.Wait();

            AdvancedStats = advancedStats.Result.Success;
        }
Пример #3
0
        public IEXClientFixture()
        {
            Client = new IEXClient("pk_71ba0d8d98ed4d2caac8089588d62973");

            var t = Client.GetOptions("TEUM");

            t.Wait();

            Options = t.Result;

            var dt = Client.GetOptionDetails("TEUM", "201909");

            dt.Wait();

            OptionDetails = dt.Result;

            var price = Client.GetPrice("TEUM");

            price.Wait();

            Price = price.Result;

            var active = Client.GetMostActive();

            active.Wait();

            MostActive = active.Result;

            var search = Client.Search("stitch");

            search.Wait();

            SearchResults = search.Result;
        }
Пример #4
0
        static void Main(string[] args)
        {
            IEXClient client = new IEXClient();

            Company company = client.GetCompanyAsync("AAPL").Result;

            Console.ReadKey(false);
        }
Пример #5
0
        private void Start()
        {
            var config = new IEXConfig {
                IsSandbox = true,
                Token     = "Your token Here"
            };

            m_Client = new IEXClient(config);
        }
Пример #6
0
        public void GetNewsForSingleCompany()
        {
            string symbol = "AAPL";
            var    iex    = new IEXClient();
            var    news   = iex.GetNews(symbol);

            Assert.NotNull(news);
            Assert.NotEmpty(news);
        }
Пример #7
0
        public void GetLastOneNewsFoirSingleCompany()
        {
            string symbol = "AAPL";
            var    iex    = new IEXClient();
            var    news   = iex.GetNews(symbol, last: 1);

            Assert.NotNull(news);
            Assert.Single(news);
        }
Пример #8
0
 public IEXClientTests(IEXClientFixture fixture, Xunit.Abstractions.ITestOutputHelper output)
 {
     _options       = fixture.Options;
     _optionDetails = fixture.OptionDetails.ToArray();
     _price         = fixture.Price;
     _client        = fixture.Client;
     _output        = output;
     _mostActive    = fixture.MostActive;
     _search        = fixture.SearchResults;
 }
Пример #9
0
        public async Task GetDataPoint_Should_FetchResults()
        {
            var config = new ConfigurationBuilder()
                         .AddJsonFile("appsettings.json")
                         .Build();
            string    token  = config["TOKEN"];
            IEXClient client = new IEXClient(IEXBaseUrl.SandboxUrl, token);
            string    result = await client.GetDataPoint("MSFT", IexDataPointVariable.LATEST_FINANCIAL_REPORT_DATE);

            result.Should().NotBeNullOrEmpty();
        }
Пример #10
0
        public async Task Should_GetTimeSeries_Fundamentals_Quarterly()
        {
            var config = new ConfigurationBuilder()
                         .AddJsonFile("appsettings.json")
                         .Build();
            string    token  = config["TOKEN"];
            IEXClient client = new IEXClient(IEXBaseUrl.SandboxUrl, token);
            string    result = await client.GetTimeSeriesFundamentals("MSFT", "quarterly", new DateTime(2000, 1, 1), DateTime.Now);

            result.Should().NotBeNullOrEmpty();
        }
Пример #11
0
        public async Task Should_GetTopsLast_ForEverything()
        {
            var config = new ConfigurationBuilder()
                         .AddJsonFile("appsettings.json")
                         .Build();
            string    token  = config["TOKEN"];
            IEXClient client = new IEXClient(IEXBaseUrl.SandboxUrl, token);
            string    result = await client.GetTopsLast();

            result.Should().NotBeNullOrEmpty();
        }
Пример #12
0
        public void GetNaNValuesCorrectly()
        {
            string symbol = "ALGR";
            var    iex    = new IEXClient();
            var    stats  = iex.GetStats(symbol);

            Assert.NotNull(stats);
            stats.CompanyName.ShouldBe("Allegro Merger Corp.");
            Assert.True(stats.Week52Low > 0);
            Assert.True(stats.Week52High > 0);
        }
Пример #13
0
        public async Task GetPeers_Should_FetchResult()
        {
            var config = new ConfigurationBuilder()
                         .AddJsonFile("appsettings.json")
                         .Build();
            string    token  = config["TOKEN"];
            IEXClient client = new IEXClient(IEXBaseUrl.SandboxUrl, token);
            string    result = await client.GetPeers("NKE");

            result.Should().NotBeNullOrEmpty();
        }
Пример #14
0
        public async Task GetHistoricalPrices_WithChartCloseOnly_Should_FetchResults()
        {
            var config = new ConfigurationBuilder()
                         .AddJsonFile("appsettings.json")
                         .Build();
            string    token  = config["TOKEN"];
            IEXClient client = new IEXClient(IEXBaseUrl.SandboxUrl, token);
            string    result = await client.GetHistoricalPrices("msft", "5d", chartCloseOnly : true);

            result.Should().NotBeNullOrEmpty();
        }
Пример #15
0
        public async Task GetTimeSeries_Should_FetchResults()
        {
            var config = new ConfigurationBuilder()
                         .AddJsonFile("appsettings.json")
                         .Build();
            string    token  = config["TOKEN"];
            IEXClient client = new IEXClient(IEXBaseUrl.SandboxUrl, token);
            string    result = await client.GetTimeSeries("REPORTED_FINANCIALS", "MSFT");

            result.Should().NotBeNullOrEmpty();
        }
Пример #16
0
        public void GetGoogleStat()
        {
            string symbol = "GOOG";
            var    iex    = new IEXClient();
            var    stats  = iex.GetStats(symbol);

            Assert.NotNull(stats);
            stats.CompanyName.ShouldBe("Alphabet Inc.");

            Assert.True(stats.Week52Low > 0);
            Assert.True(stats.Week52High > 0);
        }
Пример #17
0
        public void GetSingleCompanyStat()
        {
            string symbol = "MSFT";
            var    iex    = new IEXClient();
            var    stats  = iex.GetStats(symbol);

            Assert.NotNull(stats);
            stats.CompanyName.ShouldBe("Microsoft Corporation");

            Assert.True(stats.Week52Low > 0);
            Assert.True(stats.Week52High > 0);
        }
Пример #18
0
        public void SingleCompanyCall()
        {
            string symbol  = "MSFT";
            var    iex     = new IEXClient();
            var    company = iex.GetCompany(symbol);

            Assert.NotNull(company);
            company.symbol.ShouldBe(symbol);
            company.exchange.ShouldBe("Nasdaq Global Select");
            company.companyName.ShouldBe("Microsoft Corporation");
            company.industry.ShouldBe("Application Software");
        }
Пример #19
0
        public void SingleCompanyCall()
        {
            string symbol   = "MSFT";
            var    iex      = new IEXClient();
            var    dividend = iex.GetDividend(symbol, Range.OneYear);

            Assert.NotNull(dividend);
            Assert.True(dividend.Count > 0);

            var div = dividend.FirstOrDefault();

            Assert.True(div.Amount > 0);
        }
Пример #20
0
        public async Task GetCashFlowStatement_Should_FetchResults()
        {
            var config = new ConfigurationBuilder()
                         .AddJsonFile("appsettings.json")
                         .Build();
            string    token  = config["TOKEN"];
            IEXClient client = new IEXClient(IEXBaseUrl.SandboxUrl, token);
            string    result = await client.GetCashFlowStatement("AAPL", 4, "quarter");

            result.Should().NotBeNullOrEmpty();

            result = await client.GetCashFlowStatement("AAPL", 4, "annual");

            result.Should().NotBeNullOrEmpty();
        }
Пример #21
0
        public async Task GetUpcomingEarnings_Should_FetchResults()
        {
            var config = new ConfigurationBuilder()
                         .AddJsonFile("appsettings.json")
                         .Build();
            string    token  = config["TOKEN"];
            IEXClient client = new IEXClient(IEXBaseUrl.SandboxUrl, token);
            string    result = await client.GetUpcomingEarnings("market");

            IEXFormatter formatter = new IEXFormatter();
            List <IexUpcomingEarnings> iexUpcomingEarnings = formatter.FormatUpcomingEarnings(result);
            var a = iexUpcomingEarnings.Max(w => w.ReportDate);

            result.Should().NotBeNullOrEmpty();
        }
Пример #22
0
        public void GetNewsForInBatchQuery()
        {
            var iex        = new IEXClient();
            var types      = new[] { "stats", "quote" };
            var resultList = iex.GetBatchData(symbols, types);

            resultList.ShouldNotBeNull();
            resultList.Count.ShouldBe(symbols.Length);

            var aapl = resultList.FirstOrDefault();

            aapl.quote.ShouldNotBeNull();
            aapl.stats.ShouldNotBeNull();

            var exDivDate = aapl.stats.ExDividendDate;

            exDivDate.ShouldNotBeNullOrEmpty();
        }
Пример #23
0
        public void BatchCompanyCall()
        {
            var symbols = new string[] { "MSFT", "AAPL" };
            var types   = new[] { "company" };

            var iex    = new IEXClient();
            var result = iex.GetBatchData(symbols, types);

            Assert.NotNull(result);
            result.Count.ShouldBe(2);

            var msft = result.Where(i => i.company.symbol == "MSFT").FirstOrDefault();

            Assert.NotNull(msft);
            msft.company.symbol.ShouldBe("MSFT");

            var aapl = result.Where(i => i.company.symbol == "AAPL").FirstOrDefault();

            Assert.NotNull(aapl);
            aapl.company.symbol.ShouldBe("AAPL");
        }
Пример #24
0
        static void Main(string[] args)
        {
            var privateKeyDelegate = new Func <string>(() => "sk_45a6d4763f2842d2a4a2a4ae93ec294e");

            IEXClientConfig config = new IEXClientConfig("pk_363a5bf9a47d48eb9685604f640f1f4a", privateKeyDelegate.Invoke());

            IEXClient client = new IEXClient(config);

            //Quote quote = client.GetQuoteAsync("aapl").Result;
            //Company company = client.GetCompanyAsync("aapl").Result;
            //List<Dividend> dividends = client.GetDividendAsync("aapl", DataRange.SixMonths).Result;
            //var price = client.GetPriceAsync("aapl").Result;
            //List<string> peers = client.GetPeersAsync("amd").Result;

            //var marketVolumes = client.GetMarketVolumeAsync().Result;
            //var news = client.GetNewsAsync("aapl", 5).Result;
            var recommendations = client.GetRecommendationsAsync("cprx").Result;
            var priceTargets    = client.GetPriceTargetAsync("cprx").Result;

            //var sectorPerformance = client.GetSectorPerformancesAsync().Result;

            Console.ReadLine();
        }
Пример #25
0
        public async Task LastReportDate_Should_BeTheSameAs_TheDataPointForTheLastReportDate()
        {
            var config = new ConfigurationBuilder()
                         .AddJsonFile("appsettings.json")
                         .Build();
            string    token  = config["TOKEN"];
            IEXClient client = new IEXClient(IEXBaseUrl.SandboxUrl, token);

            IEXFormatter formatter = new IEXFormatter();

            // Get the last updated data point
            string dataPointResult = await client.GetDataPoint("MSFT", IexDataPointVariable.LATEST_FINANCIAL_REPORT_DATE);

            DateTime lastUpdated = formatter.FormatDataPoint(dataPointResult);

            // Get the actual point that was supposed to be updated
            var balanceSheetString = await client.GetBalanceSheet("MSFT", 1, "quarter");

            var balanceSheet = formatter.FormatBalanceSheet(balanceSheetString);

            // Ensure they are the same time
            balanceSheet.BalanceSheet[0].ReportDate.Should().Be(lastUpdated);
        }
Пример #26
0
        static void Main(string[] args)
        {
            string symbol = "msft";

            var iex = new IEXClient();

            var company = iex.GetCompany(symbol);

            if (company != null)
            {
                Console.WriteLine($"{company.companyName} - ({company.symbol})");
                Console.WriteLine($"CEO: {company.CEO}");
                Console.WriteLine($"Website: {company.website}");
            }

            var quote = iex.GetStockQuote(symbol);

            if (quote != null)
            {
                Console.WriteLine($"Price: {quote.LatestPrice:C}");
                Console.WriteLine($"Open-Close: {quote.Open:C}-{quote.Close:C}");
                Console.WriteLine($"Change: {quote.Change} ({quote.ChangePercent:P})");
                Console.WriteLine($"52 Week Range: {quote.Week52Low:C}-{quote.Week52High:C}");
            }

            var divs = iex.GetDividend(symbol, Range.OneYear);

            if (divs != null)
            {
                Console.WriteLine("Dividends:");
                foreach (var div in divs)
                {
                    Console.WriteLine($"{div.RecordDate:dd-MMM-yyy} - {div.Amount:C}");
                }
            }
        }
Пример #27
0
 public IEXSpikes(Xunit.Abstractions.ITestOutputHelper helper)
 {
     _helper = helper;
     _client = new IEXClient(CredsHelper.GetIEXToken(), logger: null);
 }