This project is a C# application that utilizes the Binance WebSocket API to collect price data for BTCUSDT, ADAUSDT, and ETHUSDT symbols. The application stores the price data in a relational database and exposes an HTTP API for querying average prices and calculating simple moving averages. It also includes a Console application for direct interaction. The application structure consists class libraries for managing the data logic and help services.
- ASP.NET
- PostgreSQL
- EntityFramework
- Clone the Repository:
git clone https://github.com/yovko93/BinanceCryptoPriceAPP.git
- Navigate to the
BinanceCryptoPriceAPI
project:
Open appsettings.json
and place the connection string for your PostgreSQL database.
- Navigate to the
CryptoPriceConsoleApp
project:
Open appsettings.json
and place the connection string for your PostgreSQL database.
- Open Package Manager Console and set as default project
Data
:
-
Enter the following commands:
Add-Migration InitialCreate
Update-Database
- Run
BinanceCryptoPriceAPI
orCryptoPriceConsoleApp
The BinanceCryptoPriceAPI
project provides a web-based interface for accessing cryptocurrency price data. This project is built with ASP.NET Core and offers several endpoints to fetch price information.
-
PriceController.cs
GET /api/{symbol}/24hAvgPrice
: Returns the average price for the last 24h of data in the database ( or the oldest available, if 24h of data is not available ).GET /api/{symbol}/SimpleMovingAverage
: Return the current Simple Moving Average (SMA) of the symbol's price.
-
WebSocketController.cs - There is 3 endpoinds to control proccess for the websocket service
POST /api/WebSocket/start
POST /api/WebSocket/stop
POST /api/WebSocket/restart
The Application
project encapsulates business logic and background services for processing cryptocurrency data.
The Data
project contains the database context and entity models. It is responsible for initializing the database.
The Models
project include several response objects
The CryptoPriceConsoleApp
is a Console application for direct interaction with the cryptocurrency data.
This project is licensed under the MIT License.