Skip to content

Instantly share code, notes, and snippets.

@Anderson-Juhasc
Last active August 30, 2015 19:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Anderson-Juhasc/7c2fb341112de82cdb34 to your computer and use it in GitHub Desktop.
Save Anderson-Juhasc/7c2fb341112de82cdb34 to your computer and use it in GitHub Desktop.
Bot.prototype.userInfo = function() {
var that = this
, deferred = Q.defer()
, channel = this.coin === 'usd' ? 'ok_spotusd_userinfo' : 'ok_spotcny_userinfo';
that.send(channel);
that.ws.on('message', function(data) {
var messages = JSON.parse(data.data)
, channel = messages[0].channel;
if (channel === 'ok_spotusd_userinfo' || channel === 'ok_spotcny_userinfo') {
that.wallet = data;
deferred.resolve();
}
});
return deferred.promise;
}
@samuelhei
Copy link

that.ws.on('message', function(data) {
var messages = JSON.parse(data.data)
, channel = messages[0].channel;

    if (channel === 'ok_spotusd_userinfo' || channel === 'ok_spotcny_userinfo') {
        Bot.updateWallet(data);
    }

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment