wilsonfreitas / brasa

Extract Brazilian financial data from a wide range of Internet sources: B3, ANBIMA, CVM
MIT License
17 stars 2 forks source link

multi download - download multiple files for a single template #12

Open wilsonfreitas opened 7 months ago

wilsonfreitas commented 7 months ago

Tesouro Direto files can be downloaded from the same URL but the arguments vary. The easy solution is to create different template files, one for each varied argument. The following questions must be answered:

Proposed structure to downloaded files.

raw/<template>/<varied-argument>/checksum/file

another proposal

raw/<template>-<varied-argument>/checksum/file

Template example:

id: td-historical-prices
filename: ~
filetype: CUSTOM
description: Tesouro Direto preços e taxas históricas
downloader:
  verifyssl: false
  function: brasa.downloaders.multi_download
  url: https://cdn.tesouro.gov.br/sistemas-internos/apex/producao/sistemas/sistd/{year}/{contract}_{year}.xls
  format: xls
  use-filename: true
  args:
    year: ~
    contract: ~
  multi:
    contract:
      lft: LFT
      ltn: LTN
      ntnb: NTN-B
      ntnb_principal: NTN-B_Principal
      ntnf: NTN-F
      ntnc: NTN-C
wilsonfreitas commented 7 months ago

Other downloads also can be used in this approach.