GoMarketWatch is a real-time market data tracking application built with Go, utilizing the power of concurrent websockets and scheduled tasks. It uses the Gin framework for handling HTTP requests, and integrates tradingview
's API to fetch and update financial symbol data in real time.
- Real-Time Data Updates: Utilizes websockets to receive updates about financial symbols from TradingView.
- Concurrent Handling: Manages multiple symbol data concurrently with robust synchronization using mutexes to ensure data consistency.
- Automated Cleanup: Scheduled tasks identify and remove inactive symbols that haven't been requested in over 30 seconds to maintain efficiency.
- Performance Monitoring: Integrated with
pprof
for profiling and monitoring the application's performance on the go.
To get started with GoMarketWatch:
- Ensure you have Go installed on your system.
- Clone this repository and navigate into the project directory.
- Load the necessary environment variables by creating a
.env
file based on the provided.env.example
. - Run the application using:
go run main.go
- GET
/latest-price
: Fetches the latest price of a specified symbol. This endpoint expects a query parametersymbol
which represents the symbol of interest.
PORT
: Specifies the port on which the server will run.HOST
: Specifies the host address for the server.
- Gin-Gonic: A high-performance web framework.
- Go-Cron: Used for scheduling tasks.
- GoDotenv: For loading environment variables from a
.env
file. - TradingView Websocket Client: For real-time financial data streaming.
Contributions are welcome! Please feel free to submit pull requests or open issues to suggest improvements or add new features.