Example #1
0
        public void Should_Format_BalanceSheet()
        {
            using (StreamReader reader = new StreamReader(Path.Combine("IEXResponseText/BalanceSheet.txt")))
            {
                string balanceSheetJson = reader.ReadToEnd();

                IEXFormatter        formatter        = new IEXFormatter();
                IEXBalanceSheetList balanceSheetList = formatter.FormatBalanceSheet(balanceSheetJson);

                balanceSheetList.Symbol.Should().Be("AAPL");
                balanceSheetList.BalanceSheet.Count.Should().Be(4);

                balanceSheetList.BalanceSheet[0].NetTangibleAssets.Should().Be(120177150156);
                balanceSheetList.BalanceSheet[0].TreasuryStock.Should().BeNull();
            }
        }
Example #2
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);
        }