davisvaughan / calendarrr Goto Github PK
View Code? Open in Web Editor NEWAn R frontend to the QuantLib Calendar API
An R frontend to the QuantLib Calendar API
Could be useful
nextWeekday(Sys.Date(), "friday")
Should be more like:
src/myfiles.cpp
src/ql/include/allheaders-mimicking-qlcppfilestructure.hpp
src/ql/cppfilestructure.cpp
<- with folders here too
It would require the Makevars to point to:
-I ./ql/include ../../inst/include <- my headers
Also would maybe need the OBJECT thing to point to everything in src/ql/*.cpp?
otherwise it builds fine with this included
Also cal_end_of_month()
should do this
size()
nextDate()
previousDate()
date generation based on calendars
kind of like seq()
Hey Davis,
Wanted to mess around with this but having issues installing with R 3.4.4 on a 64-bit linux system. Looks like it's missing a source/ql/mathconstants.hpp
?
> devtools::install_github("DavisVaughan/calendarrr")
Downloading GitHub repo DavisVaughan/calendarrr@master
from URL https://api.github.com/repos/DavisVaughan/calendarrr/zipball/master
Installing calendarrr
'/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL \
'/tmp/RtmpvrbyJD/devtools531f15c54bbc/DavisVaughan-calendarrr-dd7bfba' --library='/home/claytonjy/R/x86_64-pc-linux-gnu-library/3.4' \
--install-tests
* installing *source* package ‘calendarrr’ ...
** libs
g++ -I/usr/share/R/include -DNDEBUG -I . -I ../inst/include -I"/home/claytonjy/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I"/home/claytonjy/R/x86_64-pc-linux-gnu-library/3.4/BH/include" -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c cal_identifiers.cpp -o cal_identifiers.o
In file included from ./ql/errors.hpp:28:0,
from ./ql/time/calendar.hpp:29,
from cal_identifiers.cpp:1:
./ql/qldefines.hpp:126:32: fatal error: ql/mathconstants.hpp: No such file or directory
compilation terminated.
/usr/lib/R/etc/Makeconf:168: recipe for target 'cal_identifiers.o' failed
make: *** [cal_identifiers.o] Error 1
ERROR: compilation failed for package ‘calendarrr’
* removing ‘/home/claytonjy/R/x86_64-pc-linux-gnu-library/3.4/calendarrr’
Installation failed: Command failed (1)
Created on 2018-08-23 by the reprex package (v0.2.0).
(not really; messages didn't show up in reprex so I did that interactively)
devtools::session_info()
#> Session info -------------------------------------------------------------
#> setting value
#> version R version 3.4.4 (2018-03-15)
#> system x86_64, linux-gnu
#> ui X11
#> language (EN)
#> collate en_US.UTF-8
#> tz America/Detroit
#> date 2018-08-23
#> Packages -----------------------------------------------------------------
#> package * version date source
#> backports 1.1.2 2017-12-13 CRAN (R 3.4.4)
#> base * 3.4.4 2018-03-16 local
#> compiler 3.4.4 2018-03-16 local
#> curl 3.2 2018-03-28 CRAN (R 3.4.4)
#> datasets * 3.4.4 2018-03-16 local
#> devtools 1.13.6 2018-06-27 CRAN (R 3.4.4)
#> digest 0.6.15 2018-01-28 CRAN (R 3.4.4)
#> evaluate 0.11 2018-07-17 CRAN (R 3.4.4)
#> git2r 0.23.0 2018-07-17 CRAN (R 3.4.4)
#> graphics * 3.4.4 2018-03-16 local
#> grDevices * 3.4.4 2018-03-16 local
#> htmltools 0.3.6 2017-04-28 CRAN (R 3.4.4)
#> httr 1.3.1 2017-08-20 CRAN (R 3.4.4)
#> knitr 1.20 2018-02-20 CRAN (R 3.4.4)
#> magrittr 1.5 2014-11-22 CRAN (R 3.4.4)
#> memoise 1.1.0 2017-04-21 CRAN (R 3.4.4)
#> methods * 3.4.4 2018-03-16 local
#> R6 2.2.2 2017-06-17 CRAN (R 3.4.4)
#> Rcpp 0.12.18 2018-07-23 CRAN (R 3.4.4)
#> rmarkdown 1.10 2018-06-11 CRAN (R 3.4.4)
#> rprojroot 1.3-2 2018-01-03 CRAN (R 3.4.4)
#> stats * 3.4.4 2018-03-16 local
#> stringi 1.2.4 2018-07-20 CRAN (R 3.4.4)
#> stringr 1.3.1 2018-05-10 CRAN (R 3.4.4)
#> tools 3.4.4 2018-03-16 local
#> utils * 3.4.4 2018-03-16 local
#> withr 2.1.2 2018-03-15 CRAN (R 3.4.4)
#> yaml 2.2.0 2018-07-25 CRAN (R 3.4.4)
Would mean we could create Date(year,month,day,hour,min,sec,millisec,microsec)
Then we could also advance() by TimeUnit of seconds and milliseconds.
Holidays are still Date(year,mon,day) though.
Overall goal is to remove the external pointer from the R6 object. This would allow a number of benefits including:
Pros:
Cons:
Impl:
cal_create() should return S3
cal_create_cpp() should take that S3 list and actually create the cal but only when called by another function like cal_adjust()
S3 should be a list
calendar = list(cal = "TARGET", extra_holidays = NULL)
Same print method as now
To make it easy to know what is already included in calendar holidays
Something like:
UnitedStates
tibble::tibble(holiday = "New Years", timing = "First day of January")
cal_add_holidays()
cal_remove_holidays()
cal_is_weekend()
cal_is_holiday()
cal_create()
cal_end_of_month()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.