# FinancialInstrument 1.4.1

## CRAN Compliance Fixes

* **Console Output:** Added `verbose = FALSE` parameter to `alltick2sec()` at
  the end of its signature. The unconditional `cat()` progress call is now
  suppressible via `verbose = FALSE` (the default) and uses `message()` for
  optional progress reporting, preserving all existing return values.

* **Return-Value Documentation:** Added `@return` tags to all exported functions
  that were previously missing `\value` sections, describing return class,
  structure, and side-effects where applicable.

* **Examples — Temporary Directories:** Replaced `dir.create("tmpdata")` with
  `tempdir()` / `tempfile()` in the `saveInstruments`, `loadInstruments`,
  `CompareInstrumentFiles`, `saveSymbols.common`, `saveSymbols.days`, and
  `getSymbols.FI` examples. Cleanup is handled via `tryCatch(finally = ...)`.

* **Examples — Internal Registry Access:** Removed `FinancialInstrument:::.instrument`
  from all documentation examples and replaced backup/restore patterns with
  exported `saveInstruments()` / `reloadInstruments()` calls.

* **Examples — Unmatched Parenthesis:** Fixed the unmatched parenthesis in the
  `ls_by_currency()` example.

* **Examples — Commented-Out Code:** Removed commented-out executable
  alternatives from examples.

* **`\dontrun{}` vs `\donttest{}`:** Converted examples that can run in a
  standard R session from `\dontrun{}` to either runnable or `\donttest{}`
  blocks; retained `\dontrun{}` only for genuinely unrunnable code (e.g.,
  examples requiring live network access or specific external files).

* **Namespace:** Confirmed `expires()` is exported. Removed examples for
  genuinely unexported helpers.

* **`loadInstruments` compatibility:** Updated the header check in
  `loadInstruments()` to recognise both the legacy `"#auto"` prefix and the
  new `"# Auto"` prefix written by the refactored `saveInstruments()`.

# FinancialInstrument 1.4.0

## New Maintainer

* Justin M. Shea is taking over as the Maintainer from Ross Bennett. The development team would like to thank Ross for his years of stewardship.

## Bug Fixes, CRAN Compliance, and Enhancements

* **S3 Consistency:** Fixed `expires.spread` method registration by correcting the syntax of its roxygen export tag.
* **Rd Cross-References:** Added the explicit `[quantmod]` package anchor target to `setSymbolLookup` in the `instrument.auto` documentation.
* **Roxygen2 Constraints:** Condensed all multi-line `@aliases` and `@importFrom` definitions down to strict single lines across `instrument.R`, `ls_by_currency.R`, `ls_instruments.R`, and `FinancialInstrument-package.R` to stop compilation errors.
* **Package Documentation:** Cleared duplicate package-level documentation blocks and resolved an orphaned `NULL` reference that was causing parser crashes.
* **Encoding:** Added explicit `Encoding: UTF-8` declaration to the package metadata.
* **Migration:** Test suite has been completely migrated from `testthat` to `tinytest` to reduce package dependencies and improve test execution speed.
* **Bug Fixes:** Fixed timezone and frequency alignment issues in the `redenominate` unit tests to ensure robust cross-platform testing. Added new intra-day test.
* **Refactoring:** Moved internal `quantmod` helper functions (`has.Mid`, `convert.time.series`) to `R/utils_quantmod.R` and tagging them with `@noRd`.
* **CI:** Added github actions.
* **README.md:** Added a readme to cover package install and illustrate basic funcationality.

Changes in Version 1.3
======================

USER VISIBLE CHANGES
--------------------

* Ross Bennett is taking over as the Maintainer from Garrett See.
  The development team would like to thank Garrett for his years of
  stewardship.

* getSymbols.FI can now take a vector if identifiers in the "use_identifier"
  argument.

* removed Suggests for archived package 'its'


Changes in Version 1.2
======================

USER VISIBLE CHANGES
--------------------

* Requires quantmod >= 0.4-3 and no longer using the Defaults package
  (which is now archived on CRAN) for importDefaults() in getSymbols.FI.

* getSymbols.FI() allows the user to set default values by checking for
  options().  For example, the default value for from= is now
  getOption("getSymbols.FI.from", "2010-01-01").  So, if you do not set the
  "getSymbols.FI.from" option, the value will be what it always has been
  ("2010-01-01"), but if you did set a value (e.g.
  options(getSymbols.FI.from="2014-01-01")), then that value will be used.

* remove some `:::` calls to unexported functions from quantmod.

* saveInstruments() gains a "compress" argument to allow for different
  compression than the default ("gzip")

* instrument() and most of its wrappers gain an "overwrite" argument. The
  default is TRUE to match previous behavior -- if you try to create an
  instrument that already exists, the old one will be replaced by
  the new definition.  If overwrite=FALSE is used, there will be an error
  if you try to define an instrument that has a primary_id that is already
  in use.  Thanks to Charlie Friedemann for the suggestion and discussions.

* load.instruments() gains an overwrite argument that is passed through to the
  instrument() wrapper functions.  Therefore, load.instruments() no longer
  checks to see if an instrument already exists.  Thanks to Charlie Friedemann
  for the patch.

* load.instruments() gains an "identifier_cols" argument that can be used to
  pass the names of columns that are to be used as identifiers instead of as
  normal instrument attributes.  Thanks to Charlie Friedemann for the patch.

* loadInstruments() can now load unnamed lists of instruments because it now
  uses the primary_ids directly instead of the names of the list/environment

BUG FIXES
---------

* setSymbolLookup.FI was appending the Symbol to the directory, and
  getSymbols.FI was only adding the Symbol to the file path if the end of the
  path was not the same as the Symbol.  That meant that getSymbols.FI could not
  be used to get data for a Symbol that was the same as the base directory.
  getSymbols.FI now always appends the Symbol to the file path and
  setSymbolLookup.FI does not append it to the base_dir. Test added.

* In redenominate, if the object was a defined instrument, the currency in the
  instrument object would be used even if the user passed a different currency
  in the old_base argument.

* sort_ids() only worked in some locales when an instrument is not defined.  It
  now converts the month (returned by parse_id()) to numeric (with MC2N()) and
  uses the "%m" format in the as.Date call instead of using the month name with
  the (locale-specific) "%b" format.  Thanks to Alexis Petit for the patch.

* when instrument() wrappers were called with vectors of symbols and
  assign_i=FALSE, the symbols were being returned instead of the instrument
  objects.  Now, when `assign_i=FALSE` and `length(primary_id) > 1`, a
  named list of instruments will be returned.  Named lists of instruments are
  easy to work with since they can be passed directly to (re)loadInstruments(),
  or coerced to an environment with as.environment()


TESTS
-----

* Now using testthat for package testing


Changes in Version 1.1
======================

NEW FEATURES
------------

* sort.instrument() method to sort the components of an instrument

* CompareInstrumentFiles() allows passing it only 1 argument in which case it
  will compare the currently loaded instrument environment against it.

* If an instrument has a string like "2012-09", "2012/09", or "201209" in the
  "expires" attribute, sort_id() will treat that instrument as expiring on the
  first day of that month (2012-09-01).  Thanks to Jan Humme for reporting.

BUG FIXES
---------

* import xts to prevent xts functions from being masked.

* ls_instruments_by() checks for NA to avoid an error.

* force evaluation of arguments to CompareInstrumentEnvironment()

* option_series.yahoo() checks the results of the call to
  quantmod::getOptionChain() and only uses rows that contain the ticker Symbol
  (sometimes in the off-hours, yahoo includes a bad row)

* update_instruments.morningstar is slightly more robust.  It no longer
  depends on the relevant table being the 4th on the page; instead it uses
  the table with the most rows.

* Replace paste0() calls with paste() so that R 2.15 in not required.

USER VISIBLE CHANGES
--------------------

* If use_identifier is not NA in a call to getSymbols.FI, and the instrument
  cannot be found, there is a more informative error message.

* minor updates to docs: typo fixes, updated seealso sections

SANDBOX
-------

* The download.TrueFX.R script can now be called with Rscript. It accepts a
  trailing argument to specify the number of cores to use.

