app/traderBot.js
/**
     * This method makes a private API request.
     * @param  {String}   method   The API method (public or private)
     * @param  {Object}   params   Arguments to pass to the api call
     * @param  {Function} callback A callback function to be executed when the request is complete
     * @return {Object}            The request object
     */
This method makes a private API request.
@param  {String}   method   The API method (public or private)
@param  {Object}   params   Arguments to pass to the api call
@param  {Function} callback A callback function to be executed when the request is complete
@return {Object}            The request object
This method makes a private API request . @param { String } method The API method ( public or private ) @param { Object } params Arguments to pass to the api call @param { Function } callback A callback function to be executed when the request is complete @return { Object } The request object
privateMethod(method, params, callback) {
        params = params || {};
        if(typeof params === 'function') {
            callback = params;
            params   = {};
        }
        const path = '/' + this.config.version + '/private/' + method;
        const url  = this.config.url + path;
        if(!params.nonce) {
            params.nonce = new Date() * 1000; 
        }
        if(this.config.otp !== undefined) {
            params.otp = this.config.otp;
        }
        const signature = getMessageSignature(
            path,
            params,
            this.config.secret,
            params.nonce
        );
        const headers = {
            'API-Key'  : this.config.key,
            'API-Sign' : signature,
        };
        const response = rawRequest(url, headers, params, this.config.timeout);
        if(typeof callback === 'function') {
            response
                .then((result) => callback(null, result))
                .catch((error) => callback(error, null));
        }
        return response;
    }
privateMethod ( method , params , callback ) { params = params || { } ; if ( typeof params === 'function' ) { callback = params ; params = { } ; } const path = '/' + this . config . version + '/private/' + method ; const url = this . config . url + path ; if ( ! params . nonce ) { params . nonce = new Date ( ) * 1000 ; } if ( this . config . otp !== undefined ) { params . otp = this . config . otp ; } const signature = getMessageSignature ( path , params , this . config . secret , params . nonce ) ; const headers = { 'API-Key' : this . config . key , 'API-Sign' : signature , } ; const response = rawRequest ( url , headers , params , this . config . timeout ) ; if ( typeof callback === 'function' ) { response . then ( ( result ) => callback ( null , result ) ) . catch ( ( error ) => callback ( error , null ) ) ; } return response ; }
This method makes a private API request.
This method makes a private API request .
// Default params to empty object // spoof microsecond