Skip to content

Instantly share code, notes, and snippets.

@wilsonfreitas
Created September 26, 2025 08:40
Show Gist options
  • Select an option

  • Save wilsonfreitas/f1a1e4e2528752f2f4f8d8562c9d9324 to your computer and use it in GitHub Desktop.

Select an option

Save wilsonfreitas/f1a1e4e2528752f2f4f8d8562c9d9324 to your computer and use it in GitHub Desktop.
newsletter #1
df <- as.data.frame(ds)
head(df)
#> # A tibble: 13,038 × 8
#> refdate symbol commodity maturity_code previous_price price price_change
#> <date> <chr> <chr> <chr> <dbl> <dbl> <dbl>
#> 1 2023-01-04 ABEVOF… ABEVO F23 14.3 1.43e1 0.07
#> 2 2023-01-04 ABEVOG… ABEVO G23 14.4 1.45e1 0.08
#> 3 2023-01-04 AFSG23 AFS G23 17056 1.70e4 -101.
#> 4 2023-01-04 AFSH23 AFS H23 17093. 1.70e4 -101.
#> 5 2023-01-04 AFSJ23 AFS J23 17142. 1.70e4 -105.
#> 6 2023-01-04 AFSK23 AFS K23 17182. 1.71e4 -104.
#> 7 2023-01-04 AFSM23 AFS M23 17224. 1.71e4 -108.
#> 8 2023-01-04 ARBG23 ARB G23 28.4 2.89e1 0.43
#> 9 2023-01-04 ARBH23 ARB H23 27.0 2.74e1 0.397
#> 10 2023-01-04 ARBJ23 ARB J23 25.4 2.57e1 0.341
#> # ℹ 13,028 more rows
#> # ℹ 1 more variable: settlement_value <dbl>
#> # ℹ Use `print(n = ...)` to see more rows
fetch_marketdata(
template,
force_download = FALSE,
reprocess = FALSE,
throttle = FALSE,
...
)
fetch_marketdata(
"b3-futures-settlement-prices",
refdate = seq(as.Date("2023-01-01"), as.Date("2023-01-31"), by = "day")
)
#> ── Fetching market data for `b3-futures-settlement-prices` ─────────────────────────────────────────────────────────────────
#> ━━ Downloading data
#> ℹ Downloading 31 files, skipping 0
#> ✔ 31 files downloaded [19.99s]
#> ━━ Processing data layers
#> ℹ Updating input layer
#> Invalid file for args: "refdate = 2023-01-01"
#> Invalid file for args: "refdate = 2023-01-07"
#> Invalid file for args: "refdate = 2023-01-08"
#> Invalid file for args: "refdate = 2023-01-14"
#> Invalid file for args: "refdate = 2023-01-15"
#> Invalid file for args: "refdate = 2023-01-21"
#> Invalid file for args: "refdate = 2023-01-22"
#> Invalid file for args: "refdate = 2023-01-28"
#> Invalid file for args: "refdate = 2023-01-29"
#> ✔ input layer updated - 31 files processed [13.96s]
#> ℹ input layer changed
#> ℹ Creating staging layer
#> ✔ staging layer created [0.29s]
ds <- futures_get()
ds
#> FileSystemDataset with 1 Parquet file
#> 8 columns
#> refdate: date32[day]
#> symbol: string
#> commodity: string
#> maturity_code: string
#> previous_price: double
#> price: double
#> price_change: double
#> settlement_value: double
template_retrieve("b3-futures-settlement-prices")
#> Template: b3-futures-settlement-prices
#> Description: Preços de Ajustes Diários de Contratos Futuros
#> Required arguments:
#> * refdate: Data de referência
#> Fields:
#> * commodity (character): Nome e código da mercadoria
#> * maturity_code (character): Código de vencimento do contrato futuro com 3 caractéres
#> * previous_price (number): Preço de ajuste do dia anterior
#> * price (number): Preço de ajuste atual
#> * price_change (number): Variação do preço de ajuste
#> * settlement_value (number): Valor do ajuste por contrato (R$)
#> * refdate (date): Data de referência
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment