There is a small issue with the add_adj_price() function. Currently it request dividends history for specified company based on the specified period window (start and end dates) which is what you would expect. The issue is that the server uses these dates to filter data returned using the announcement dates of the dividends and not the distribution dates which can lead to filtering out necessary data. below is an example
let's say company A has announced their dividends distribution on 9th of April and the actual distribution happened on the 30th of same month. if you use get_company_records() function with period from 10th of April till 10th of May, the add_adj_price() function will not capture the distributed dividends that was announced on the 9th despite the fact that the actual distribution happened within the period. Subsequently, the resulting adjusted prices will be inaccurate.
As you can see, this is a server-side limitation but I would rather to work around this limitation. Feel free to take a shot at it and would like to know your thoughts as well.
I am facing data extraction error.
Can you please check the issue here.
Performance of Saudi Aramco company stock
comp_df <- get_company_records("2022-07-01","2022-12-17",company_symbol = 2222, use_cache = FALSE)
Error in rjson::fromJSON(file = parseURL(0, startDate, endDate, type = type, :
not all data was parsed (0 chars were parsed out of a total of 708542 chars)
traceback()
4: stop(sprintf("not all data was parsed (%d chars were parsed out of a total of %d chars)",
size, nchar(json_str, type = "bytes")))
3: rjson::fromJSON(file = parseURL(0, startDate, endDate, type = type,
comSymbol = company_symbol, adjustment = adjustPeriod))
2: request_data(startDate = start_date, endDate = end_date, type = "company",
company_symbol = company_symbol, adjustPeriod = FALSE)
1: get_company_records("2022-07-01", "2022-12-17", company_symbol = 2222,
use_cache = FALSE)
The current fin_parsURL() function is not parsing correct links to the financial statements page of the specified company. Right now, It returns financial statement for one specific company regardless of specified company symbol. I have not yet decided on the best way to fix it. All links look unique for each listed company which makes parameterization an issue.
There are two workaround I can think of to resolve this issue.
Store all unique links in a list and parse links in lookup manner.
Disadvantage: to include new companies package need to be updated and re-installed.
Initiate web drive at request time to navigate the website to the financial statements table.
Disadvantage: requests will be extremely slow, I expect 10-30s per request.