Skip to content
This repository was archived by the owner on Mar 5, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.dockerignore
.git/
node_modules/
Dockerfile
docker-compose.yml
61 changes: 46 additions & 15 deletions AppConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ var config = {
kraken: {
name: 'Kraken',
orgUrl: 'https://www.kraken.com/',
url: 'https://api.kraken.com/0/public/Ticker?pair=DASHUSD'
url: 'https://api.kraken.com/0/public/Ticker?pair=DASHUSD',
urlEur: 'https://api.kraken.com/0/public/Ticker?pair=DASHEUR',
urlBTC: 'https://api.kraken.com/0/public/Ticker?pair=DASHXBT'
},
poloniex: {
name: 'Poloniex',
Expand All @@ -34,17 +36,20 @@ var config = {
bittrex: {
name: 'Bittrex',
orgUrl: 'https://bittrex.com/',
url: 'https://bittrex.com/api/v1.1/public/getmarketsummary?market=btc-dash'
url: 'https://bittrex.com/api/v1.1/public/getmarketsummary?market=btc-dash',
urlEth: 'https://bittrex.com/api/v1.1/public/getmarketsummary?market=ETH-dash'
},
bitfinex: {
name: 'Bitfinex',
orgUrl: 'https://www.bitfinex.com/',
url: 'https://api.bitfinex.com/v1/pubticker/dshusd'
url: 'https://api.bitfinex.com/v1/pubticker/dshusd',
urlBTC: 'https://api.bitfinex.com/v1/pubticker/dshbtc'
},
hitbtc: {
name: 'Hitbtc',
orgUrl: 'https://hitbtc.com/',
url: 'https://api.hitbtc.com/api/1/public/DASHUSD/ticker'
url: 'https://api.hitbtc.com/api/1/public/DASHUSD/ticker',
urlBTC: 'https://api.hitbtc.com/api/1/public/DASHBTC/ticker'
},
bithumb: {
name: 'Bithumb',
Expand All @@ -54,7 +59,8 @@ var config = {
livecoin: {
name: 'Livecoin',
orgUrl: 'https://www.livecoin.net',
url: 'https://api.livecoin.net/exchange/ticker?currencyPair=DASH/USD'
url: 'https://api.livecoin.net/exchange/ticker?currencyPair=DASH/USD',
urlBTC: 'https://api.livecoin.net/exchange/ticker?currencyPair=DASH/BTC',
},
exmo: {
name: 'Exmo',
Expand All @@ -64,23 +70,48 @@ var config = {
yobit: {
name: 'Yobit',
orgUrl: 'https://yobit.net/',
url: 'https://yobit.net/api/3/ticker/dash_usd'
url: 'https://yobit.net/api/3/ticker/dash_usd',
urlBTC: 'https://yobit.net/api/3/ticker/dash_btc',
urlRur: 'https://yobit.net/api/3/ticker/dash_rur'
},
ccex: {
name: 'C-cex',
orgUrl: 'https://c-cex.com/',
url: 'https://c-cex.com/t/dash-usd.json'
url: 'https://c-cex.com/t/dash-usd.json',
urlBTC: 'https://c-cex.com/t/dash-btc.json'
},
yahoofinance: {
name: 'Yahoo',
orgUrl: 'https://www.yahoo.com/',
url: 'https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.xchange%20where%20pair%20in%20(%22KRWUSD%22)&format=json&env=store://datatables.org/alltableswithkeys&callback='
cexio: {
name: 'Cex.io',
orgUrl: 'https://cex.io/',
url: 'https://cex.io/api/last_price/DASH/USD',
urlBTC: 'https://cex.io/api/last_price/DASH/BTC',
urlEur: 'https://cex.io/api/last_price/DASH/EUR'
},
binance: {
name: 'Binance',
orgUrl: 'https://www.binance.com/',
url: 'https://api.binance.com/api/v3/ticker/price'
},
coinroom: {
name: 'Coinroom',
orgUrl: 'https://coinroom.com/',
url: 'https://coinroom.com/api/ticker/DASH/USD'
},
huobi: {
name: 'Huobi',
orgUrl: 'https://www.huobi.pro/',
url: 'https://api.huobi.pro/market/trade?symbol=dashbtc'
},
CurrencyConverterApi: {
name: 'CurrencyConverterApi',
orgUrl: 'https://free.currencyconverterapi.com/',
url: 'https://free.currencyconverterapi.com/api/v5/convert?q=KRW_USD&compact=y'
}
},
budgets: {
dashwhale: {
name: 'DashWhale',
url: 'https://www.dashwhale.org/api/v1/budget'
dashCentral: {
name: 'DashCentral',
url: 'https://www.dashcentral.org/api/v1/budget'
}
},
masternodes: {
Expand All @@ -95,7 +126,7 @@ var config = {
chain: {
insight: {
name: 'Insight',
url: 'https://insight.dash.siampm.com/api/blocks',
url: 'https://insight.dashevo.org/insight-api-dash/blocks',
maxBlocks: 10
}
},
Expand Down
7 changes: 5 additions & 2 deletions CacheConfig.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@

var memcachedHost = process.env.MEMCACHED_HOST || 'localhost';
var memcachedPort = process.env.MEMCACHED_PORT || '11211';

var cacheConfig = {

endpoint: 'localhost:11211',
endpoint: memcachedHost + ':' + memcachedPort,

exchange: {
key: 'dashapi_exchange',
timeout_seconds: 10
timeout_seconds: 20
},

budgets: {
Expand Down
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM node:9-alpine
LABEL maintainer="Dash Developers <evodevs@dash.org>"
LABEL description="Dockerised Dash.org Rate Etc API"

WORKDIR /app
COPY . /app

RUN npm i npm@latest -g

RUN npm install --quiet

CMD ["/usr/local/bin/node", "Server.js"]
4 changes: 2 additions & 2 deletions Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ global.cacheConnection = Cache.connect();

var server = app.listen(AppConfig.port, function () {

var host = server.address().address;
var host = process.env.BIND_HOST || server.address().address;
var port = server.address().port;
console.log('dash.org api server listening at http://%s:%s', host, port);
});
});
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: '2'
services:
app:
build: .
restart: always
links:
- memcached
environment:
- BIND_HOST=0.0.0.0 # b/c docker
- MEMCACHED_HOST=memcached
ports:
- 127.0.0.1:9090:9090
memcached:
image: memcached:alpine
restart: always
Loading