Skip to content

fImport: yahooKeystats error

2 messages · Andy Zhu, Yohan Chalabi

#
AZ> How to catch error in this function? My following code seems
   AZ> not working with this fImport:
   AZ> library(fImport);
   AZ> ticker = 'ABI';
   AZ> if (inherits(try({ks=yahooKeystats(ticker)}, silent = F),
   AZ> try-error)) {
   AZ> print('no data');
   AZ> }

Hi Andy,

I would set the argument 'try' to FALSE  in 'yahooKeystats'.
This gives with your code  :

library(fImport);
ticker = 'ABI';
if (inherits(try({ks=yahooKeystats(ticker, try=FALSE)}, silent = F), "try-error")) {
print('no data');
}

But it would be better to cast the error you mentioned inside 
'yahooKeystats'. I will have a look at it when I have some spare time.

regards,
Yohan