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

git pu

parent b5f499a8
...@@ -11,6 +11,7 @@ const client = redis.createClient( ...@@ -11,6 +11,7 @@ const client = redis.createClient(
{url: 'redis://default:p@db.zignaly.xyz:7001'} {url: 'redis://default:p@db.zignaly.xyz:7001'}
); );
let datas = [] let datas = []
let balance = 0
const ccxt = require('ccxt') const ccxt = require('ccxt')
...@@ -27,6 +28,7 @@ exchange.urls['api'] = exchange.urls['test']; ...@@ -27,6 +28,7 @@ exchange.urls['api'] = exchange.urls['test'];
init() init()
balanceUpdater()
async function init() { async function init() {
...@@ -38,6 +40,19 @@ async function init() { ...@@ -38,6 +40,19 @@ async function init() {
} }
async function balanceUpdater() {
try {
let d = await exchange.fetchFreeBalance()
balance = d.USDT
appendBalanceProfitLog(balance)
} catch (e) {
}
await sleep(60000)
return balanceUpdater()
}
async function run() { async function run() {
let files = await fs.readdirSync(path) let files = await fs.readdirSync(path)
for (let i = 0; i < files.length; i++) { for (let i = 0; i < files.length; i++) {
...@@ -405,4 +420,11 @@ function appendDiffProfitLog(log) { ...@@ -405,4 +420,11 @@ function appendDiffProfitLog(log) {
}); });
} }
function appendBalanceProfitLog(log) {
fs.appendFile('C:\\Users\\Administrator\\.pm2\\logs\\change-balance.txt', log + '\n', function (err) {
if (err) throw err;
});
}
...@@ -36,7 +36,10 @@ async function test () { ...@@ -36,7 +36,10 @@ async function test () {
// // console.log('Add Suc With id',sig) // // console.log('Add Suc With id',sig)
// console.log(d) // console.log(d)
//63d101c8-3169-473c-a7ee-53645599474d //63d101c8-3169-473c-a7ee-53645599474d
let d=await exchange.fetchOrder('63d101c8-3169-473c-a7ee-53645599474d','BTCUSDT') // let d=await exchange.fetchOrder('63d101c8-3169-473c-a7ee-53645599474d','BTCUSDT')
// console.log(d)
let d=await exchange.fetchFreeBalance()
console.log(d) console.log(d)
// for (let i=0;i<d.length;i++) // for (let i=0;i<d.length;i++)
// { // {
......
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