Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update price #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
10 changes: 9 additions & 1 deletion commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,15 @@ function GetPrice (message) {
var crexOrderbook = JSON.parse(Data[9])
var graviexMarket = JSON.parse(Data[4]), crexMarket = JSON.parse(Data[7]), cryptalMarket = JSON.parse(Data[8]);
var graviexPrice = Number(graviexMarket.ticker.change * 100).toFixed(2), crexPrice = Number(crexMarket[0].price).toFixed(8), cryptalPrice = Number(cryptalMarket.price_ticker.last_price).toFixed(8);
message.channel.send('**```fix\nGraviex: Crex24: CryptalDash:\nLast trade: ' + Number(graviexMarket.ticker.last).toFixed(8) + ' BTC Last Trade: ' + Number(crexPrice).toFixed(8) + ' BTC Last Trade: ' + cryptalPrice + ' BTC\nCurrent buy: ' + Number(graviexMarket.ticker.buy).toFixed(8) + ' BTC Current buy: ' + crexOrderbook.buyLevels[0].price.toFixed(8) + ' BTC Current buy: ' + cryptalMarket.price_ticker.ask.toFixed(8) + ' BTC\nCurrent sell: ' + Number(graviexMarket.ticker.sell).toFixed(8) + ' BTC Current sell: ' + crexOrderbook.sellLevels[0].price.toFixed(8) + ' BTC Current sell: ' + cryptalMarket.price_ticker.bid.toFixed(8) + ' BTC\n24h change: ' + ((graviexPrice >= 0) ? '+' : '') + graviexPrice + '% 24h change: ' + cryptalMarket.price_ticker.percent_change24h.toFixed(2) + '%\nVolume: ' + Number(graviexMarket.ticker.volbtc).toFixed(4) + ' BTC Volume: ' + cryptalMarket.price_ticker.volume24h + ' BTC```**');
if(exchange === 'crex24' || exchange === 'crex'){
message.channel.send('**```fix\nCrex24:\nLast Trade: ' + Number(crexPrice).toFixed(8) + ' BTC\nCurrent buy: ' + crexOrderbook.buyLevels[0].price.toFixed(8) + ' BTC\nCurrent sell: ' + crexOrderbook.sellLevels[0].price.toFixed(8) + ' BTC\n```**');
}else if(exchange === 'graviex' || exchange === 'grav'){
message.channel.send('**```fix\nGraviex:\nLast trade: ' + Number(graviexMarket.ticker.last).toFixed(8) + ' BTC\nCurrent buy: ' + Number(graviexMarket.ticker.buy).toFixed(8) + ' BTC\nCurrent sell: ' + Number(graviexMarket.ticker.sell).toFixed(8) + ' BTC\n24h change: ' + ((graviexPrice >= 0) ? '+' : '') + graviexPrice + '%\nVolume: ' + Number(graviexMarket.ticker.volbtc).toFixed(4) + ' BTC```**');
}else if(exchange === 'cryptaldash' || exchange === 'cd'){
message.channel.send('**```fix\nCryptalDash:\nLast Trade: ' + cryptalPrice + ' BTC\nCurrent buy: ' + cryptalMarket.price_ticker.ask.toFixed(8) + ' BTC\nCurrent sell: ' + cryptalMarket.price_ticker.bid.toFixed(8) + ' BTC\n24h change: ' + cryptalMarket.price_ticker.percent_change24h.toFixed(2) + '%\nVolume: ' + cryptalMarket.price_ticker.volume24h + ' BTC```**');
}else{
message.channel.send('**```Suggested use: !price graviex, !price crex, !price cd```**');
}
});
});
});
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Bot.on('message', (message) => {
message.author.send("Hi, I'm the 01coin bot, and I'm happy to help! I respond to the following commands...\n**```fix\n" +
prefix + "blockcount - Shows the current block height\n" +
prefix + "donations - Shows the current balance in the donation wallets\n" +
prefix + "price - Shows the current ZOC price on exchange\n" +
prefix + "price <exchange> - Shows the current ZOC price on the exchange\n" +
prefix + "hashrate - Shows the current mining hashrate of the network\n" +
prefix + "mine N - Shows the estimated mining proceeds for N MH/s\n" +
prefix + "value N - Shows the market value for N ZOC\n" +
Expand Down