Skip to content

georgemjohnson11/StockMarketApiDatabase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

This application works with a Postgresql database populated with stock market information and I've split this solution up into two projects: Stocks.Domain and Stocks.Data
The Stocks.Data is the models for the stock market and saving YahooFinanceAPI's json into Postgres SQL. The models are written using Entity Framework Core. Stocks.Domain is used for displaying, manipulating, and controlling the stock information and API. The API uses RESTful properties and reads/writes asynchronously.

Mapping - A folder for filters and maps to models

Logging - Serilog is utilized to inject logging throughout the application

Users - IdentityServer4 is used to manage user login with OpenID Connect and OAuth 2.0

The UI is controlled by a Vue app: https://github.com/georgemjohnson11/stockmarket-vue

Prerequisites

Database (Postgres)
.NET Core
Entity Framework Core
Postman
Visual Studio Code

Getting a Stock Market DB

If you want to start from scratch so you can change the backend of the database, you'll need to update the connection string in appsettings.json and run entity framework database migrations. To do the latter, you'll run in the package manager console, update database. The StockTicker.Ids are taken from the Stocks.Data/Models/Seeds/NYSE.csv () in which you can then import the CSV as a table to a new Docker Postgres container mapping the fields to the model. It would be preferred to seed this CSV as a table as .NET core recently released the ability to seed which can be done upon refactoring. To get a new version of this CSV, you can attain one here: https://www.nasdaq.com/screening/company-list.aspx (Note: the NYSE is a combination of the NASDAQ and AMEX)

Once you've attained a blank database (except for the StockTickers table), you can run the entity framework migrations for the application from the Nuget Package Manager Console. Start the application which should open up a default Microsoft page for a variety of their applications To generate data, you can go to https://localhost:5001/api/generate/goog/2018-01-01/2018-02-01/daily where you can replace "goog" with any stock ticker that YahooFinanceAPI supports

Leveraging Postman, this process can be automated to attain (most) stock market information. To do this, create a New Collection set a GET request to the URL https://localhost:5001/api/generate/{{Symbol}}/2018-01-01/2018-02-01/daily. In the Data section of Collection, use the CSV from Stocks.Data/Models/Seeds/NYSE.csv and have a 10 second delay between requests (Yahoo's Finance API has limitations) and Run the Collection.

References

Thanks to: YahooFinanceAPI implementation from dennislwy (https://github.com/dennislwy/YahooFinanceAPI)
Microsoft .NET Core API documentation (https://docs.microsoft.com/en-us/ef/core/get-started/aspnetcore/new-db?view=aspnetcore-2.0&tabs=visual-studio)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published