Commit 331860ea authored by Ahmad Nemati's avatar Ahmad Nemati

git pu

parent a68383f6
......@@ -326,16 +326,16 @@ async function closer(sig, date, bigData, id, pair) {
}
}
}
await sleep(60000)
d = await exchange.fetchOrder(d.id, d.info.symbol)
let profit = getCalculateProfit(newData.price, d.average)
if (newData.side === 'sell')
profit = profit * -1
let det = 'side:' + newData.side + ' bybit open price:' + newData.price + ' bybit close price:' + d.average
let t = id + ' :' + det + ' bybit profit:' + ' ' + profit + ' yashil profit:' + bigData.profit + ' diff:' + (profit - bigData.profit)
appendDiffProfitLog(t)
// await sleep(60000)
// d = await exchange.fetchOrder(d.id, d.info.symbol)
// let profit = getCalculateProfit(newData.price, d.average)
// if (newData.side === 'sell')
// profit = profit * -1
//
// let det = 'side:' + newData.side + ' bybit open price:' + newData.price + ' bybit close price:' + d.average
//
// let t = id + ' :' + det + ' bybit profit:' + ' ' + profit + ' yashil profit:' + bigData.profit + ' diff:' + (profit - bigData.profit)
// appendDiffProfitLog(t)
}
......@@ -364,30 +364,39 @@ async function adder(sig, qty, date, allData,pair) {
}
console.log(d)
if (typeof d.id !== "undefined") {
await sleep(60000)
try {
d = await exchange.fetchOrder(d.id, d.info.symbol)
console.log('Add Suc With id', d.id, sig)
const [add] = await client
.multi()
.set(sig, JSON.stringify({pair: d.info.symbol, side: d.side, qty: d.amount, price: d.average}))
.exec();
}
catch (e)
{
console.log('Add Suc With id', d.id, sig)
console.log(sig,'Have Problem Reding Order so try offline')
const [add] = await client
.multi()
.set(sig, JSON.stringify({pair: d.info.symbol, side: d.side, qty: d.amount, price: d.price}))
.exec();
}
}
// console.log(d)
// if (typeof d.id !== "undefined") {
// await sleep(60000)
// try {
// d = await exchange.fetchOrder(d.id, d.info.symbol)
// console.log('Add Suc With id', d.id, sig)
// const [add] = await client
// .multi()
// .set(sig, JSON.stringify({pair: d.info.symbol, side: d.side, qty: d.amount, price: d.average}))
// .exec();
// }
// catch (e)
// {
//
// console.log('Add Suc With id', d.id, sig)
// console.log(sig,'Have Problem Reding Order so try offline')
// const [add] = await client
// .multi()
// .set(sig, JSON.stringify({pair: d.info.symbol, side: d.side, qty: d.amount, price: d.price}))
// .exec();
// }
//
// }
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment