Fix
This commit is contained in:
parent
44b67d9278
commit
cc5b0daee9
32
analytics.js
Normal file
32
analytics.js
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
const db = require("./database");
|
||||||
|
|
||||||
|
db.query(
|
||||||
|
`select * from analytics WHERE count >= 3`,
|
||||||
|
[],
|
||||||
|
(error, results) => {
|
||||||
|
if (error) {
|
||||||
|
console.log(error);
|
||||||
|
} else {
|
||||||
|
const obj = {};
|
||||||
|
|
||||||
|
results.forEach((e, i) => {
|
||||||
|
if (typeof obj[e.count] === 'undefined') {
|
||||||
|
obj[e.count] = {
|
||||||
|
prev: {},
|
||||||
|
next: {},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (results[i - 1]) {
|
||||||
|
obj[e.count].prev[results[i - 1].count] = (obj[e.count].prev[results[i - 1].count] || 0) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (results[i + 1]) {
|
||||||
|
obj[e.count].next[results[i + 1].count] = (obj[e.count].next[results[i + 1].count] || 0) + 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
10
index.js
10
index.js
@ -48,7 +48,7 @@ let isShowWarningInterrupted = false;
|
|||||||
const CONFIG = {
|
const CONFIG = {
|
||||||
autoTrade: true,
|
autoTrade: true,
|
||||||
countTradeContinue: 3, // 7 lệnh thông thì đánh ngược lại
|
countTradeContinue: 3, // 7 lệnh thông thì đánh ngược lại
|
||||||
moneyEnterOrder: [5, 5, 10, 20, 30], // Nếu gặp 7 lệnh thông sẽ đánh ngược lại với từng mệnh giá này
|
moneyEnterOrder: [5, 10, 20, 35, 70, 125, 0, 0, 0, 0, 0, 0, 0, 0], // Nếu gặp 7 lệnh thông sẽ đánh ngược lại với từng mệnh giá này
|
||||||
maxHistory: 40, // Lưu lại lịch sử 40 phiên
|
maxHistory: 40, // Lưu lại lịch sử 40 phiên
|
||||||
historys: [], // Lịch sử lệnh
|
historys: [], // Lịch sử lệnh
|
||||||
enterOrderList: [], // Lệnh đang vào
|
enterOrderList: [], // Lệnh đang vào
|
||||||
@ -74,7 +74,7 @@ puppeteer
|
|||||||
await Promise.all([page.waitForNavigation()]);
|
await Promise.all([page.waitForNavigation()]);
|
||||||
|
|
||||||
const job = new cron.CronJob({
|
const job = new cron.CronJob({
|
||||||
cronTime: "45 0/1 * * * *",
|
cronTime: "50 0/1 * * * *",
|
||||||
onTick: async function () {
|
onTick: async function () {
|
||||||
await page.reload({ waitUntil: ["networkidle0"] });
|
await page.reload({ waitUntil: ["networkidle0"] });
|
||||||
},
|
},
|
||||||
@ -84,8 +84,8 @@ puppeteer
|
|||||||
await cdp.send("Network.enable");
|
await cdp.send("Network.enable");
|
||||||
await cdp.send("Page.enable");
|
await cdp.send("Page.enable");
|
||||||
let id = 1;
|
let id = 1;
|
||||||
|
let count = 0;
|
||||||
let countStaticData = 0;
|
let countStaticData = 0;
|
||||||
let count;
|
|
||||||
|
|
||||||
const printResponse = async function (cdp, response) {
|
const printResponse = async function (cdp, response) {
|
||||||
if (!response.response || !page || !page.evaluate) {
|
if (!response.response || !page || !page.evaluate) {
|
||||||
@ -147,9 +147,8 @@ puppeteer
|
|||||||
} else if (finalSide === "NORMAL") {
|
} else if (finalSide === "NORMAL") {
|
||||||
lastResult = 2;
|
lastResult = 2;
|
||||||
}
|
}
|
||||||
|
// Không tính nến chờ
|
||||||
if (currentSessionID !== -1) {
|
if (currentSessionID !== -1) {
|
||||||
// Không tính nến chờ
|
|
||||||
roleEnterOrder(dataParse.session, lastResult);
|
roleEnterOrder(dataParse.session, lastResult);
|
||||||
// TeleGlobal.sendMessage(
|
// TeleGlobal.sendMessage(
|
||||||
// TELEGRAM_CHANNEL,
|
// TELEGRAM_CHANNEL,
|
||||||
@ -578,7 +577,6 @@ function roleEnterOrder(sessionID, lastResult) {
|
|||||||
CONFIG.moneyEnterOrder[currentEnterOrder.ind] * 0.95
|
CONFIG.moneyEnterOrder[currentEnterOrder.ind] * 0.95
|
||||||
})`
|
})`
|
||||||
);
|
);
|
||||||
|
|
||||||
deleteCurrentEnterOrder();
|
deleteCurrentEnterOrder();
|
||||||
} else {
|
} else {
|
||||||
// Nếu vẫn còn vốn xoay vòng thì đánh tiếp
|
// Nếu vẫn còn vốn xoay vòng thì đánh tiếp
|
||||||
|
Loading…
x
Reference in New Issue
Block a user