Coder Social home page Coder Social logo

val-date-calc's Introduction

val-date-calc

A Clojure library designed to calculate value dates, given a trade date or a specific instant.

Usage

Still under development.

Basic usage from clojure is:

(ns val-date-calc.spot-test
  (:require [clojure.test :refer :all]
            [clj-time.core :as dt]
            [val-date-calc.main :refer :all]))

(val-date "SP" (dt/date-time 2000 4 18 12) "CAD" "USD" ccys)

Where ccys is a clojure data structure possible defined like this:

(def ccys
  {"AED" (->Ccy "AED" 2 #{5}   #{} #{"USD"} #{} [17 17] "US/Eastern")
   "AUD" (->Ccy "AUD" 2 #{6 7} #{} #{"USD"} #{} [17 17] "US/Eastern")
   "CAD" (->Ccy "CAD" 1 #{6 7} #{(dt/local-date 2000  4 24)} #{"USD"} #{} [17 17] "US/Eastern")
   "GBP" (->Ccy "GBP" 2 #{6 7} #{(dt/local-date 2000  4 24) 
                                 (dt/local-date 2000  5 31)} #{"USD"} #{} [17 17] "US/Eastern")
   "JPY" (->Ccy "JPY" 2 #{6 7} #{(dt/local-date 2000  5 10) 
                                 (dt/local-date 2000  5 18) 
                                 (dt/local-date 2000  5 24)
                                 (dt/local-date 2000  5 25) 
                                 (dt/local-date 2000  6  1)} #{"USD"} #{} [17 17] "US/Eastern")
   "MXN" (->Ccy "MXN" 1 #{6 7} #{(dt/local-date 2000  5  8)
                                 (dt/local-date 2000  5 15)} #{"USD"} #{"USD"} [17 17] "US/Eastern")
   "NZD" (->Ccy "NZD" 2 #{6 7} #{(dt/local-date 2000  4 19)} #{"USD"} #{} [15 17] "US/Eastern")
   "RUB" (->Ccy "RUB" 2 #{6 7} #{} #{"USD"} #{} [17 17] "US/Eastern")
   "SAR" (->Ccy "SAR" 2 #{5}   #{} #{"USD"} #{} [17 17] "US/Eastern")
   "USD" (->Ccy "USD" 1 #{6 7} #{(dt/local-date 2000  5  3) 
                                 (dt/local-date 2000  5 17)} #{} #{} [17 17] "US/Eastern")})

License

Copyright © 2013 Thomas Ayerst

Distributed under the Eclipse Public License version 1.0.

val-date-calc's People

Contributors

bigtom avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.