Giter Site home page Giter Site logo

iexsharp's Introduction

IEXSharp

IEX Cloud API for C# and other .net languages. Supports SSE streaming.

Prerequisites

This library currently targets netstandard20. Thus, it can be used with .net framework 4.6.1+ or .net core 2.0+

Usage

Prereleases are on GH Packages. A new prerelease is built automatically after every commit.

NuGet Badge Releases are on NuGet

IEX Cloud

public IEXCloudClient(string publishableToken, string secretToken, bool signRequest, bool useSandBox,
	APIVersion version = APIVersion.stable, RetryPolicy retryPolicy = RetryPolicy.Exponential)

First, create an instance of IEXCloudClient

// For FREE and LAUNCH users
IEXCloudClient iexCloudClient = 
	new IEXCloudClient("publishableToken", "secretToken", signRequest: false, useSandBox: false); 

// For SCALE and GROW users
IEXCloudClient iexCloudClient = 
	new IEXCloudClient("publishableToken", "secretToken", signRequest: true, useSandBox: false); 

// Sandbox
IEXCloudClient iexCloudClient = 
	new IEXCloudClient("publishableToken", "secretToken", signRequest: false, useSandBox: true); 

To display historical prices. Read more about DateTime in the wiki.

using (var iexCloudClient = 
	new IEXCloudClient("publishableToken", "secretToken", signRequest: false, useSandBox: false))
{
	var response = await iexCloudClient.StockPrices.HistoricalPriceAsync("AAPL", ChartRange.OneMonth);
	if (response.ErrorMessage != null)
	{
		Console.WriteLine(response.ErrorMessage);
	}
	else
	{
	   foreach (var ohlc in response.Data)
	   {
	      var dt = ohlc.GetTimestampInEST(); // note use of the extension method instead of ohlc.date
	      Console.WriteLine(
	   	  $"{dt} Open: {ohlc.open}, High: {ohlc.high}, Low: {ohlc.low}, Close: {ohlc.close}, Vol: {ohlc.volume}");
	   }
	}
}

To use SSE streaming (only included with paid IEX subscription plans). Extended example in the wiki.

using (var sseClient = iexCloudClient.StockPrices.QuoteStream(symbols: new string[] { "spy", "aapl" }, 
	UTP: false, interval: StockQuoteSSEInterval.OneSecond))
{
	sseClient.Error += (s, e) =>
	{
		Console.WriteLine("Error Occurred. Details: {0}", e.Exception.Message);
	};
	sseClient.MessageReceived += m =>
	{
		Console.WriteLine(m.ToString());
	};
	await sseClient.StartAsync(); // this will block until Stop() is called
}

Additional usage examples are illustrated in the test project: IEXSharpTest

Legacy

IEX has deprecated most of their legacy API. However, some functions are still active and you can access them via:

IEXLegacyClient iexLegacyClient = new IEXLegacyClient();

Contributing

We welcome pull requests! See CONTRIBUTING.md.

License

License: MIT

Disclaimers

Data provided for free by IEX via their IEX Cloud API Per their guidelines:

  • Required: If you display any delayed price data, you must display “15 minute delayed price” as a disclaimer.
  • Required: If you display latestVolume you must display “Consolidated Volume in Real-time” as a disclaimer.
  • Required: If you use cash flow, income statement, balance sheet, financials, or fundamentals endpoints, use must display “Data provided by New Constructs, LLC © All rights reserved.”
  • Note on pricing data: All CTA and UTP pricing data is delayed at least 15 minutes.

This project is not related to the similarly named IEX-Sharp

Acknowledgments

iexsharp's People

Contributors

amine-mejaouel avatar bdbc78 avatar biyimaks avatar chuckbeasley avatar dharmendra94 avatar doclove avatar doug-m-alexander avatar evancalhoun avatar fcsobel avatar jamieprentice avatar longpshorn avatar matthiee avatar mtf30rob avatar nswilder avatar rinukkusu avatar rothso avatar tmccart1 avatar vslee avatar z-m-huang avatar zzvanyazz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.