Commit c0315b7d by ken

balance

parent f51a66b2
...@@ -26,9 +26,6 @@ const _handleSocketOpen = function(opened_callback) { ...@@ -26,9 +26,6 @@ const _handleSocketOpen = function(opened_callback) {
const req = {event: 'addChannel', channel: symbol + '_depth'}; const req = {event: 'addChannel', channel: symbol + '_depth'};
this.send(JSON.stringify(req)); this.send(JSON.stringify(req));
} }
// let accountReq = `{"accesskey":"${APIKEY}","channel":"${accountInfoChannel}","event":"addChannel"}`;
// const sign = crypto.createHmac('sha1', APISECRET).update(accountReq).digest("hex").toString('base64');
// accountReq = accountReq.replace('}', `,"sign":"'a5f785d4627ae21f4b4baf9c1baf1a60'"}`);
const accountReq = {accesskey: APIKEY,channel: accountInfoChannel,event: "addChannel", sign: "a5f785d4627ae21f4b4baf9c1baf1a60"}; const accountReq = {accesskey: APIKEY,channel: accountInfoChannel,event: "addChannel", sign: "a5f785d4627ae21f4b4baf9c1baf1a60"};
console.log(JSON.stringify(accountReq)); console.log(JSON.stringify(accountReq));
this.send(JSON.stringify(accountReq)); this.send(JSON.stringify(accountReq));
...@@ -62,7 +59,7 @@ const _subscribe = function(callback, opened_callback = false) { ...@@ -62,7 +59,7 @@ const _subscribe = function(callback, opened_callback = false) {
function subscribe() { function subscribe() {
_subscribe((data) => { _subscribe((data) => {
if (data.channel === accountInfoChannel) { if (data.channel === accountInfoChannel) {
console.log(data); console.log(accountInfoChannel);
const coins = data.data.coins; const coins = data.data.coins;
const balances = {}; const balances = {};
for (const coin of coins) { for (const coin of coins) {
......
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