It is a microservice that collect data from a several crypto data providers using its API.
MIT License
It is a microservice that collect data from several crypto data providers using its API.
This microservice uses:
$ go build -o ccd .
You should previously export some environment variables:
export CCDC_DATAPROVIDER=cryptocompare
export CCDC_DATABASEURL=postgres://username:[email protected]:5432/dbname?sslmode=disable
export CCDC_APIKEY=put you api key here
export CCDC_SESSIONSTORE=redis // or "db", default value is "db"
export REDIS_URL=redis://:[email protected]:6379/0 // only when "redis" session store selected
if you want use huobi as data provider export this:
export CCDC_DATAPROVIDER=huobi
If you use mysql db, you should export something like this:
export CCDC_DATABASEURL=mysql://username:password@tcp(localhost:3306)/dbname
And run application:
$ ./ccd -debug
The default port is 8080, you can test the application in a browser or with curl:
$ curl 127.0.0.1:8080/v1/service/ping
You can choose a different port and run more than one copy of ccd on your local host. For example:
$ ./ccd -port 8081
You also can specify some setting before run application:
$ ./ccd -h
ccd is a microservice that collect data from several crypto data providers cryprocompare using its API.
Usage of ccd:
-dataprovider string
use selected data provider ("cryptocompare", "huobi") (default "cryptocompare")
-debug
run the program in debug mode
-h display help
-port string
set specify port (default ":8080")
-session string
set session store "db" or "redis" (default "db")
-timeout int
how long to wait for a response from the api server before sending data from the cache (default 1000)
List of the implemented endpoints:
Example getting a GET request for getting actual info about selected pair:
$ curl "http://localhost:8080/v1/price?fsym=ETH&tsym=JPY"
Example of sending a POST request to add a new worker:
$ curl -X POST -H "Content-Type: application/json" -d '{ "fsym": "BTC", "tsym": "USD", "interval": 60}' "http://localhost:8080/v1/collect"
Example of sending a GET request to remove worker:
$ curl "http://localhost:8080/v1/collect/remove?fsym=BTC&tsym=USD&interval=60"
Example of sending a GET request to subscribe wss channel:
$ curl "http://localhost:8080/v1/ws/subscribe?fsym=BTC&tsym=USD"
Working example URL: https://ccd.run.place/healthz
Web UI: https://ccd.run.place