VSLee.IEXSharp
2.9.4
dotnet add package VSLee.IEXSharp --version 2.9.4
NuGet\Install-Package VSLee.IEXSharp -Version 2.9.4
<PackageReference Include="VSLee.IEXSharp" Version="2.9.4" />
paket add VSLee.IEXSharp --version 2.9.4
#r "nuget: VSLee.IEXSharp, 2.9.4"
// Install VSLee.IEXSharp as a Cake Addin
#addin nuget:?package=VSLee.IEXSharp&version=2.9.4
// Install VSLee.IEXSharp as a Cake Tool
#tool nuget:?package=VSLee.IEXSharp&version=2.9.4
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.
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
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
- Thanks to Zhirong Huang (ZHCode) for his great foundational work on this library
Product | Versions |
---|---|
.NET | net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows |
.NET Core | netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1 |
.NET Standard | netstandard2.0 netstandard2.1 |
.NET Framework | net461 net462 net463 net47 net471 net472 net48 net481 |
MonoAndroid | monoandroid |
MonoMac | monomac |
MonoTouch | monotouch |
Tizen | tizen40 tizen60 |
Xamarin.iOS | xamarinios |
Xamarin.Mac | xamarinmac |
Xamarin.TVOS | xamarintvos |
Xamarin.WatchOS | xamarinwatchos |
-
.NETStandard 2.0
- LaunchDarkly.EventSource (>= 4.2.0)
- Polly (>= 7.2.3)
- System.Text.Json (>= 6.0.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.9.4 | 1,539 | 8/14/2022 |
2.9.3 | 741 | 5/25/2022 |
2.9.2 | 1,144 | 4/23/2022 |
2.9.1 | 376 | 4/14/2022 |
2.9.0 | 3,703 | 5/20/2021 |
2.8.0 | 795 | 4/14/2021 |
2.7.0 | 2,080 | 3/4/2021 |
2.6.0 | 502 | 2/1/2021 |
2.5.0 | 2,477 | 12/28/2020 |
2.4.8 | 573 | 12/3/2020 |
2.4.7 | 2,981 | 10/15/2020 |
2.4.6 | 328 | 10/15/2020 |
2.4.5 | 405 | 10/14/2020 |
2.4.4 | 314 | 10/14/2020 |
2.4.3 | 459 | 10/11/2020 |
2.4.2 | 405 | 10/10/2020 |
2.4.1 | 506 | 10/10/2020 |
2.4.0 | 401 | 10/10/2020 |
2.3.0 | 846 | 9/12/2020 |
2.2.0 | 751 | 7/21/2020 |
2.1.0 | 1,510 | 6/4/2020 |
2.0.0 | 608 | 5/10/2020 |
1.2.0 | 682 | 3/24/2020 |
1.1.0 | 3,392 | 11/24/2019 |