Commit 97c2cef5 authored by Ahmad Nemati's avatar Ahmad Nemati

git pull

parent 3b6db2da
......@@ -21,19 +21,16 @@ let exchange
let info
init()
async function init() {
client.on('error', (err) => console.log('Redis Client Error', err));
await client.connect();
info = await fs.readFileSync('info2.json', 'utf8');
info=JSON.parse(info)
exchange= new ccxt.bybit({
info = JSON.parse(info)
exchange = new ccxt.bybit({
apiKey: info.apiKey,
secret: info.secret,
enableRateLimit: true,
......@@ -50,8 +47,7 @@ async function init() {
async function balanceUpdater() {
try {
let d = await exchange.fetchFreeBalance()
if (d.USDT !==balance)
{
if (d.USDT !== balance) {
balance = d.USDT
appendBalanceProfitLog(balance)
}
......@@ -67,7 +63,8 @@ async function balanceUpdater() {
async function run() {
let files = await fs.readdirSync(path)
for (let i = 0; i < files.length; i++) {
if (!files[i].includes('1&1&1'))
continue
let fl = files[i].split('_')
let pair = 'BTCUSDT'
......@@ -169,7 +166,7 @@ async function make(name) {
}
async function updateVars(name,lastData) {
async function updateVars(name, lastData) {
// lastData = lastFile[lastFile.length - 2]
......@@ -283,8 +280,8 @@ async function closer(sig, date, bigData, id, pair) {
lastToken = lastToken.replace(/_/g, '').replace(/Lp/g, '').replace(/BTC/g, '').replace(/ /g, '')
const [data, delStatus] = await client
.multi()
.get(info.apiKey+'_'+sig)
.del(info.apiKey+'_'+sig)
.get(info.apiKey + '_' + sig)
.del(info.apiKey + '_' + sig)
.exec();
......@@ -344,7 +341,7 @@ async function closer(sig, date, bigData, id, pair) {
}
async function adder(sig, qty, date, allData,pair) {
async function adder(sig, qty, date, allData, pair) {
let lastToken = sig + '_' + date
if (pair === 'BNBUSDT')
qty = 0.06
......@@ -371,13 +368,17 @@ async function adder(sig, qty, date, allData,pair) {
console.log('Add Suc With id', d.id, sig)
const [add] = await client
.multi()
.set(info.apiKey+'_'+sig, JSON.stringify({pair: d.info.symbol, side: d.side, qty: d.amount, price: d.price}))
.set(info.apiKey + '_' + 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