Code Monkey home page Code Monkey 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

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

iexsharp's Issues

JSON Parsing error when querying Crypto

Hello,

It appears that when I try to make a call to get the price for any of the cryptocurrencies the json serialization fails:

Example:

var response = iexCloudClient.Crypto.PriceAsync("ETHUSD").Result;

returns :
JsonException: The JSON value could not be converted to System.Decimal. Path: $.price | LineNumber: 0 | BytePositionInLine: 18.

Do you have any fix on that?

Examples for using QueryStringBuilder

While generally it shouldn't be too hard to use the QueryStringBuilder, it'd be great if either in the tests or in the wiki (or both?) there would be some examples for how to use the QueryStringBuilder, e.g. for the qsb parameter in IStockPricesService.HistoricalPriceAsync().

Perhaps such examples already exist. Then perhaps adding a link in the README.md or in the wiki (or both?) would be helpful.

Thank you and keep up the good work!

DividendReponse.date is a Unix Epoch long.

If you execute the DividendBasicAsync tests while using production IEX credentials and production server, the test will fail. The date property on DividendResponse is actually a Unix Epoch Long.

I had to change date property from DateTime to a long for my application to work properly.

using System;
using IEXSharp.Model.Shared.Response;

namespace IEXSharp.Model.CoreData.StockFundamentals.Response
{
public class DividendBasicResponse : Dividend
{
public DateTime date { get; set; }
}
}

Error When Pulling Dividend Informaiton

Hello all. When pulling dividend information I get the following error:
The JSON value could not be converted to System.Int64
Here's the data I receive:
[{"amount":1.9,"currency":"USD","declaredDate":"2022-02-22","description":"Ordinary Shares","exDate":"2022-03-09","flag":"Cash","frequency":"quarterly","paymentDate":"2022-03-24","recordDate":"2022-03-10","refid":2452707,"symbol":"HD","id":"DIVIDENDS","key":"HD","subkey":"2452707","date":1646784000000,"updated":1647302657303.492}]

Still {"The JSON value could not be converted to System.Decimal. Path: $[0].high | LineNumber: 0 | BytePositionInLine: 242."}

Hey VsLee,

i am still getting the error with the system.decimal conversion :/.

i updated to 2.4.7 but the real time price still seems to be not nullable in the metadata for me.
i also reinstalled the package already. I love this library and i would like to keep using it :/.

Do you have an idea what could be the problem?

i attached two screenshot.

Metadata
Error

Thanks in advance & best regards
Tobias

KeyStatsStatAsync throws error

Hi,

When I execute below code, I get an error like this (sure enough my Tokens are in there):
Child “token” fails beause [“token” must be a string

using (var iexCloudClient = new IEXCloudClient("pk_", "sk_", signRequest: true, useSandBox: false))
            {
                var response = await iexCloudClient.Stock.KeyStatsStatAsync("AAPL", "marketCap");
                if (response.ErrorMessage != null)
                {
                    Console.WriteLine(response.ErrorMessage);
                }
                else
                {
                    Console.WriteLine(response.Data.marketcap);
                }
            }

Any ideas what could be the issue?

JSON Parsing error HistoricalPriceAsync

Hello:

This might be similar to the other 'open' issue. When executing the following query, receive error message:

var response = await iexCloudClient.StockPrices.HistoricalPriceAsync("WWR", ChartRange.TwoYears);

Error:
Inner Exception: {"The JSON value could not be converted to System.Nullable`1[System.Int64]. Path: $[0].volume | LineNumber: 0 | BytePositionInLine: 88."}

Message: Either the JSON value is not in a supported format, or is out of bounds for an Int64.
Message: [{"close":9.5,"high":9.5,"low":7.575,"open":9,"symbol":"WWR","volume":30076.100000000006,"id":"HISTORICAL_PRICES","key":"WWR","subkey":"","date":"2019-04-22","updated":1606830572000,"changeOverTime":0,"marketChangeOverTime":0,"uOpen":0.18,"uClose":0.19,"uHigh":0.19,"uLow":0.1515,"uVolume":1503805,"fOpen":9,"fClose":9.5,"fHigh":9.5,"fLow":7.575,"fVolume":30076.100000000006,"label":"Apr 22, 19","change":0,"changePercent":0}, ........

Thanks.

HistoricalPrices (Stocks) using the ChartRange.DateType

I can use the ChartRange.DateType (as below), but I can't figure out how to input the desired date that I want to extract the minute-price history with. I know there is HistoricalPricesByDate, but this only provides the daily open/close, etc.. Do you know how I can specify the date, or a better way to extract minute based historical data. IEXcloud states on their page they make the previous 30 days minute-level data available for access.

-Great API! Love it's features and ease of use!
-Thank you

IEXCloudClient.StockProfiles.CompanyAsync Bug decoding JSON

Retrieving the company info appears to have an invalid JSON object which you are trying to decode too.

Amazon being retrieved by this triggers the error.

{"symbol":"AMZN","companyName":"Amazon.com Inc.","exchange":"NASDAQ/NGS (GLOBAL SELECT MARKET)","industry":"Electronic Shopping and Mail-Order Houses ","website":"http://www.amazon.com/","description":"","CEO":"Jeffrey Bezos","securityName":"Amazon.com Inc.","issueType":"cs","sector":"Retail Trade","primarySicCode":5961,"employees":null,"tags":["Retail Trade","Internet Retail"],"address":"410 Terry Ave N","address2":null,"state":"Washington","city":"Seattle","zip":"98109-5210","country":"US","phone":"12062661000"}

The JSON value could not be converted to System.Int32. Path: $.employees | LineNumber: 0 | BytePositionInLine: 338. THe employees needs to be an Integer? not integer

Missing endpoints

Hi,

I am getting started with IEXSharp and IEXCloud. At the moment, im mostly testing the functionalities of your client, which seem to be quite nice!

There is 3 endpoints that doesn't seem to be existing in your current client

  1. GET /stock/{symbol}/recommendation-trends
  2. GET /stock/{symbol}/estimates
  3. GET /stock/{symbol}/price-target

Is there any plan to integrate these endpoints (and maybe also GET /stock/{symbol}/earnings/{last}/{field}) ?

Thank you

ps: good job for your client, pretty amazing and well done!

Add DEEP book streaming for US Stocks and Crypto

Hey All,

love this package! Please could you add DEER Book calls for US Stocks and Crypto which is mentioned here in the API description:

https://iexcloud.io/docs/api/

curl --header 'Accept: text/event-stream' https://cloud-sse.iexapis.com/stable/deep?token=YOUR_TOKEN&symbols=twtr&channels=book

curl --header 'Accept: text/event-stream' https://cloud-sse.iexapis.com/stable/cryptoBook\?symbols\=btcusd\&token\=YOUR_TOKEN

This would be awesome!
Thank you

The JSON value could not be converted to System.Int64 on 'updated' property

Calling StockProfiles.InsiderTransactionsAsync for AAPL throws a JSON int64 out of bounds error.

IEX response:
...
"updated":1709268016103.4824
...

System.Text.Json: The JSON value could not be converted to System.Int64.
Either the JSON value is not in a supported format, or is out of bounds for an Int64.

PR #119 and #120 address exactly the same issue, by changing the 'updated' property from a long to a decimal.

IEXCloud provides no documentation on the 'updated' property.

iexMarketPercent in QuoteSSE should be nullable

[{"symbol":"PALL","companyName":"Aberdeen Standard Physical Palladium Shares ETf","primaryExchange":"NYSE Arca","calculationPrice":"sip","open":219.74,"openTime":1606314600195,"openSource":"official","close":221.26,"closeTime":1606251600070,"closeSource":"official","high":220.5,"highTime":1606335998843,"highSource":"15 minute delayed price","low":219.2,"lowTime":1606316605077,"lowSource":"15 minute delayed price","latestPrice":220.1,"latestSource":"15 minute delayed price","latestTime":"3:23:24 PM","latestUpdate":1606335804130,"latestVolume":9632,"iexRealtimePrice":0,"iexRealtimeSize":0,"iexLastUpdated":0,"delayedPrice":220.1,"delayedPriceTime":1606335804130,"oddLotDelayedPrice":220.1,"oddLotDelayedPriceTime":1606335998843,"extendedPrice":219.5,"extendedChange":-0.6,"extendedChangePercent":-0.00273,"extendedPriceTime":1606314600806,"previousClose":221.26,"previousVolume":26308,"change":-1.16,"changePercent":-0.00524,"volume":9632,"iexMarketPercent":null,"iexVolume":0,"avgTotalVolume":27875,"iexBidPrice":0,"iexBidSize":0,"iexAskPrice":220.51,"iexAskSize":500,"iexOpen":null,"iexOpenTime":null,"iexClose":219.94,"iexCloseTime":1606236000040,"marketCap":374170000,"peRatio":null,"week52High":273.16,"week52Low":137.51,"ytdChange":0.194586,"lastTradeTime":1606335804130}] The JSON value could not be converted to System.Decimal. Path: $[0].iexMarketPercent | LineNumber: 0 | BytePositionInLine: 967.

BatchResponse properties don't get populated

Hi, I'm trying to create a batch request and in fiddler I see that the values come in via the API, but when trying to get the values through response.Data (BatchResponse) all of the properties are null

Exception when number of shares in InsiderTransactionResponse is a decimal

InsiderTransactionResponse defines fields TransactionShares, TranShares and PostShares as a nullable long.

Example response from IEX for symbol DIS.
TransactionShares: 595.2000122070312

Results in the following exception:

System.Text.Json: The JSON value could not be converted to System.Nullable`1[System.Int64]. Path: $[0].transactionShares | LineNumber: 0 | BytePositionInLine: 321. System.Text.Json.Rethrowable: Either the JSON value is not in a supported format, or is out of bounds for an Int64.

IEX docs define it as type 'number', so it should probably be changed to a nullable decimal.

Crypto Book Price Issue: decimal point missing?

Hey Guys,

could you please check the return values from Crypto.BookAsync method. The values I get from this method seems to be wrong if I compare it to the REST call in browser. Maybe I do something wrong...

IEXCloudClient iexCloudClient_Crypto = new IEXCloudClient("pk_****", "secretToken", signRequest: false, useSandBox: false);
           string[] iexSymbols = {"BTCUSD", "ETHUSD"};
           foreach (var symbol in iexSymbols)
           {
               log.LogInformation(symbol);        

               //local list of orders from IEX                    
               var response = await iexCloudClient_Crypto.Crypto.BookAsync(symbol);
           }

The Value for BTCUSD Price I get is eg. 3725466 I thing it should be 37254.66 ?
Is this by purpose?

Thank you and best regards,
Anton

KeyStat json deserialization fails on null nextdividentdate value

Looks like IEX changed something on their API again making the KeyStat deserialzier fail on null DateTime values

System.Text.Json.JsonException: {"companyName":"Tesla Inc","marketcap":1021367482430,"week52high":1243.49,"week52low":539.49,"week52highSplitAdjustOnly":1243.49,"week52lowSplitAdjustOnly":539.49,"week52change":0.6672896276988147,"sharesOutstanding":1004264852,"float":0,"avg10Volume":19917128,"avg30Volume":24369071,"day200MovingAvg":802.42,"day50MovingAvg":1092.68,"employees":70757,"ttmEPS":3.03,"ttmDividendRate":0,"dividendYield":0,"nextDividendDate":"","exDividendDate":"","nextEarningsDate":"2022-01-26","peRatio":294.5119614848789,"beta":1.8002951554377649,"maxChangePercent":211.8568438677271,"year5ChangePercent":25.425973081120407,"year2ChangePercent":13.137983763345192,"year1ChangePercent":0.6672896276988147,"ytdChangePercent":0.4412260688423768,"month6ChangePercent":0.667563003164505,"month3ChangePercent":0.3813275021391609,"month1ChangePercent":-0.015859960132376116,"day30ChangePercent":-0.015859960132376116,"day5ChangePercent":0.0020296166389153214} ---> System.Text.Json.JsonException: The JSON value could not be converted to System.Nullable1[System.DateTime]. Path: $.nextDividendDate | LineNumber: 0 | BytePositionInLine: 425.
---> System.FormatException: The JSON value is not in a supported DateTime format.
at System.Text.Json.Utf8JsonReader.GetDateTime()
at System.Text.Json.Serialization.Converters.DateTimeConverter.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
at System.Text.Json.Serialization.Converters.NullableConverter1.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options) at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
at System.Text.Json.JsonPropertyInfo1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader) at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
--- End of inner exception stack trace ---
at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, Utf8JsonReader& reader, Exception ex)
at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) at System.Text.Json.JsonSerializer.ReadCore[TValue](Utf8JsonReader& reader, Type returnType, JsonSerializerOptions options) at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, Type returnType, JsonSerializerOptions options) at IEXSharp.Helper.ExecutorREST.ExecuteAsync[ReturnType](String urlPattern, NameValueCollection pathNVC, QueryStringBuilder qsb, Boolean forceUseSecretToken) --- End of inner exception stack trace --- at IEXSharp.Helper.ExecutorREST.ExecuteAsync[ReturnType](String urlPattern, NameValueCollection pathNVC, QueryStringBuilder qsb, Boolean forceUseSecretToken) at IEXSharp.Helper.ExecutorREST.SymbolExecuteAsync[ReturnType](String urlPattern, String symbol) at IEXSharp.Service.Cloud.CoreData.StockResearch.StockResearchService.KeyStatsAsync(String symbol)

Feature Request: backoff policy

Hello,

Fantastic package, thanks a ton for your hard work.

In IEXSharp/IEXSharp/Helper/ExecutorREST.cs, there is currently only one backoff policy supported - ExponentialBackoffPolicy. It would be great if the policy was customizable or had a few options to set via either the initial constructor to IEXCloudClient, some method within IEXCloudClient, or elsewhere, particularly for nuget users.

Ideally, there would be a linear policy to choose from (or, at the very least an exponential one that is not multiplied by a factor of a quarter of a second).

A configurable number of retries before failing would be ideal too.

The end idea here is to be able to "quickly" send many requests at once and handle the timing and error cases (via IEXResponse.ErrorMessage) on the user side if desired. The REST API should be able to support this (somewhat) as IEXCloud states in the documentation to wait a minimum of 10ms between requests.

Thanks,
Cart-Cart

JSON parsing error using HistoricalPrices

Historical volume can be split adjusted and therefore a fractional number (volume:1107729848.505649) that won't parse nicely into an Int64.

var response = await iexCloudClient.StockPrices.HistoricalPriceAsync("AAPL", ChartRange.Max);

{"The JSON value could not be converted to System.Nullable`1[System.Int64]. Path: $[0].volume | LineNumber: 0 | BytePositionInLine: 96."}

JSON:"[{"close":3.09,"high":3.15,"low":3.0268,"open":3.0962,"symbol":"AAPL","volume":1107729848.505649,"id":"ISIOLIARC_PHTRSCE","key":"LAPA","subkey":"0","date":"2006-12-29","updated":1629558309192,"changeOverTime":0,"marketChangeOverTime":0,"uOpen":84.801,"uClose":85.73,"uHigh":86.9,"uLow":85.85,"uVolume":38840383,"fOpen":2.6401,"fClose":2.6215,"fHigh":2.6485,"fLow":2.647,"fVolume":1112153566.051404,"label":"Dec 29, 06","change":0,"changePercent":0}]"

Using IEXSharp 2.6.0 via NuGet package.

JSON Value Cannot be Converted to System.Nullable

System has been running fine without issue for over a year. Running under version 2.8.0.
Attempting to retrieve quote for AMD via the following:

            var response = await iexCloudClient.StockPrices.HistoricalPriceAsync(symbol, ChartRange.ThreeMonths);

Results in:
{"The JSON value could not be converted to System.Nullable`1[System.Int64]. Path: $[0].updated | LineNumber: 0 | BytePositionInLine: 184."}

Inner Exception:
Either the JSON value is not in a supported format, or is out of bounds for an Int64.

Data results have been attached. What am I missing? Seems any value expecting int64 could be set to 0 but not following how can't be set to System.Nullable. Any pointers appreciated.
IEXDataError.txt

Cannot parse string as decimal

Hi,

There is an issue with parsing string numbers after updating from 2.3.0. to 2.4.8. using Crypto.QuoteStream:

[{"symbol":"BTCUSDT","primaryExchange":"","sector":"cryptocurrency","calculationPrice":"realtime","latestPrice":"19194.67000000","latestSource":"Real time price","latestUpdate":1607359072095,"latestVolume":null,"bidPrice":"19194.66000000","bidSize":"2.30286700","askPrice":"19194.67000000","askSize":"0.26471800","high":null,"low":null,"previousClose":null}] The JSON value could not be converted to System.Decimal. Path: $[0].latestPrice | LineNumber: 0 | BytePositionInLine: 128. Cannot get the value of a token type 'String' as a number.

latestPrice in this format should be parsed fine, but doesn't for some reason.

Call stack:

System.Text.Json.JsonException:
   at IEXSharp.Helper.SSEClient`1.Evt_MessageReceived (IEXSharp, Version=2.4.8.0, Culture=neutral, PublicKeyToken=null)
   at LaunchDarkly.EventSource.EventSource.OnMessageReceived (LaunchDarkly.EventSource, Version=3.3.2.0, Culture=neutral, PublicKeyToken=18e8c36453e3060f)
   at LaunchDarkly.EventSource.EventSource.DispatchEvent (LaunchDarkly.EventSource, Version=3.3.2.0, Culture=neutral, PublicKeyToken=18e8c36453e3060f)
   at LaunchDarkly.EventSource.EventSource.ProcessResponseContent (LaunchDarkly.EventSource, Version=3.3.2.0, Culture=neutral, PublicKeyToken=18e8c36453e3060f)
   at LaunchDarkly.EventSource.EventSourceService+<ProcessResponseFromReaderAsync>d__15.MoveNext (LaunchDarkly.EventSource, Version=3.3.2.0, Culture=neutral, PublicKeyToken=18e8c36453e3060f)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at LaunchDarkly.EventSource.EventSourceService+<ConnectToEventSourceApi>d__13.MoveNext (LaunchDarkly.EventSource, Version=3.3.2.0, Culture=neutral, PublicKeyToken=18e8c36453e3060f)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at LaunchDarkly.EventSource.EventSourceService+<GetDataAsync>d__12.MoveNext (LaunchDarkly.EventSource, Version=3.3.2.0, Culture=neutral, PublicKeyToken=18e8c36453e3060f)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at LaunchDarkly.EventSource.EventSource+<ConnectToEventSourceAsync>d__42.MoveNext (LaunchDarkly.EventSource, Version=3.3.2.0, Culture=neutral, PublicKeyToken=18e8c36453e3060f)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
Inner exception System.Text.Json.JsonException handled at IEXSharp.Helper.SSEClient`1.Evt_MessageReceived:
   at System.Text.Json.ThrowHelper.ReThrowWithPath (System.Text.Json, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51)
   at System.Text.Json.JsonSerializer.ReadCore (System.Text.Json, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51)
   at System.Text.Json.JsonSerializer.ReadCore (System.Text.Json, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51)
   at System.Text.Json.JsonSerializer.Deserialize (System.Text.Json, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51)
   at System.Text.Json.JsonSerializer.Deserialize (System.Text.Json, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51)
   at IEXSharp.Helper.SSEClient`1.Evt_MessageReceived (IEXSharp, Version=2.4.8.0, Culture=neutral, PublicKeyToken=null)
Inner exception System.InvalidOperationException handled at System.Text.Json.ThrowHelper.ReThrowWithPath:
   at System.Text.Json.Utf8JsonReader.TryGetDecimal (System.Text.Json, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51)
   at System.Text.Json.Utf8JsonReader.GetDecimal (System.Text.Json, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51)
   at System.Text.Json.Serialization.Converters.JsonConverterDecimal.Read (System.Text.Json, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51)
   at System.Text.Json.JsonPropertyInfoNotNullable`4.OnRead (System.Text.Json, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51)
   at System.Text.Json.JsonPropertyInfo.Read (System.Text.Json, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51)
   at System.Text.Json.JsonSerializer.ReadCore (System.Text.Json, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51)

Possibly broken by #71 ?

How can i get P/E ratio of a stock?

I tried this:
string ticker = "appl"// for example
IEXCloudClient client = new new IEXCloudClient(.....);
var stock = await client.StockFundamentals.AdvancedFundamentalsAsync(ticker);

why stock is null?

JsonConverter.Int64Converter can't handle null values

Hi,

I'm using the Batch api to get a list of stock prices from the IntradayPrices endpoint. Some of the stocks returns "null" for fields such as volume from IEX, this in turn causes the Json Deserializer to throw an exception internally.

this is how I'm making the call

try { return await _batchService.BatchByMarketAsync(symbols, new[] { BatchType.IntradayPrices }, _fiveMinutesChartLatestPointArguments); } catch (JsonException exception) { Console.WriteLine(exception); }

an example symbol that fails is "AMER" which IEX cloud returns the following response,

  "AMER": {
    "intraday-prices": [
      {
        "date": "2020-11-20",
        "minute": "15:55",
        "label": null,
        "high": null,
        "low": null,
        "average": null,
        "volume": null,
        "notional": null,
        "numberOfTrades": null,
        "marketHigh": null,
        "marketLow": null,
        "marketAverage": null,
        "marketVolume": null,
        "marketNotional": null,
        "marketNumberOfTrades": null,
        "open": null,
        "close": null,
        "marketOpen": null,
        "marketClose": null,
        "changeOverTime": null,
        "marketChangeOverTime": null
      }
    ]
  }

Here is the stack trace,

 ---> System.Text.Json.JsonException: The JSON value could not be converted to System.Int64. Path: $.AMER.intraday-prices[0].volume | LineNumber: 0 | BytePositionInLine: 32105.
 ---> System.InvalidOperationException: Cannot get the value of a token type 'Null' as a number.
   at System.Text.Json.Utf8JsonReader.TryGetInt64(Int64& value)
   at System.Text.Json.Utf8JsonReader.GetInt64()
   at System.Text.Json.JsonPropertyInfoNotNullable`4.OnRead(ReadStack& state, Utf8JsonReader& reader)
   at System.Text.Json.JsonSerializer.HandleNull(Utf8JsonReader& reader, ReadStack& state)
   at System.Text.Json.JsonSerializer.ReadCore(JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& readStack)
   --- End of inner exception stack trace ---
   at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& readStack, Utf8JsonReader& reader, Exception ex)
   at System.Text.Json.JsonSerializer.ReadCore(JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& readStack)
   at System.Text.Json.JsonSerializer.ReadCore(Type returnType, JsonSerializerOptions options, Utf8JsonReader& reader)
   at System.Text.Json.JsonSerializer.Deserialize(String json, Type returnType, JsonSerializerOptions options)
   at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)
   at IEXSharp.Helper.ExecutorREST.ExecuteAsync[ReturnType](String urlPattern, NameValueCollection pathNVC, QueryStringBuilder qsb, Boolean forceUseSecretToken)
   --- End of inner exception stack trace ---
   at IEXSharp.Helper.ExecutorREST.ExecuteAsync[ReturnType](String urlPattern, NameValueCollection pathNVC, QueryStringBuilder qsb, Boolean forceUseSecretToken)
   at IEXSharp.Service.Cloud.CoreData.Batch.BatchService.BatchByMarketAsync(IEnumerable`1 symbols, IEnumerable`1 types, IReadOnlyDictionary`2 optionalParameters)

Can't deserialize quotes.

Hello,

I am using the StockPrices api to get the quote of a symbol. However it fails with the JsonSerializer exception "Serializer options cannot be changed once serialization or deserialization has occurred."

System.InvalidOperationException: Serializer options cannot be changed once serialization or deserialization has occurred.
   at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_SerializerOptionsImmutable()
   at System.Text.Json.Serialization.ConverterList.Add(JsonConverter item)
   at IEXSharp.Helper.ExecutorBase.get_JsonSerializerOptions()
   at IEXSharp.Helper.ExecutorREST.ExecuteAsync[ReturnType](String urlPattern, NameValueCollection pathNVC, QueryStringBuilder qsb, Boolean forceUseSecretToken)
   at IEXSharp.Helper.ExecutorREST.SymbolExecuteAsync[ReturnType](String urlPattern, String symbol)
   at IEXSharp.Service.Cloud.CoreData.StockPrices.StockPricesService.QuoteAsync(String symbol)

From looking at the docs it looks like this happens when the JsonSerializerOptions is modified after use.

Five day minute data comes back at 10 minute intervals.

var response = await iexCloudClient.StockPrices.HistoricalPriceAsync("IBM", ChartRange.FiveDayMinute);

12/21/2020 3:20:00 PM Open: 123.24, High: 123.45, Low: 123.235, Close: 123.45, Vol: 2687
12/21/2020 3:30:00 PM Open: 123.425, High: 123.47, Low: 123.12, Close: 123.34, Vol: 6532
12/21/2020 3:40:00 PM Open: 123.43, High: 123.43, Low: 123.13, Close: 123.21, Vol: 5257
12/21/2020 3:50:00 PM Open: 123.2, High: 123.54, Low: 122.985, Close: 123.38, Vol: 20583

Is this an artifact of my free key from them or another issue in the library? I am really looking for 15 minute intervals. I looked through the tests and didn't see anything that stood out to specify bar duration.

Seems to work fine in .Net 5 other than that.

Q: Streaming news for single language

Hey buddies,

is there a way to get streaming news for just one language?
I just want english news and getting news in every language is pretty expensive..

Thanks!

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.