View source: R/scraper-futures.R
code2month | R Documentation |
This function takes a character string representing the maturity code of a futures contract and returns the corresponding month as an integer. It supports both the new and old maturity code formats used in futures contracts.
code2month(x)
x |
A character vector with the maturity code(s) of futures contracts. The codes can be either a single letter (e.g., "F", "G", "H", ...) representing the new code format or a three-letter abbreviation (e.g., "JAN", "FEV", "MAR", ...) representing the old code format. |
The function distinguishes between two maturity code formats:
The new code format uses a single letter (e.g., "F" = January, "G" = February, etc.).
The old code format uses a three-letter abbreviation (e.g., "JAN" = January, "FEV" = February, etc.).
A vector of integers corresponding to the months of the year, where 1 = January, 2 = February, ..., 12 = December.
code2month(c("F", "G", "H", "J", "K", "M", "N", "Q", "U", "V", "X", "Z"))
code2month(c("JAN", "FEV", "MAR", "NOV", "DEZ"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.