Fetching Stock Prices and Refactoring API Calls - FULL STACK WPF (.NET CORE) MVVM #7

preview_player
Показать описание
I create a service class to fetch the price of a stock for a symbol. After noticing some duplication between the StockPriceService and the MajorIndexService, I refactor both classes by introducing a custom HttpClient. I also create a custom exception to throw when invalid symbols are passed to the StockPriceService. Lastly, I do some cleanup throughout the application by throwing an exception as a default for a switch statement, getting a more pleasant name for MajorIndexes, and renaming the Stock class to Asset.

In this series, I walk through the development of a WPF application from the database layer to the UI layer.

Рекомендации по теме
Комментарии
Автор

I used bindings a lot of times, but I am unaware of FallbackValue. I am learning new things every day from you. Thanks Sean.

sivakumarr
Автор

Bundle of Thanks Sean!!!
This valuable series of yours has turned out to be a Great Treasure for sure!

faraz-online
Автор

Thanks for explaining the reason why you've stored the interfaces in the Domain. This makes a lot of sense and agree it's a much better to move the dependency away from a concrete API implementation - will be changing my current project's structure to match.

thomasbarratt
Автор

All this is new for me, I hope to be able to carry out my own project at the end of this course.
Thanks for giving away such good material, my best wishes to the author.

marilu
Автор

Sean, Thank you for these videos. I've been learning C# and just getting my feet wet with WPF. I am more versed in C++ Win32 and this is a huge lift for me to switch my approach. It is all still confusing since I'm still new to c#, OOP, WPF, Entity Framework, Dependency Injection, etcetera... I've spend a lot of hours going over your videos and following along as you develop this project. I've been trying to implement some of these concepts to refactor an old Win32 app that I have wanted to re-write for a while. I can't thank you enough this has been very helpful and my re-write is going surprisingly well so far. I'm beginning to really like the WPF UI now that I've been able to make a few things work which is just enough of a push to keep learning.

waderay
Автор

Hi, I was wondering if setting Price in StockPriceResult to double? would be an ok alternative. I tried it out and the json deserialization seemed to work ok. that way an exception could be thrown on null instead of zero. Zero would most likely never be a realistic price, so it should reliably be used as an exception... but this idea might be usable in a different use case for a different type of API call where 0 is acceptable. Do you know of any pitfalls in using it? thx for another great episode. :-)

jcturpin
Автор

Very valuable instructions. But highly recommend move to UWP since Windows on ARM is the real future now

vandeljasonstrypper
Автор

Thanks Sean. Update the API endpoint for real time stock prices can be access only by premium members

fluffymaverick
Автор

Thank you for this tutorial. Why you createing classes for every method, like Sellstock service, Buystock service, wt about to have Stock service. It might end up with enormous number of classes when making real application

rightbracketethicalhacker
Автор

I have been trying to figure this out for the last few weeks and you have made these videos just in time! If you could show how to get the financial statements like the balance sheet from the Json links into a table that would be fantastic! I've yet to find a solution... Great video!

jamesgrainger
Автор

Minor question, and you might cover this later, but isn't it better to use decimal instead of double for monetary calculations?

jackkendall
Автор

Is there a way to make your API calls return a single Json object instead of an array? I'm only getting arrays returned and its causing errors with Newtonsoft.

jamespope
Автор

Hey!
Great series so far... Is there more to come?? eagerly waiting.

bgupta
Автор

Great series so far. My client requirement is Apply clean Architecure In wpf Application. Would you please make a video to clarify clean architecture - Interface Business Rule, Application Business Rule, Interface Adapter, Framework and Drivers?

shahjahan
Автор

Hi Thanks for the video. Can you please continue videos on Custom control development?

VinuP
Автор

apparently even thou stock can be 0 is not 'tradable'.

Saleca