Cache
XbrlXML.Cache — ModuleInterface to local store of files used for parsing XBRL.
XbrlXML.Cache.HttpCache — TypeHttpCache(cache_dir="./cache/", headers=Dict())Create a cache to store files locally for reuse.
headers are passed to http Downloads.download. Services such as SEC require you to disclose information about your application.
Example
julia> using XbrlXML
julia> cache = HttpCache("/Users/user/cache/")
/Users/user/cache/XbrlXML.Cache.cache_edgar_enclosure — Methodcache_edgar_enclosure(cache::HttpCache, enclosure_url)Cache the zip folder from SEC containing all XBRL related files for a given submissions.
Due to the fact that the zip compression is very effective on xbrl submissions that naturally contain repeating text, it is way more efficient to download the zip folder and extract it. This will most often be the most efficient method for downloading the submission. One way to get the zip enclosure url is through the Structured Disclosure RSS Feeds provided by the SEC: https://www.sec.gov/structureddata/rss-feeds-submitted-filings
XbrlXML.Cache.cachedir — Methodcachedir(cache::HttpCache)::StringReturn the local directory of a cache.
Example
julia> using XbrlXML
julia> cache = HttpCache("/Users/user/cache/");
julia> cachedir(cache)
"/Users/user/cache/"XbrlXML.Cache.cachefile — Methodcachefile(cache::HttpCache, file_url)::StringSave a file located at file_url to a local cache.
XbrlXML.Cache.find_entry_file — Methodfind_entry_file(cache::HttpCache, dirpath::String)::Union{String,Nothing}Find the most likely entry file in provided filing directory.
This function only works for enclosed SEC submissions that where already downloaded. Will return only the most likely file path for the instance document.
XbrlXML.Cache.header! — Methodheader!(cache::HttpCache, header::Pair)::DictAdd a header pair to a cache and return the headers.
Example
julia> using XbrlXML
julia> cache = HttpCache("/Users/user/cache/");
julia> header!(cache, "User-Agent" => "You youremail@domain.com")
Dict{String, String} with 1 entry:
"User-Agent" => "You youremail@domain.com"XbrlXML.Cache.headers! — Methodheaders!(cache::HttpCache, header::Vector{Pair})::DictAdd multiple header pairs to a cache and return the headers.
Example
julia> using XbrlXML
julia> cache = HttpCache("/Users/user/cache/");
julia> newheaders = ["User-Agent" => "You youremail@domain.com", "From" => "You"];
julia> headers!(cache, newheaders)
Dict{String, String} with 2 entries:
"From" => "You"
"User-Agent" => "You youremail@domain.com"XbrlXML.Cache.headers — Methodheaders(cache::HttpCache)::DictReturn the headers of a cache.
Example
julia> using XbrlXML
julia> cache = HttpCache("/Users/user/cache/");
julia> header!(cache, "User-Agent" => "You youremail@domain.com");
julia> headers(cache)
Dict{String, String} with 1 entry:
"User-Agent" => "You youremail@domain.com"XbrlXML.Cache.purgefile — Methodpurgefile(cache::HttpCache, file_url)::BoolRemove a file, based on its URL, from a local cache.
XbrlXML.Cache.urltopath — Methodurltopath(cache::HttpCache, url)::StringConvert a file's url to a local cache file.