days360 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzMxNTc5ZThiYTliZGYyMjE2NDg3ZjQyYTg4Y2UyNDRhMjBiOTYzZA==
4
+ Njc4ZWE2ODNjNjQwZjRjMmRkZWE0MzBlZDZlZTZiNDNjYzcyMTg5Yw==
5
5
  data.tar.gz: !binary |-
6
- YzM2Y2RmZWJiNWNlZGU2OGIzMDY2MGRjNGY1ODQzZmU5OTNjYzZlMQ==
6
+ YTgxN2Q4YTk5M2Y4MTNlZDQ2MjYxNTE1M2U0NzRjYjkzMGQ1NGU2Mg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YWJlZjVjYmY2Y2UxMDFhMjI2OGY0MDc5ZmZiMmU0OGE1MDM5NmE2MDQ1Mjdh
10
- Mjk1ZTk5MjEwNDU3N2FkZWY3MTQ0ZjhmYWJiYmE5NjQ5Mzk3MjUyYWNkZTIz
11
- NzljNGFiZmUzMDNjNDM2YjM1YTM3NDU0MjFjMWUzZmM3ZjgzZjA=
9
+ ODAwNmRmMDhjMDAyMmVkM2QwYzBmZWZmOWRlOWIwZmU3ODE1M2U2NDg5OGE2
10
+ YTgxNzhhMDE5YWE4YmRjZTRmYzFkNGIwNzAxNzYxNWU0ZjU5YjYzNmE1ZTQz
11
+ YjhmZTFkYjZhZDc1ZWY5MGY0MDlmZjFiNTJjMGFmMWU3ZTg0OTE=
12
12
  data.tar.gz: !binary |-
13
- NTYzMTJkYTg5ZTdhYzBlZWMzNDMyNWVmZjYxNDI5NDZkOTY4OWJhZTI3ZDJl
14
- ZmQ1YTUxNmU1ZTJiYTE1NjVmMTQyOWYzZGM1NGQyMzIxZDhhMGFkZTYxM2Zk
15
- MjUxZTc5ZTU0MjUyODZmMmI5NWFiYjgwNWZlMDQ2ZDEwY2E0ZjU=
13
+ NGM5ZWUyY2YxN2JiYmVlYTJhZThjMGVkNGI0YjMyMzVhNjM5MjRmZGU1Y2U1
14
+ ZTk5MjM2NDQ3ZTExM2YwZWUyNDAyZmUxZDY0MDcwZjM1YzgyODg1YzAyNDU4
15
+ MjEzMTdmMDRjNjdkZjQyOTdiNzM0ZDgzM2NhY2M0MGRhOTZjNDE=
@@ -2,4 +2,6 @@ language: ruby
2
2
  rvm:
3
3
  - "1.8.7"
4
4
  - "1.9.3"
5
- - "2.0.0"
5
+ - "2.0.0"
6
+ - "jruby-18mode"
7
+ - "jruby-19mode"
data/README.md CHANGED
@@ -1,21 +1,22 @@
1
1
  # Days360
2
2
 
3
- Calculates the difference between two dates based on the 360 day year used in interest calculations
3
+ Calculates the difference between two dates based on the 360 day year used in interest calculations.
4
4
 
5
- [![Build Status](https://travis-ci.org/tamaloa/days360.png?branch=master)](https://travis-ci.org/tamaloa/days360)
5
+ This gems aims to provide full compatibility to calculations based on Excel or Calc. The testsuite thus uses over a thousand date combinations especially picked to highlight problems in the days360 calculation. The reference values were calculated with different office suites using their provided methods (more information in test/data).
6
+ Additional calculation methods are also provided. See the Notes section to learn more about the different calculation methods and their history.
6
7
 
7
- ## Notes on DAY360 calculations
8
+ The following table gives an overview on which functions are supported and what their equivalents in Excel or Calc are.
8
9
 
9
- Discussion of bug in Calc compared to Excel (including several spreadsheet attachments).
10
- https://issues.apache.org/ooo/show_bug.cgi?id=84934
11
- Documentation explaining how calc/excel differ from NASD method
12
- http://wiki.openoffice.org/wiki/Documentation/How_Tos/Calc:_Date_%26_Time_functions#Financial_date_systems
13
10
 
14
- Page explaining different calculation methods and laws (in german)
15
- http://zinsmethoden.de/
11
+ | Method | days360 gem | Excel | Calc |
12
+ |----------------------------------------------|-----------------------------------|----------------------------|----------------------------|
13
+ | US/NASD Method (30US/360) (Excel compatible) | days360(date_a, date_b) | DAYS360(date_a, date_b) | DAYS360(date_a, date_b) |
14
+ | US/NASD Method (30US/360) | days360(date_a, date_b, :US_NASD) | not available | not available |
15
+ | European method (30E/360) | days360(date_a, date_b, :EU) | DAYS360(date_a, date_b, 1) | DAYS360(date_a, date_b, 1) |
16
+
17
+
18
+ [![Build Status](https://travis-ci.org/tamaloa/days360.png?branch=master)](https://travis-ci.org/tamaloa/days360) tested on all major ruby versions.
16
19
 
17
- ISDA Page containing several documents related to interest calculation (including one document showing different 30/360 30E/360 variants)
18
- http://www.isda.org/c_and_a/trading_practice.html
19
20
 
20
21
  ## Installation
21
22
 
@@ -32,6 +33,7 @@ Or install it yourself as:
32
33
  $ gem install days360
33
34
 
34
35
  ## Usage
36
+ ```ruby
35
37
 
36
38
  class MyFinancialCalculation
37
39
  include Days360
@@ -46,8 +48,32 @@ Or install it yourself as:
46
48
  interest
47
49
  end
48
50
 
51
+ ```
52
+
53
+ ## Notes on DAY360 calculations
54
+
55
+ Nowadays it seems senseless to calculate interest based on some fictional year instead of simply using the number of days between two dates. The reason (i believe) for different calculation methods to still be in use are:
56
+
57
+ * history - Before we had computers it was hard calculating interest to the real number of days :)
58
+ * legacy data/calculations - Changing the calculation would make "older" calculations look wrong. Thats also the reason why Excel and Calc actually stick to a buggy version of DAYS360
59
+ * Comparison - Comparing interest from different years and months is easier using days360 as all months have the same length. Thus the interest for the same amount of mony does not differ from month to month or in between years (remember leap years!)
60
+
61
+ Discussion of bug in Calc compared to Excel (including several spreadsheet attachments).
62
+ https://issues.apache.org/ooo/show_bug.cgi?id=84934
63
+
64
+ Documentation explaining how calc/excel differ from NASD method
65
+ http://wiki.openoffice.org/wiki/Documentation/How_Tos/Calc:_Date_%26_Time_functions#Financial_date_systems
66
+
67
+ Page explaining different calculation methods and laws (in german)
68
+ http://zinsmethoden.de/
69
+
70
+ ISDA Page containing several documents related to interest calculation (including one document showing different 30/360 30E/360 variants)
71
+ http://www.isda.org/c_and_a/trading_practice.html
72
+
49
73
  ## Contributing
50
74
 
75
+ There are a huge amount of different calculation methods out there (see ISDA page for a beginning). If you need a different one you are invited to add it. Please make sure you have some kind of documentation and ideally a test vector (see test/data) with reference results.
76
+
51
77
  1. Fork it
52
78
  2. Create your feature branch (`git checkout -b my-new-feature`)
53
79
  3. Commit your changes (`git commit -am 'Add some feature'`)
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Days360::VERSION
9
9
  spec.authors = ["Michael Prilop"]
10
10
  spec.email = ["Michael.Prilop@gmail.com"]
11
- spec.description = %q{Calculates the difference between two dates based on the 360 day year used in interest calculations}
12
- spec.summary = %q{Calculates the difference between two dates based on the 360 day year used in interest calculations. Several methods for calculation are available.}
11
+ spec.summary = %q{number of days between two dates based on the 360 day year}
12
+ spec.description = %q{Calculates the difference in days between two dates. The calculation is based on the 360 day year used in interest calculations. Different methods are provided. The default method aims to be fully compatible to Excel/Calc based calculations.}
13
13
  spec.homepage = "https://github.com/tamaloa/days360"
14
14
  spec.license = "MIT"
15
15
 
@@ -1,3 +1,3 @@
1
1
  module Days360
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -5,6 +5,7 @@ parameter and thus uses either the US method or the EU method.
5
5
 
6
6
  calc_DAYS360*.csv sheets were generated using LibreOffice Calc 3.5.7.2
7
7
  excel_DAYS360*.csv sheets were generated using Microsoft Office Excel 2010 (version 14.0)
8
+ NASD_reference_DAYS360_US.csv was generated using an macro provided in the spreadsheet linked in below Open Office issue (and cross validated for single values from other sources)
8
9
 
9
10
  The test data is an 36x36 test vector of dates which is taken from
10
11
  https://issues.apache.org/ooo/show_bug.cgi?id=84934 (credits to terrye) but was freshly generate with more up to date
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: days360
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Prilop
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-05 00:00:00.000000000 Z
11
+ date: 2013-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,8 +52,9 @@ dependencies:
52
52
  - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- description: Calculates the difference between two dates based on the 360 day year
56
- used in interest calculations
55
+ description: Calculates the difference in days between two dates. The calculation
56
+ is based on the 360 day year used in interest calculations. Different methods are
57
+ provided. The default method aims to be fully compatible to Excel/Calc based calculations.
57
58
  email:
58
59
  - Michael.Prilop@gmail.com
59
60
  executables: []
@@ -100,8 +101,7 @@ rubyforge_project:
100
101
  rubygems_version: 2.0.3
101
102
  signing_key:
102
103
  specification_version: 4
103
- summary: Calculates the difference between two dates based on the 360 day year used
104
- in interest calculations. Several methods for calculation are available.
104
+ summary: number of days between two dates based on the 360 day year
105
105
  test_files:
106
106
  - test/data/NASD_reference_DAYS360_US.csv
107
107
  - test/data/README