jholdstock / dcrwages

Decred contractor price dashboard

Home Page:https://dcrwages.jholdstock.uk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dcrwages

Build Status ISC License

dcrwages is a web application which provides average monthly USDT/DCR price. It starts a web server with a HTML page displaying the price information, as well as providing the information over an API.

http://dcrwages.jholdstock.uk

This rate is used when Decred project contractors submit invoices denominated in US Dollars and receive payment in DCR.

How dcrwages works

Before April 2019

Price data retrieved from Poloniex was used to calculate the monthly price of Decred in USDT. The weighted average price over 15 minute intervals on the USDT/BTC and BTC/DCR markets were used to find monthly average USDT/DCR prices.

This historic data is now hard-coded in dcrwages - the Poloniex API is no longer used by this project.

Since April 2019

The price calculation was updated to use Binance instead of Poloniex, and the interval was changed from 15 minutes to 1 hour.

How to use dcrwages

Build and run locally:

# Build the executable
env GO111MODULE=on go install .

# Run the executable
$(go env GOPATH)/bin/dcrwages

Or build and run in docker:

# Build the container
docker build -t jholdstock/dcrwages .

# Run the container
docker run -d -p 3000:3000 jholdstock/dcrwages:latest

The process will begin contacting Binance and downloading price information.

The web server will start listening on port 3000. You can open the homepage in your browser http://localhost:3000/.

REST API

HTTP Request Response
/api/prices All available prices
/api/prices/{year} Prices for a single year
/api/prices/{year}/{month} Price for a single month

Months are handled as integers. 1 = Jan, 2 = Feb, etc.

Errors are indicated using HTTP status codes and an error description in the response body. For example, a request for data which is unavailble will give a 404 HTTP status and the following body:

{ "error": "No data for year 1966" }

About

Decred contractor price dashboard

https://dcrwages.jholdstock.uk


Languages

Language:Go 38.2%Language:HTML 22.5%Language:CSS 17.9%Language:JavaScript 13.7%Language:Ruby 6.9%Language:Dockerfile 0.8%