Skip to content

Commit

Permalink
Add rest API to controller.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiago Siebler committed Jan 16, 2018
1 parent f91c1dc commit 680f807
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,5 @@ node --inspect index.js
```

# Social
Talk to us on [Slack](https://join.slack.com/t/cryptotriarbbot/shared_invite/enQtMjkxOTMwMzAyOTAzLWZmNGQ3ZWE1MGI4NDUzNjdiODcyMDRkZjM2NjgxYWFhMzYxZDAyYWI1ZDVjMDRlZjI4MGM0ZGU1ZjViNjhmYWE)
Talk to us on [Slack](https://join.slack.com/t/cryptohut/shared_invite/enQtMzAwMjk5NjIwOTgyLTY3NTc4ZTE2MGIwZDg1OThhODc4ZGI2ODRiMzNiZTc2MGQ2ZThjNmQyNjdiODIyZjMzYjNjNjdjODY1YWNjYjc)

22 changes: 13 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,25 @@ if (!process.env.binance_key || !process.env.binance_secret) {
};

logger.info('\n\n\n----- Bot Starting : -----\n\n\n');

var activePairs, exchangeAPI = {};

logger.info('--- Loading Exchange API');
const api = require('binance');
const binanceRest = new api.BinanceRest({
key: process.env.binance_key,
secret: process.env.binance_secret,
timeout: parseInt(process.env.restTimeout), // Optional, defaults to 15000, is the request time out in milliseconds
recvWindow: parseInt(process.env.restRecvWindow), // Optional, defaults to 5000, increase if you're getting timestamp errors
disableBeautification: process.env.restBeautify != 'true'
});


// make exchange module dynamic later
var activePairs, exchangeAPI = {};
if(process.env.activeExchange == 'binance'){
logger.info('--- \tActive Exchange:' + process.env.activeExchange);
activePairs = process.env.binancePairs;

const api = require('binance');
exchangeAPI = new api.BinanceRest({
key: process.env.binance_key,
secret: process.env.binance_secret,
timeout: parseInt(process.env.restTimeout), // Optional, defaults to 15000, is the request time out in milliseconds
recvWindow: parseInt(process.env.restRecvWindow), // Optional, defaults to 5000, increase if you're getting timestamp errors
disableBeautification: process.env.restBeautify != 'true'
});
exchangeAPI.WS = new api.BinanceWS();
}

Expand Down

0 comments on commit 680f807

Please sign in to comment.