Exemplo n.º 1
0
        public static async Task Main(string[] args)
        {
            var services = new ServiceCollection();

            services.AddIEXClientWithAppSettingsConfig();
            var             serviceProvider = services.BuildServiceProvider();
            IIEXCloudClient client          = serviceProvider.GetRequiredService <IIEXCloudClient>();

            await TestQuote(client);

            //await TestCompany(client);
            //await TestApiStatus(client);
            //await TestAccountMetadata(client); // not allowed?!
            //await TestSystemEvents(client);
            //await TestListQuotes(client);
            //await TestHistoricalPrices(client);
            //await TestBalanceSheets(client); //PaymentRequired
            //await TestDividends(client);
            //await TestDelayedQuote(client); //PaymentRequired
            //await TestOHLC(client); //PaymentRequired
            //await TestEarnings(client); // expensive 1000
            //await TestMarketVolumeUS(client); //PaymentRequired
            //await TestLogo(client);
            //await TestPriceTarget(client); //PaymentRequired
            //await TestNews(client);
            //await TestSectorPerformance(client); //PaymentRequired
            //await TestSymbols(client);
            //TestSSE(client);
        }
Exemplo n.º 2
0
        private static async Task TestApiStatus(IIEXCloudClient client)
        {
            var status = await client.GetApiStatus();

            Console.WriteLine("api up: " + status.StatusUp);
            Console.WriteLine("api time: " + status.Time);
        }
Exemplo n.º 3
0
        private void SetupSUT()
        {
            var env     = IEXCloudClientOptions.IEXCloudClientOptionsEnvironment.Sandbox;
            var version = IEXCloudClientOptions.IEXCloudClientOptionsVersion.V1;
            var options = new IEXCloudClientOptions(env, version, "pk", "st");

            client = new IEXCloudClient(options, httpClientFactoryMock.Object);
        }
Exemplo n.º 4
0
        private static async Task TestQuote(IIEXCloudClient client)
        {
            var aapleQuote = await client.GetQuote(Symbol);

            Console.WriteLine("aapl high: " + aapleQuote.High);
            Console.WriteLine("aapl low: " + aapleQuote.Low);
            Console.WriteLine("aapl close: " + aapleQuote.Close);
        }
Exemplo n.º 5
0
        private static void TestSSE(IIEXCloudClient client)
        {
            var eventSource = client.CreateTradeEventSource("aapl", "SNAP", "fb");

            eventSource.Events += LogTradeEvent;
            Thread.Sleep(100000);
            eventSource.Events -= LogTradeEvent;
        }
Exemplo n.º 6
0
        private static async Task TestCompany(IIEXCloudClient client)
        {
            var companyAapl = await client.GetCompany(Symbol);

            //Console.WriteLine($"{Symbol} last dividend: "+companyAapl.Dividends.OrderBy(x=>x.PaymentDate).Last().Amount);
            Console.WriteLine($"{Symbol} website: " + companyAapl.Website);
            //Console.WriteLine($"{Symbol} CurrentLongTermDebt: "+companyAapl.BalanceSheets.OrderBy(x=>x.ReportDate).Last().CurrentLongTermDebt);
        }
Exemplo n.º 7
0
        public void Setup()
        {
            var services = new ServiceCollection();

            services.AddIEXClientWithAppSettingsConfig();
            var serviceProvider = services.BuildServiceProvider();

            client = serviceProvider.GetRequiredService <IIEXCloudClient>();
        }
Exemplo n.º 8
0
        private async static Task TestEarnings(IIEXCloudClient client)
        {
            var earnings = await client.GetEarnings(Symbol, 2);

            Console.WriteLine(earnings.First());
            var earnings2 = await client.GetEarningsProperty(Symbol, EarningsProperties.ActualEPS);

            Console.WriteLine(earnings2);
        }
Exemplo n.º 9
0
        private async static Task TestSymbols(IIEXCloudClient client)
        {
            var symbols = await client.GetSymbols();

            foreach (var symbol in symbols.Take(10))
            {
                Console.WriteLine();
                Console.WriteLine(symbol);
            }
        }
Exemplo n.º 10
0
        private static async Task TestHistoricalPrices(IIEXCloudClient client)
        {
            var prices = await client.GetHistoricalPrices(Symbol, HistoricalPricesRange.OneMonth);

            foreach (var price in prices)
            {
                Console.WriteLine();
                Console.WriteLine(price);
            }
        }
Exemplo n.º 11
0
        private static async Task TestSectorPerformance(IIEXCloudClient client)
        {
            var sectorPerformances = await client.GetSectorPerformances();

            foreach (var sectorPerformance in sectorPerformances)
            {
                Console.WriteLine();
                Console.WriteLine(sectorPerformance);
            }
        }
Exemplo n.º 12
0
        private static async Task TestNews(IIEXCloudClient client)
        {
            var news = await client.GetNews(Symbol, 10);

            foreach (var article in news)
            {
                Console.WriteLine();
                Console.WriteLine(article);
            }
        }
Exemplo n.º 13
0
        private static async Task TestListQuotes(IIEXCloudClient client)
        {
            var list = await client.GetList(MarketListCriteria.Gainers);

            foreach (var gainer in list)
            {
                Console.WriteLine();
                Console.WriteLine(gainer.Symbol + " " + gainer.CompanyName);
                Console.WriteLine(gainer.Close + " " + gainer.ChangePercent + "%");
            }
        }
Exemplo n.º 14
0
        private async static Task TestPriceTarget(IIEXCloudClient client)
        {
            var mv = await client.GetPriceTarget(Symbol);

            Console.WriteLine(mv);
        }
Exemplo n.º 15
0
        private async static Task TestMarketVolumeUS(IIEXCloudClient client)
        {
            var mv = await client.GetMarketVolumeUs();

            Console.WriteLine(mv);
        }
Exemplo n.º 16
0
        private static async Task TestSystemEvents(IIEXCloudClient client)
        {
            var events = await client.GetSystemEvents();

            Console.WriteLine(events.Type);
        }
Exemplo n.º 17
0
        private static async Task TestLogo(IIEXCloudClient client)
        {
            var logo = await client.GetLogo(Symbol);

            Console.WriteLine(logo);
        }
Exemplo n.º 18
0
        private static async Task TestBalanceSheets(IIEXCloudClient client)
        {
            var balanceSheets = await client.GetBalanceSheets(Symbol);

            Console.WriteLine(balanceSheets.First());
        }
Exemplo n.º 19
0
        private static async Task TestDelayedQuote(IIEXCloudClient client)
        {
            var delayedQuote = await client.GetDelayedQuote(Symbol);

            Console.WriteLine(delayedQuote);
        }
Exemplo n.º 20
0
 private static async Task TestAccountMetadata(IIEXCloudClient client)
 {
     //var token = await client.GetSignedToken();
     var account = await client.GetAccountMetadata();
 }
Exemplo n.º 21
0
        private static async Task TestQuote(IIEXCloudClient client)
        {
            var quote = await client.GetQuote(Symbol);

            Console.WriteLine($"{Symbol} LatestPrice: " + quote.LatestPrice);
        }
Exemplo n.º 22
0
        private static async Task TestOHLC(IIEXCloudClient client)
        {
            var ohlc = await client.GetOHLC(Symbol);

            Console.WriteLine(ohlc);
        }
Exemplo n.º 23
0
        private static async Task TestDividends(IIEXCloudClient client)
        {
            var dividends = await client.GetDividends(Symbol, DividendRange.Years1);

            Console.WriteLine(dividends.First());
        }