crypto-exchange-manager
Version:
Wrapper for cryptocurrencies exchanges apis.
31 lines (25 loc) • 901 B
JavaScript
const cryptoManager = require('../index.js');
const {convertToUSDIfPossible} = require('../utils');
const coinbase = new cryptoManager['coinbase']({ key : 'giRXDTFjohdXlhM1', secret : 'o1r1KehEDKQj1ZJ1nPROMgclocSbZdjA'});
const bitfinex = new cryptoManager['bitfinex']({ key : 'XOFwFskZdvmlTdAbru2YdOfZzorf0tpuOhvQZpS9M3X', secret : 'lLK8ZvgMXMZKUhxySLVnMI9Icqz20PbvAOq1MdbCwoc'});
const poloniex = new cryptoManager['poloniex']();
function profit(exch) {
let fakeWallet = 0;
exch.getBook().then((result) => {
result.map( res => {
fakeWallet += parseFloat(res.nativeValue)
})
return true;
})
.then(() => exch.getWallet())
.then(result => {
result.map( res => {
fakeWallet -= parseFloat(res.wallet);
});
})
.then(() => {
console.log(-fakeWallet)
})
}
// profit(bitfinex);
// profit(coinbase);