Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in data.table::rbindlist #35

Closed
MislavSag opened this issue Sep 16, 2021 · 2 comments
Closed

Error in data.table::rbindlist #35

MislavSag opened this issue Sep 16, 2021 · 2 comments

Comments

@MislavSag
Copy link

I am trying to retrieve all statements for set of tickers:

    tickers <- c("A", "AA", "AAL", "AAN", "AAOI", "AAON", "AAP", "AAPL", "AAT", 
                 "AAWW", "ABBV", "ABC", "ABCB", "ABEO", "ABG", "ABM", "ABMD", 
                 "ABNB", "ABR", "ABT", "ABTX", "ABUS", "ACA", "ACAD", "ACC", "ACCO", 
                 "ACER", "ACET", "ACGL", "ACHC", "ACI", "ACIW", "ACLS", "ACM", 
                 "ACN", "ACRX", "ACU", "ACY", "ADBE", "ADC", "ADES", "ADI", "ADM", 
                 "ADMA", "ADNT", "ADOM", "ADP", "ADPT", "ADS", "ADSK", "ADT", 
                 "ADTN", "ADUS", "ADVM", "ADXS", "AEE", "AEHR", "AEIS", "AEO", 
                 "AEP", "AES", "AFG", "AFI", "AFL", "AGCO", "AGI", "AGIO", "AGLE", 
                 "AGNC", "AGO", "AGR", "AGS", "AGX", "AGYS", "AHH", "AIG", "AIMC", 
                 "AINC", "AIR", "AIRC", "AIRI", "AIT", "AIV", "AIZ", "AJG", "AJRD", 
                 "AJX", "AKAM", "AKR", "AL", "ALB", "ALCO", "ALE", "ALEX", "ALG", 
                 "ALGN", "ALGT", "ALK", "ALKS", "ALL")
    ratios <- sfa_get_statement(ticker = tickers, 
                                statement = "all", 
                                period = "quarters", 
                                start = Sys.Date() - 5000,
                                end = Sys.Date(),
                                ttm = TRUE,
                                shares = TRUE)

but I am getting an error

Error in data.table::rbindlist(DT_list, use.names = TRUE) : 
  Item 13 has 220 columns, inconsistent with item 1 which has 227 columns. To fill missing columns use fill=TRUE.
@matthiasgomolka
Copy link
Owner

Confirmed. I need to investigate.

matthiasgomolka added a commit that referenced this issue Oct 12, 2021
matthiasgomolka added a commit that referenced this issue Oct 12, 2021
@matthiasgomolka
Copy link
Owner

Fixed in the dev version. Thanks for reporting.

The underlying problem was the fact that the SimFin API does not always return all columns (I guess if they are all empty). This lead to the problem in rbindlist() which tried to bind data.tables with different number of columns. Added fill = TRUE to solve this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants