Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.


untitled notebook

node v17.9.0
version: 1.0.0
const Kucoin = require('kucoin-sdk') var sum=0 const feh=[] const pr=[] const KucoinInstance = new Kucoin({ KEY: '6187bc948c4a050001722975', SECRET: 'a48bab87-b50d-4097-8b8b-1a0fc18cc4fa', PASSPHRASE: 'KhTn2268' }) finalsum=await final() async function final() { const List =await KucoinInstance.listAccounts() const list=await List for (let index = 0; index < 11; index++) { feh[index] = list.data[index].balance; sym=list.data[index].currency+'-USDT' if (sym=='USDT-USDT'){ pr[index]=1 sum=(feh[index])*1+sum; } if (sym!='USDT-USDT'){ resp=await prices(sym) pr[index]=resp.data.price sum=feh[index]*resp.data.price+sum; console.log(sum) //console.log(list.data[index].balance+":"+feh[index]*resp.data.price); } } console.table("SUM"+JSON.stringify(sum)) console.table(pr) console.table(feh) return sum; } async function prices(sym) { const response = await KucoinInstance.getTicker({symbol:sym}) const users = await response; // console.log(users) return users; } console.log("finalsum:"+JSON.stringify(finalsum)) exports.endpoint = function(request, response) { response.end(JSON.stringify(finalsum)) }

no comments

    sign in to comment