mmontes11 / crypto-trade

Cryptocurrency trading PoC

Home Page:https://crypto-trade.mmontes-dev.duckdns.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

crypto-trade

Lint Build Test Release Deploy

Artifact HUB Go Report Card Go Reference

Simulates real time cryptocurrency tradings in a microservice ecosystem.



Tech stack

How it works

It contists in 3 microservices:

  • publisher: Generates random trades and sends them to Nats.
  • subscriber: Receives trades and stores them in ClickHouse.
  • api: Exposes a REST API with the trades from ClickHouse.

Installation

Local
  1. Set up Nats and ClickHouse:
$ docker-compose -f docker-compose.services.yml up -d
  1. Start each microservice in a different tab by manually running:
$ make run
Local + Tmux

Install tmux and then:

$ ./scripts/run-dev.sh
Docker
$ ./scripts/run-docker.sh

API

Run in Postman

GET /health

Indicate the service is up and running.

Responses:

  • 200 OK
GET /api/trades

Retrieves real time cryptocurrency trades.

Query params:

  • groupBy: second | minute | hour
  • crypto: btc | eth
  • currency: eur | usd
  • fromDate: 1970-01-01T00:00:00Z
  • toDate: 2050-01-01T00:00:00Z
  • limit: 100

Responses:

  • 200 OK
  • 404 Not Found

Body:

  • Array of trades

Production environment

https://crypto-trade.mmontes-dev.duckdns.org/api/trades?groupBy=hour&crypto=btc&currency=eur&fromDate=2021-01-01T00:00:00Z

About

Cryptocurrency trading PoC

https://crypto-trade.mmontes-dev.duckdns.org

License:MIT License


Languages

Language:Go 77.5%Language:Makefile 16.5%Language:Shell 5.0%Language:Dockerfile 1.1%