Coinscience is a project that provides a backend implementation in Go for retrieving and comparing cryptocurrency prices across different exchanges. This backend allows viewers to see the price of a coin listed on various exchanges and find the exchange with the lowest price.
The backend code provides the following functionality:
- Retrieve the price of a specific coin from different exchanges.
- Compare the prices across exchanges and identify the exchange with the lowest price.
- Provide an API endpoint to retrieve the lowest price of a coin for a given exchange.
The backend code follows the hexagonal architecture design pattern, also known as the ports and adapters architecture. The project structure is organized as follows:
cmd/
: Contains the entry point(s) for the application.internal/
: Contains the core implementation of the application following the hexagonal architecture.app/
: Implements the application logic, use cases, and business rules.domain/
: Defines the domain models and interfaces.infrastructure/
: Implements the adapters and infrastructure code (e.g., external API clients, database access).
api/
: Contains the API handlers and routes for exposing the functionality to clients.pkg/
: Contains reusable packages and utilities.scripts/
: Contains scripts for building, testing, and other project-related tasks.
The backend currently supports the following cryptocurrency exchanges:
- Binance
- Gate.io
- Kraken
- Bitfinex
- Coinbase
The backend code is written in Go and utilizes the following technologies:
- Go programming language
- RESTful API development
- Third-party packages for interacting with the supported exchanges' APIs
To use the backend code for the Coinscience project, follow these steps:
- Clone the repository:
git clone https://github.com/UmarFarooq-MP/coinscience
- Install the necessary dependencies using a package manager like
go mod tidy
. - Run
docker-compose up -d
to up rabbitmttq in dockerize environment. - Build and run the application using
go run cmd/main.go
. - Try updating the mod file
go get -u ./...
if above does not work. - To run locally you need rabbit mq which can be run on docker using these two commands
docker network create rabbitmq_network docker run -d --hostname queue --name rabbitmq --network rabbitmq_network -p 5672:5672 -p 15672:15672 rabbitmq:management
- Also make sure to replace this line when running locally.
quePublisher, err := publisher.NewRabbitMQPublisher("amqp://guest:guest@localhost:5672/")
WORK IN PROGRESS
WORK IN PROGRESS
Contributions to the Coinscience project are welcome! If you find any issues or have suggestions for improvements, feel free to submit a pull request or create an issue on the GitHub repository.
The Coinscience backend code is licensed under the MIT License.