GraphQL API to Buy, Sell and track acquired Stocks performance.
- Go to the project folder
cd stock-market
- Run a Docker compose up
docker-compose up
You may see the graphql-api running along with event-processor and history-fetcher
- Go to
localhost/graphql
end send request through the UI
NOTE: No need to run Kafka or DB locally, both services are hosted on Azure.
-
Stock.Market.WebApi.GraphQL - The main application where the graphql commands are going to be validated and them sent to the Kafka stream.
-
Stock.Market.HistoryFetcher - Background service in charge of retrieving Nasdaq data and update the StockHistory. This service is triggered periodically according to the
FetchDataInterval
environment variable. It checks each symbols from acquired Stocks and stores the current stock quotation in the database -
Stock.Market.EventProcessor - Background service which consumes Kafka events(to Buy or Sell shares) and updates de database with the required information.
-
Stock.Market.Data - Library with Entities, DBContext and Migrations.
-
Stock.Market.Common - Library with shared code.
mutation{
buyStockShares(quantity: 5, symbol: "AAPL")
}
mutation{
sellStockShares(quantity: 2, symbol: "AAPL")
}
query{
stockData{
symbol,
variation,
sharesHeld,
totalValue,
currentDayReferencePrices{
lowestPrice,
averagePrice,
highestPrice
}
}
}
query{
priceHistory(symbol: "AAPL"){
companyName,
symbol,
quotes{
date,
price
}
}
}
- Test projects are located at the
Tests
folder. - You can run tests through Visual Studio interface or through the dotnet cli.
- All the main logic is being tested. Tools such as xUnit, Moq and AutoFixture were used.