Commit 0e6e706a authored by Ahmad Nemati's avatar Ahmad Nemati

git pull

parent 3a62c342
...@@ -37,7 +37,17 @@ async function getAllAccounts() { ...@@ -37,7 +37,17 @@ async function getAllAccounts() {
}) })
}
async function updateEquityByid(id, equity) {
return await Account.update(
{
equity: equity,
},
{where: {id: id}})
} }
...@@ -49,6 +59,7 @@ sequelize.sync() ...@@ -49,6 +59,7 @@ sequelize.sync()
module.exports = { module.exports = {
getAllAccounts:getAllAccounts getAllAccounts:getAllAccounts,
updateEquityByid:updateEquityByid
}; };
...@@ -102,6 +102,22 @@ async function init() { ...@@ -102,6 +102,22 @@ async function init() {
// run() // run()
balanceUpdater() balanceUpdater()
dbEquityUpdater()
}
async function dbEquityUpdater()
{
try {
for (let i=0;i<accs.length;i++)
db.updateEquityByid(accs[i].id,accs[i].equity)
}
catch (e)
{
}
await sleep(60000)
return dbEquityUpdater()
} }
......
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