-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
If a Simulation's input config list has from or to entries of class Date, these entries will be written out as numeric by writeFeather.
For example, the from entry in the config below is converted to Date before creating the Simulation object:
library(strand)
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
data(sample_secref)
data(sample_pricing)
data(sample_inputs)
# Load sample configuration
config <- example_strategy_config()
# Pass in a Date object in the config list structure
config$from <- as.Date(config$from)
# Create the Simulation object and run
sim <- Simulation$new(config,
raw_input_data = sample_inputs,
raw_pricing_data = sample_pricing,
security_reference_data = sample_secref)
# Save the sim and look at the top 2 lines of the config file:
tmp <- tempdir()
sim$writeFeather(tmp)
paste0(tmp, "/config.yaml") %>% readLines(2) %>% writeLines()
#> from: 17898.0
#> to: '2019-01-15'Created on 2020-08-21 by the reprex package (v0.3.0)
Metadata
Metadata
Assignees
Labels
No labels