I'm trying to recover the value of a function but it doesn't returns anything
This is the function (Request is an async function that makes a get petition):
var getVolumesOKCoin = function(pair){
request('https://www.okcoin.com/api/v1/depth.do?symbol=' + pair, function (error, response, body) {
return body;
});
}
And this is how I recover the value
var retObj = getVolumesOKCoin(pair);
The value of retObj is undefined.
What is the best way to recover the value?
Thanks for your help.