MyNixOS website logo
Description

Manipulate Dates for Finance.

Functions to manipulate dates and count days for quantitative finance analysis. The 'quantdates' package considers leap, holidays and business days for relevant calendars in a financial context to simplify quantitative finance calculations, consistent with International Swaps and Derivatives Association (ISDA) (2006) <https://www.isda.org/book/2006-isda-definitions/> regulations.

quantdates

Functions to manipulate dates and count days for quantitative finance analysis. The 'quantdates' package considers leap, holidays and business days for relevant calendars in a financial context to simplify quantitative finance calculations, consistent with International Swaps and Derivatives Association (ISDA) regulations.

Features

  • Get Business Days for London (UK), New York (US) (Stock Exchange and Government Bonds) and Bogota (CO).
  • Get Holidays Days for London (UK), New York (US) (Stock Exchange and Government Bonds) and Bogota (CO).
  • Manipulate dates
    • Add days considering business and holidays for the London, New York or Bogota calendars.
    • Number of days between two dates considering leap years.
    • Get last day of month.
    • Transform numeric dates from R or Excel into dates.
  • Day counting in financial context:
    • 30/360.
    • ACT/365.
    • ACT/360.
    • ACT/365L.
    • NL/365.
    • ACT/ACT-ISDA.
    • ACT/ACT-AFB.

Installation

To install the latest development builds directly from GitHub, run this instead:

if (!require("devtools"))
  install.packages("devtools")
devtools::install_github("quantilma/quantdates")

Examples


# AddDate allows Date input as character object
AddDate(date = '2019-10-04',addDays=14,addMonths=2,addYears=3)

# Add business days for Bogota (CO)
AddBusinessDays(date = Sys.Date(),numDate = 15,loc = 'BOG')

# Return last day of the month for the date
LastDayOfMonth(date = '2020-02-03')

# Returns business days within given range for the location and Dates as character
BusinessDays(loc='BOG', from='2020-10-10', to='2020-11-10')

# Transform numeric dates from Excel
NumExcel2DateR(as.numeric(Sys.Date()))

# Transform numeric dates from R
NumR2DateR(as.numeric(Sys.Date()))

# Number of days between two dates considering leap days.
difftime_leap_year(tfinal='2023-03-05',tinitial='2019-02-28',leapDatesIn=TRUE)

# Number of days between two dates skipping leap days.
difftime_leap_year(tfinal='2023-03-05',tinitial='2019-02-28',leapDatesIn=FALSE)

# Number of business days between two dates in Bogota (CO). 
difftime_business(tfinal='2023-03-08',tinitial='2019-02-28',wd=wdBOG)

# Financial day count between two dates according to ACT/365 convention
day_count(tfinal='2023-03-08',tinitial='2019-02-28',convention='ACT/365')

Guidelines for contributing

Currently we are developing the guidelines for contributions.

License

The quantdates package as a whole is licensed under the GPLv3.

Metadata

Version

2.0.4

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows