save
This commit is contained in:
parent
2c321a02e5
commit
81ce0c440f
12
index.js
12
index.js
@ -3,6 +3,7 @@
|
|||||||
const Request = require('request-promise');
|
const Request = require('request-promise');
|
||||||
const dotenv = require('dotenv');
|
const dotenv = require('dotenv');
|
||||||
dotenv.config();
|
dotenv.config();
|
||||||
|
|
||||||
const token = process.env['TELEGRAM_TOKEN'];
|
const token = process.env['TELEGRAM_TOKEN'];
|
||||||
const chat_id = process.env['TELEGRAM_CHAT_ID'];
|
const chat_id = process.env['TELEGRAM_CHAT_ID'];
|
||||||
const api_key = process.env['BINANCE_API_KEY'];
|
const api_key = process.env['BINANCE_API_KEY'];
|
||||||
@ -15,16 +16,13 @@ if (NODE_ENV === "development") {
|
|||||||
} else {
|
} else {
|
||||||
console.log("NODE_ENV production")
|
console.log("NODE_ENV production")
|
||||||
}
|
}
|
||||||
|
|
||||||
//Indian time string
|
//Indian time string
|
||||||
const event = new Date().toLocaleString('en-IN', {
|
const event = new Date().toLocaleString('en-IN', {
|
||||||
timeZone: timeZone,
|
timeZone: timeZone,
|
||||||
timeZoneName: 'short'
|
timeZoneName: 'short'
|
||||||
});
|
});
|
||||||
//only for heroku port error
|
|
||||||
const express = require('express');
|
|
||||||
const app = express();
|
|
||||||
app.all('/', (req, res) => res.send('Bot is Running'));
|
|
||||||
app.listen(port, () => console.log(`${event} - Server started on ${port} port`));
|
|
||||||
//BinanceWS
|
//BinanceWS
|
||||||
const binanceApi = require('binance');
|
const binanceApi = require('binance');
|
||||||
const binanceWS = new binanceApi.BinanceWS(false);
|
const binanceWS = new binanceApi.BinanceWS(false);
|
||||||
@ -39,7 +37,7 @@ try {
|
|||||||
process_data(data);
|
process_data(data);
|
||||||
}, 60000).then(() => {
|
}, 60000).then(() => {
|
||||||
console.log(`${event} - Monitoring Spot User Order Data for binance.com`);
|
console.log(`${event} - Monitoring Spot User Order Data for binance.com`);
|
||||||
sendMessage(`<b>Binance Spot Order Monitor Started</b>\nthis message shows that you or heroku(if your are using) restart the bot.`)
|
// sendMessage(`<b>Binance Spot Order Monitor Started</b>\nthis message shows that you or heroku(if your are using) restart the bot.`)
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(`${event} - ${err}`)
|
console.error(`${event} - ${err}`)
|
||||||
@ -103,7 +101,7 @@ function process_data(data) {
|
|||||||
}
|
}
|
||||||
} else if (executionType === 'CANCELED') {
|
} else if (executionType === 'CANCELED') {
|
||||||
if (orderStatus === 'CANCELED') {
|
if (orderStatus === 'CANCELED') {
|
||||||
txt = `❎ ❎ ❎\n<b>Spot ${orderType} ${side} Order CANCELED</b>\n<b>Symbol:</b> #${symbol}\n<b>Price:</b> ${price}\n<b>Quantity:</b> ${fixFloat(quantity)}${total}\n<b>Order ID:</b> #ID${orderId}`
|
txt = `❌ ❌ ❌\n<b>Spot ${orderType} ${side} Order CANCELED</b>\n<b>Symbol:</b> #${symbol}\n<b>Price:</b> ${price}\n<b>Quantity:</b> ${fixFloat(quantity)}${total}\n<b>Order ID:</b> #ID${orderId}`
|
||||||
}
|
}
|
||||||
} else if (executionType === 'TRADE') {
|
} else if (executionType === 'TRADE') {
|
||||||
if (orderStatus === 'PARTIALLY_FILLED') {
|
if (orderStatus === 'PARTIALLY_FILLED') {
|
||||||
|
1074
package-lock.json
generated
1074
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user