Answer the question
In order to leave comments, you need to log in
How to isolate a bid ask from the exchange using the API?
Hello. Please tell me what is the error in writing the script. Thanks in advance!
function stok(asset,option){
if (option == undefined){
var option = 'last';
}
else {
option = option.toLowerCase().trim();
}
var asset = asset;
var data = loadJSON(' https://stocks.exchange/api2/ticker ');
for (var i=0; i < data.length; i++){
var symbol = data['market_name'];
symbol = symbol.toLowerCase().trim();
if (asset == symbol){
var value = data[option];
return value;
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question