ropensci / yfR

Repository for R package yf
https://docs.ropensci.org/yfR
Other
43 stars 7 forks source link

Ignoring errors and saving ticker on the side #28

Closed cemal95 closed 1 week ago

cemal95 commented 1 week ago

Coming back to the automization process, how can catch these errors and save them to a separate list of the ones that did not work. It has to do with the name of the ticker, but I cant filter 2000+ tickers so I would like to catch errors and save in a list called error_list.

Error in yf_get(tickers = tick, first_date = "1920-01-01", last_date = "2024-11-13", : Resulting data has 0 rows.. Are your tickers and date ranges correct? Search your ticker at <https://finance.yahoo.com/

cemal95 commented 1 week ago

https://stackoverflow.com/a/59462794/11819467

msperlin commented 1 week ago

The package already does that. In the output objec, there is an attribute called df_control:

image

There you'll find a dataframe with details of the importation process.

cemal95 commented 1 week ago

I see, bit I think the question is already answered using the threshold arguement. On a side note, can you convert the OHLC data into quarterly data using monthly data?

msperlin commented 6 days ago

I see, bit I think the question is already answered using the threshold arguement. On a side note, can you convert the OHLC data into quarterly data using monthly data?

Sure, but it sounds too specific to implement in the package. Nonetheless, you can always write a custom function and, based on daily/monthly data, aggregate for quarters.