Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use long on volume properties #95

Merged
merged 1 commit into from Jan 31, 2021
Merged

Use long on volume properties #95

merged 1 commit into from Jan 31, 2021

Conversation

rinukkusu
Copy link
Contributor

Trying to get a stock quote for $HCMC throws an exception. Digging deeper it seems the previousVolume property can't handle volumes larger than int32:

Error: JSON integer 4294967295 is too large or small for an Int32. Path 'previousVolume', line 1, position 893.

Response from IEX Cloud
{
  "symbol": "HCMC",
  "companyName": "Healthier Choices Management Corp",
  "primaryExchange": "OTC PINK CURRENT",
  "calculationPrice": "close",
  "open": 0.0009,
  "openTime": 1611930601050,
  "openSource": "official",
  "close": 0.0008,
  "closeTime": 1611954000000,
  "closeSource": "official",
  "high": 0.001,
  "highTime": 1611953999303,
  "highSource": "15 minute delayed price",
  "low": 0.0007,
  "lowTime": 1611943215808,
  "lowSource": "15 minute delayed price",
  "latestPrice": 0.0008,
  "latestSource": "Close",
  "latestTime": "January 29, 2021",
  "latestUpdate": 1611954000000,
  "latestVolume": 45324207,
  "iexRealtimePrice": null,
  "iexRealtimeSize": null,
  "iexLastUpdated": null,
  "delayedPrice": 0.0008,
  "delayedPriceTime": 1611953999303,
  "oddLotDelayedPrice": 0.0008,
  "oddLotDelayedPriceTime": 1611953933404,
  "extendedPrice": 0.0009,
  "extendedChange": 0.0001,
  "extendedChangePercent": 0.125,
  "extendedPriceTime": 1611954024444,
  "previousClose": 0.0007,
  "previousVolume": 4294967295,
  "change": 0.0001,
  "changePercent": 0.14286,
  "volume": 45324207,
  "iexMarketPercent": null,
  "iexVolume": null,
  "avgTotalVolume": 3517540461,
  "iexBidPrice": null,
  "iexBidSize": null,
  "iexAskPrice": null,
  "iexAskSize": null,
  "iexOpen": null,
  "iexOpenTime": null,
  "iexClose": null,
  "iexCloseTime": null,
  "marketCap": 110432678,
  "peRatio": null,
  "week52High": 0.0011,
  "week52Low": 0.0001,
  "ytdChange": 7.14286,
  "lastTradeTime": 1611953999303
}

My attempt on fixing that: use long? for all volume-related properties in the Quote class.

Copy link
Collaborator

@JamiePrentice JamiePrentice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@JamiePrentice
Copy link
Collaborator

Thanks for the fix @rinukkusu!

@vslee vslee merged commit 14e1281 into vslee:main Jan 31, 2021
@vslee vslee added the bug Either the bug, or the bug fix label Jan 31, 2021
@rinukkusu rinukkusu deleted the patch-1 branch January 31, 2021 19:34
@rinukkusu
Copy link
Contributor Author

Thanks for pulling in the changes, but how do I use the pre-release packages from GitHub's package repository?

@JamiePrentice
Copy link
Collaborator

You could do what's listed on the packages page here: https://github.com/vslee/IEXSharp/packages/62376

Until the next Nuget release.

@vslee
Copy link
Owner

vslee commented Feb 1, 2021

I have now released v2.6.0 which includes your fix. But if you do have a chance, please give the pre-release a try as I would like to know if people are having any issues with it.

@rinukkusu
Copy link
Contributor Author

@JamiePrentice @vslee I've tried that already with no success, will check it out in depth tomorrow - thanks a lot!! 😄

@vslee
Copy link
Owner

vslee commented Feb 2, 2021

Try these instructions. If they work for you, I'll link to them from the front page.
https://github.com/vslee/IEXSharp/wiki/Use-GitHub-Packages-with-Visual-Studio

@rinukkusu
Copy link
Contributor Author

Ahhh, I was using my own account, but I had to use your token - makes sense now 😄
Works now - thanks!

Using it with my CI/CD: https://gitlab.com/rinukkusu/telly/-/commit/678cbce30171211316ae42ccae23f682cfc62d5a

@vslee
Copy link
Owner

vslee commented Feb 2, 2021

Great, glad it worked and looks like you figured out how to put it into your NuGet.config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Either the bug, or the bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants