Giter VIP home page Giter VIP logo

Comments (1)

bergant avatar bergant commented on May 25, 2024

Yes, for now it doesn't cover other disclosures. But, it is possible to get the data from parsed XBRL directly. In the result returned by xbrlDoAll there are tables:

  • element (=XBRL concepts)
  • context (=periods, dimensions)
  • fact (=values)

We have to find concepts related to warrants and join them to context and value:

library(XBRL)
report_url <- "https://www.sec.gov/Archives/edgar/data/320193/000119312514383437/aapl-20140927.xml"

old_o <- options(stringsAsFactors = FALSE)
xbrl_data <- xbrlDoAll(report_url)
options(old_o)

library(dplyr)
library(tidyr)
  
xbrl_data$element %>% 
  filter(grepl("Warrant",elementId) & # all "Warrant" elements
           type == "xbrli:monetaryItemType") %>% 
  inner_join(xbrl_data$fact, by = "elementId") %>% 
  inner_join(xbrl_data$context, by = "contextId") %>% 
  dplyr::mutate(amount = as.numeric(fact)*10^(as.numeric(decimals))) %>% 
  select(elementId, amount, startDate, endDate, periodType) %>% 
  split(.$periodType)

# Result:

# $duration
#                                        elementId amount  startDate    endDate periodType
# 1         StandardProductWarrantyAccrualPayments   3703 2012-09-30 2013-09-28   duration
# 2         StandardProductWarrantyAccrualPayments   3760 2013-09-29 2014-09-27   duration
# 3         StandardProductWarrantyAccrualPayments   1786 2011-09-25 2012-09-29   duration
# 4 StandardProductWarrantyAccrualWarrantiesIssued   5032 2012-09-30 2013-09-28   duration
# 5 StandardProductWarrantyAccrualWarrantiesIssued   4952 2013-09-29 2014-09-27   duration
# 6 StandardProductWarrantyAccrualWarrantiesIssued   2184 2011-09-25 2012-09-29   duration
# 
# $instant
#                         elementId amount startDate    endDate periodType
# 7  StandardProductWarrantyAccrual   1240      <NA> 2011-09-24    instant
# 8  StandardProductWarrantyAccrual   1638      <NA> 2012-09-29    instant
# 9  StandardProductWarrantyAccrual   2967      <NA> 2013-09-28    instant
# 10 StandardProductWarrantyAccrual   4159      <NA> 2014-09-27    instant

from finstr.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.