days360 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NzMxNTc5ZThiYTliZGYyMjE2NDg3ZjQyYTg4Y2UyNDRhMjBiOTYzZA==
5
+ data.tar.gz: !binary |-
6
+ YzM2Y2RmZWJiNWNlZGU2OGIzMDY2MGRjNGY1ODQzZmU5OTNjYzZlMQ==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ YWJlZjVjYmY2Y2UxMDFhMjI2OGY0MDc5ZmZiMmU0OGE1MDM5NmE2MDQ1Mjdh
10
+ Mjk1ZTk5MjEwNDU3N2FkZWY3MTQ0ZjhmYWJiYmE5NjQ5Mzk3MjUyYWNkZTIz
11
+ NzljNGFiZmUzMDNjNDM2YjM1YTM3NDU0MjFjMWUzZmM3ZjgzZjA=
12
+ data.tar.gz: !binary |-
13
+ NTYzMTJkYTg5ZTdhYzBlZWMzNDMyNWVmZjYxNDI5NDZkOTY4OWJhZTI3ZDJl
14
+ ZmQ1YTUxNmU1ZTJiYTE1NjVmMTQyOWYzZGM1NGQyMzIxZDhhMGFkZTYxM2Zk
15
+ MjUxZTc5ZTU0MjUyODZmMmI5NWFiYjgwNWZlMDQ2ZDEwY2E0ZjU=
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .idea
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - "1.8.7"
4
+ - "1.9.3"
5
+ - "2.0.0"
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in days360.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Michael Prilop
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # Days360
2
+
3
+ Calculates the difference between two dates based on the 360 day year used in interest calculations
4
+
5
+ [![Build Status](https://travis-ci.org/tamaloa/days360.png?branch=master)](https://travis-ci.org/tamaloa/days360)
6
+
7
+ ## Notes on DAY360 calculations
8
+
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
+
14
+ Page explaining different calculation methods and laws (in german)
15
+ http://zinsmethoden.de/
16
+
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
+ ## Installation
21
+
22
+ Add this line to your application's Gemfile:
23
+
24
+ gem 'days360'
25
+
26
+ And then execute:
27
+
28
+ $ bundle
29
+
30
+ Or install it yourself as:
31
+
32
+ $ gem install days360
33
+
34
+ ## Usage
35
+
36
+ class MyFinancialCalculation
37
+ include Days360
38
+
39
+ def interest_using_US_method(from, till)
40
+ interest_days = days360(from, till)
41
+ #equals
42
+ #interest_days = days360_us(from, till)
43
+
44
+ interest = balance * interest_rate * (interest_days / 360)
45
+
46
+ interest
47
+ end
48
+
49
+ ## Contributing
50
+
51
+ 1. Fork it
52
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
53
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
54
+ 4. Push to the branch (`git push origin my-new-feature`)
55
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ require 'rake/testtask'
4
+
5
+ Rake::TestTask.new do |t|
6
+ t.libs << 'lib/days60'
7
+ t.test_files = FileList['test/*_test.rb']
8
+ t.verbose = true
9
+ end
10
+
11
+ task :default => :test
data/days360.gemspec ADDED
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'days360/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "days360"
8
+ spec.version = Days360::VERSION
9
+ spec.authors = ["Michael Prilop"]
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.}
13
+ spec.homepage = "https://github.com/tamaloa/days360"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "test-unit"
24
+ end
data/lib/days360.rb ADDED
@@ -0,0 +1,81 @@
1
+ require "days360/version"
2
+ require 'date'
3
+
4
+ module Days360
5
+
6
+ def Days360.included cls
7
+ cls.extend Days360
8
+ end
9
+
10
+
11
+ def days360(date_a, date_b, method = :US)
12
+ return days360_US(date_a, date_b) if method.eql?(:US)
13
+ return days360_US_NASD(date_a, date_b) if method.eql?(:US_NASD)
14
+ return days360_EU(date_a, date_b) if method.eql?(:EU)
15
+ end
16
+
17
+ ##
18
+ # This method uses the the US/NASD Method (30US/360) to calculate the days between two dates
19
+ #
20
+ # NOTE: to use the reference calculation method 'preserve_excel_compatibility' must be set to false
21
+ # The default is to preserve compatibility. This means results are comparable to those obtained with
22
+ # Excel or Calc. This is a bug in Microsoft Office which is preserved for reasons of backward compatibility. Open Office Calc also
23
+ # choose to "implement" this bug to be MS-Excel compatible [1].
24
+ #
25
+ # [1] http://wiki.openoffice.org/wiki/Documentation/How_Tos/Calc:_Date_%26_Time_functions#Financial_date_systems
26
+ #
27
+ # Implementation as given by http://en.wikipedia.org/w/index.php?title=360-day_calendar&oldid=546566236
28
+ #
29
+ def days360_US(date_a, date_b, preserve_excel_compatibility = true)
30
+ day_a = date_a.day
31
+ day_b = date_b.day
32
+
33
+ # Step 1 must be skipped to preserve Excel compatibility
34
+ # (1) If both date A and B fall on the last day of February, then date B will be changed to the 30th.
35
+ day_b = 30 if last_day_of_february?(date_a) and last_day_of_february?(date_b) and not preserve_excel_compatibility
36
+
37
+ # (2) If date A falls on the 31st of a month or last day of February, then date A will be changed to the 30th.
38
+ day_a = 30 if day_a.eql?(31) or last_day_of_february?(date_a)
39
+
40
+ # (3) If date A falls on the 30th of a month after applying (2) above and date B falls on the 31st of a month, then date B will be changed to the 30th.
41
+ day_b = 30 if day_a.eql?(30) and day_b.eql?(31)
42
+
43
+ days = (date_b.year - date_a.year)*360 + (date_b.month - date_a.month)*30 + (day_b - day_a)
44
+ return days
45
+
46
+ end
47
+
48
+ def days360_US_NASD(date_a, date_b)
49
+ days360_US(date_a, date_b, false)
50
+ end
51
+
52
+ ##
53
+ # This method uses the the European method (30E/360) to calculate the days between two dates
54
+ #
55
+ # Implementation as given by http://en.wikipedia.org/w/index.php?title=360-day_calendar&oldid=546566236
56
+ #
57
+ def days360_EU(date_a, date_b)
58
+ day_a = date_a.day
59
+ day_b = date_b.day
60
+
61
+
62
+ #If either date A or B falls on the 31st of the month, that date will be changed to the 30th;
63
+ day_a = 30 if day_a.eql?(31)
64
+ day_b = 30 if day_b.eql?(31)
65
+
66
+ #Where date B falls on the last day of February, the actual date B will be used.
67
+ #This rule is actually only a note and does not change the calculation.
68
+
69
+ days = (date_b.year - date_a.year)*360 + (date_b.month - date_a.month)*30 + (day_b - day_a)
70
+ return days
71
+
72
+ end
73
+
74
+ private
75
+
76
+ def last_day_of_february?(date)
77
+ last_february_day_in_given_year = Date.new(date.year, 2, -1)
78
+ date.eql?(last_february_day_in_given_year)
79
+ end
80
+
81
+ end
@@ -0,0 +1,3 @@
1
+ module Days360
2
+ VERSION = "0.3.1"
3
+ end
@@ -0,0 +1,37 @@
1
+ ,2007-01-01,2007-01-28,2007-01-29,2007-01-30,2007-01-31,2007-01-30,2007-02-28,2007-03-29,2007-03-30,2007-03-31,2007-04-29,2007-04-30,2007-05-29,2007-05-30,2007-05-31,2007-06-29,2007-06-30,2007-07-29,2007-07-30,2007-07-31,2007-08-29,2007-08-30,2007-08-31,2007-09-29,2007-09-30,2007-10-29,2007-10-30,2007-10-31,2007-11-29,2007-11-30,2007-12-29,2007-12-30,2007-12-31,2008-02-28,2008-02-29,2008-03-01
2
+ 2007-01-01,0,27,28,29,30,29,57,88,89,90,118,119,148,149,150,178,179,208,209,210,238,239,240,268,269,298,299,300,328,329,358,359,360,417,418,420
3
+ 2007-01-28,-27,0,1,2,3,2,30,61,62,63,91,92,121,122,123,151,152,181,182,183,211,212,213,241,242,271,272,273,301,302,331,332,333,390,391,393
4
+ 2007-01-29,-28,-1,0,1,2,1,29,60,61,62,90,91,120,121,122,150,151,180,181,182,210,211,212,240,241,270,271,272,300,301,330,331,332,389,390,392
5
+ 2007-01-30,-29,-2,-1,0,0,0,28,59,60,60,89,90,119,120,120,149,150,179,180,180,209,210,210,239,240,269,270,270,299,300,329,330,330,388,389,391
6
+ 2007-01-31,-29,-2,-1,0,0,0,28,59,60,60,89,90,119,120,120,149,150,179,180,180,209,210,210,239,240,269,270,270,299,300,329,330,330,388,389,391
7
+ 2007-01-30,-29,-2,-1,0,0,0,28,59,60,60,89,90,119,120,120,149,150,179,180,180,209,210,210,239,240,269,270,270,299,300,329,330,330,388,389,391
8
+ 2007-02-28,-59,-32,-31,-30,-30,-30,0,29,30,30,59,60,89,90,90,119,120,149,150,150,179,180,180,209,210,239,240,240,269,270,299,300,300,358,360,361
9
+ 2007-03-29,-88,-61,-60,-59,-58,-59,-31,0,1,2,30,31,60,61,62,90,91,120,121,122,150,151,152,180,181,210,211,212,240,241,270,271,272,329,330,332
10
+ 2007-03-30,-89,-62,-61,-60,-60,-60,-32,-1,0,0,29,30,59,60,60,89,90,119,120,120,149,150,150,179,180,209,210,210,239,240,269,270,270,328,329,331
11
+ 2007-03-31,-89,-62,-61,-60,-60,-60,-32,-1,0,0,29,30,59,60,60,89,90,119,120,120,149,150,150,179,180,209,210,210,239,240,269,270,270,328,329,331
12
+ 2007-04-29,-118,-91,-90,-89,-88,-89,-61,-30,-29,-28,0,1,30,31,32,60,61,90,91,92,120,121,122,150,151,180,181,182,210,211,240,241,242,299,300,302
13
+ 2007-04-30,-119,-92,-91,-90,-90,-90,-62,-31,-30,-30,-1,0,29,30,30,59,60,89,90,90,119,120,120,149,150,179,180,180,209,210,239,240,240,298,299,301
14
+ 2007-05-29,-148,-121,-120,-119,-118,-119,-91,-60,-59,-58,-30,-29,0,1,2,30,31,60,61,62,90,91,92,120,121,150,151,152,180,181,210,211,212,269,270,272
15
+ 2007-05-30,-149,-122,-121,-120,-120,-120,-92,-61,-60,-60,-31,-30,-1,0,0,29,30,59,60,60,89,90,90,119,120,149,150,150,179,180,209,210,210,268,269,271
16
+ 2007-05-31,-149,-122,-121,-120,-120,-120,-92,-61,-60,-60,-31,-30,-1,0,0,29,30,59,60,60,89,90,90,119,120,149,150,150,179,180,209,210,210,268,269,271
17
+ 2007-06-29,-178,-151,-150,-149,-148,-149,-121,-90,-89,-88,-60,-59,-30,-29,-28,0,1,30,31,32,60,61,62,90,91,120,121,122,150,151,180,181,182,239,240,242
18
+ 2007-06-30,-179,-152,-151,-150,-150,-150,-122,-91,-90,-90,-61,-60,-31,-30,-30,-1,0,29,30,30,59,60,60,89,90,119,120,120,149,150,179,180,180,238,239,241
19
+ 2007-07-29,-208,-181,-180,-179,-178,-179,-151,-120,-119,-118,-90,-89,-60,-59,-58,-30,-29,0,1,2,30,31,32,60,61,90,91,92,120,121,150,151,152,209,210,212
20
+ 2007-07-30,-209,-182,-181,-180,-180,-180,-152,-121,-120,-120,-91,-90,-61,-60,-60,-31,-30,-1,0,0,29,30,30,59,60,89,90,90,119,120,149,150,150,208,209,211
21
+ 2007-07-31,-209,-182,-181,-180,-180,-180,-152,-121,-120,-120,-91,-90,-61,-60,-60,-31,-30,-1,0,0,29,30,30,59,60,89,90,90,119,120,149,150,150,208,209,211
22
+ 2007-08-29,-238,-211,-210,-209,-208,-209,-181,-150,-149,-148,-120,-119,-90,-89,-88,-60,-59,-30,-29,-28,0,1,2,30,31,60,61,62,90,91,120,121,122,179,180,182
23
+ 2007-08-30,-239,-212,-211,-210,-210,-210,-182,-151,-150,-150,-121,-120,-91,-90,-90,-61,-60,-31,-30,-30,-1,0,0,29,30,59,60,60,89,90,119,120,120,178,179,181
24
+ 2007-08-31,-239,-212,-211,-210,-210,-210,-182,-151,-150,-150,-121,-120,-91,-90,-90,-61,-60,-31,-30,-30,-1,0,0,29,30,59,60,60,89,90,119,120,120,178,179,181
25
+ 2007-09-29,-268,-241,-240,-239,-238,-239,-211,-180,-179,-178,-150,-149,-120,-119,-118,-90,-89,-60,-59,-58,-30,-29,-28,0,1,30,31,32,60,61,90,91,92,149,150,152
26
+ 2007-09-30,-269,-242,-241,-240,-240,-240,-212,-181,-180,-180,-151,-150,-121,-120,-120,-91,-90,-61,-60,-60,-31,-30,-30,-1,0,29,30,30,59,60,89,90,90,148,149,151
27
+ 2007-10-29,-298,-271,-270,-269,-268,-269,-241,-210,-209,-208,-180,-179,-150,-149,-148,-120,-119,-90,-89,-88,-60,-59,-58,-30,-29,0,1,2,30,31,60,61,62,119,120,122
28
+ 2007-10-30,-299,-272,-271,-270,-270,-270,-242,-211,-210,-210,-181,-180,-151,-150,-150,-121,-120,-91,-90,-90,-61,-60,-60,-31,-30,-1,0,0,29,30,59,60,60,118,119,121
29
+ 2007-10-31,-299,-272,-271,-270,-270,-270,-242,-211,-210,-210,-181,-180,-151,-150,-150,-121,-120,-91,-90,-90,-61,-60,-60,-31,-30,-1,0,0,29,30,59,60,60,118,119,121
30
+ 2007-11-29,-328,-301,-300,-299,-298,-299,-271,-240,-239,-238,-210,-209,-180,-179,-178,-150,-149,-120,-119,-118,-90,-89,-88,-60,-59,-30,-29,-28,0,1,30,31,32,89,90,92
31
+ 2007-11-30,-329,-302,-301,-300,-300,-300,-272,-241,-240,-240,-211,-210,-181,-180,-180,-151,-150,-121,-120,-120,-91,-90,-90,-61,-60,-31,-30,-30,-1,0,29,30,30,88,89,91
32
+ 2007-12-29,-358,-331,-330,-329,-328,-329,-301,-270,-269,-268,-240,-239,-210,-209,-208,-180,-179,-150,-149,-148,-120,-119,-118,-90,-89,-60,-59,-58,-30,-29,0,1,2,59,60,62
33
+ 2007-12-30,-359,-332,-331,-330,-330,-330,-302,-271,-270,-270,-241,-240,-211,-210,-210,-181,-180,-151,-150,-150,-121,-120,-120,-91,-90,-61,-60,-60,-31,-30,-1,0,0,58,59,61
34
+ 2007-12-31,-359,-332,-331,-330,-330,-330,-302,-271,-270,-270,-241,-240,-211,-210,-210,-181,-180,-151,-150,-150,-121,-120,-120,-91,-90,-61,-60,-60,-31,-30,-1,0,0,58,59,61
35
+ 2008-02-28,-417,-390,-389,-388,-387,-388,-360,-329,-328,-327,-299,-298,-269,-268,-267,-239,-238,-209,-208,-207,-179,-178,-177,-149,-148,-119,-118,-117,-89,-88,-59,-58,-57,0,1,3
36
+ 2008-02-29,-419,-392,-391,-390,-390,-390,-360,-331,-330,-330,-301,-300,-271,-270,-270,-241,-240,-211,-210,-210,-181,-180,-180,-151,-150,-121,-120,-120,-91,-90,-61,-60,-60,-2,0,1
37
+ 2008-03-01,-420,-393,-392,-391,-390,-391,-363,-332,-331,-330,-302,-301,-272,-271,-270,-242,-241,-212,-211,-210,-182,-181,-180,-152,-151,-122,-121,-120,-92,-91,-62,-61,-60,-3,-2,0
data/test/data/README ADDED
@@ -0,0 +1,12 @@
1
+ This directory contains test data to verify compliance against common office suits.
2
+
3
+ Bot MsOffice and OpenOffice / LibreOffice have a days360 method. In both cases the method takes an optional third
4
+ parameter and thus uses either the US method or the EU method.
5
+
6
+ calc_DAYS360*.csv sheets were generated using LibreOffice Calc 3.5.7.2
7
+ excel_DAYS360*.csv sheets were generated using Microsoft Office Excel 2010 (version 14.0)
8
+
9
+ The test data is an 36x36 test vector of dates which is taken from
10
+ https://issues.apache.org/ooo/show_bug.cgi?id=84934 (credits to terrye) but was freshly generate with more up to date
11
+ office suites (and thus do not contain the bug mentioned in before issue).
12
+
@@ -0,0 +1,37 @@
1
+ ,2007-01-01,2007-01-28,2007-01-29,2007-01-30,2007-01-31,2007-01-30,2007-02-28,2007-03-29,2007-03-30,2007-03-31,2007-04-29,2007-04-30,2007-05-29,2007-05-30,2007-05-31,2007-06-29,2007-06-30,2007-07-29,2007-07-30,2007-07-31,2007-08-29,2007-08-30,2007-08-31,2007-09-29,2007-09-30,2007-10-29,2007-10-30,2007-10-31,2007-11-29,2007-11-30,2007-12-29,2007-12-30,2007-12-31,2008-02-28,2008-02-29,2008-03-01
2
+ 2007-01-01,0,27,28,29,29,29,57,88,89,89,118,119,148,149,149,178,179,208,209,209,238,239,239,268,269,298,299,299,328,329,358,359,359,417,418,420
3
+ 2007-01-28,-27,0,1,2,2,2,30,61,62,62,91,92,121,122,122,151,152,181,182,182,211,212,212,241,242,271,272,272,301,302,331,332,332,390,391,393
4
+ 2007-01-29,-28,-1,0,1,1,1,29,60,61,61,90,91,120,121,121,150,151,180,181,181,210,211,211,240,241,270,271,271,300,301,330,331,331,389,390,392
5
+ 2007-01-30,-29,-2,-1,0,0,0,28,59,60,60,89,90,119,120,120,149,150,179,180,180,209,210,210,239,240,269,270,270,299,300,329,330,330,388,389,391
6
+ 2007-01-31,-29,-2,-1,0,0,0,28,59,60,60,89,90,119,120,120,149,150,179,180,180,209,210,210,239,240,269,270,270,299,300,329,330,330,388,389,391
7
+ 2007-01-30,-29,-2,-1,0,0,0,28,59,60,60,89,90,119,120,120,149,150,179,180,180,209,210,210,239,240,269,270,270,299,300,329,330,330,388,389,391
8
+ 2007-02-28,-57,-30,-29,-28,-28,-28,0,31,32,32,61,62,91,92,92,121,122,151,152,152,181,182,182,211,212,241,242,242,271,272,301,302,302,360,361,363
9
+ 2007-03-29,-88,-61,-60,-59,-59,-59,-31,0,1,1,30,31,60,61,61,90,91,120,121,121,150,151,151,180,181,210,211,211,240,241,270,271,271,329,330,332
10
+ 2007-03-30,-89,-62,-61,-60,-60,-60,-32,-1,0,0,29,30,59,60,60,89,90,119,120,120,149,150,150,179,180,209,210,210,239,240,269,270,270,328,329,331
11
+ 2007-03-31,-89,-62,-61,-60,-60,-60,-32,-1,0,0,29,30,59,60,60,89,90,119,120,120,149,150,150,179,180,209,210,210,239,240,269,270,270,328,329,331
12
+ 2007-04-29,-118,-91,-90,-89,-89,-89,-61,-30,-29,-29,0,1,30,31,31,60,61,90,91,91,120,121,121,150,151,180,181,181,210,211,240,241,241,299,300,302
13
+ 2007-04-30,-119,-92,-91,-90,-90,-90,-62,-31,-30,-30,-1,0,29,30,30,59,60,89,90,90,119,120,120,149,150,179,180,180,209,210,239,240,240,298,299,301
14
+ 2007-05-29,-148,-121,-120,-119,-119,-119,-91,-60,-59,-59,-30,-29,0,1,1,30,31,60,61,61,90,91,91,120,121,150,151,151,180,181,210,211,211,269,270,272
15
+ 2007-05-30,-149,-122,-121,-120,-120,-120,-92,-61,-60,-60,-31,-30,-1,0,0,29,30,59,60,60,89,90,90,119,120,149,150,150,179,180,209,210,210,268,269,271
16
+ 2007-05-31,-149,-122,-121,-120,-120,-120,-92,-61,-60,-60,-31,-30,-1,0,0,29,30,59,60,60,89,90,90,119,120,149,150,150,179,180,209,210,210,268,269,271
17
+ 2007-06-29,-178,-151,-150,-149,-149,-149,-121,-90,-89,-89,-60,-59,-30,-29,-29,0,1,30,31,31,60,61,61,90,91,120,121,121,150,151,180,181,181,239,240,242
18
+ 2007-06-30,-179,-152,-151,-150,-150,-150,-122,-91,-90,-90,-61,-60,-31,-30,-30,-1,0,29,30,30,59,60,60,89,90,119,120,120,149,150,179,180,180,238,239,241
19
+ 2007-07-29,-208,-181,-180,-179,-179,-179,-151,-120,-119,-119,-90,-89,-60,-59,-59,-30,-29,0,1,1,30,31,31,60,61,90,91,91,120,121,150,151,151,209,210,212
20
+ 2007-07-30,-209,-182,-181,-180,-180,-180,-152,-121,-120,-120,-91,-90,-61,-60,-60,-31,-30,-1,0,0,29,30,30,59,60,89,90,90,119,120,149,150,150,208,209,211
21
+ 2007-07-31,-209,-182,-181,-180,-180,-180,-152,-121,-120,-120,-91,-90,-61,-60,-60,-31,-30,-1,0,0,29,30,30,59,60,89,90,90,119,120,149,150,150,208,209,211
22
+ 2007-08-29,-238,-211,-210,-209,-209,-209,-181,-150,-149,-149,-120,-119,-90,-89,-89,-60,-59,-30,-29,-29,0,1,1,30,31,60,61,61,90,91,120,121,121,179,180,182
23
+ 2007-08-30,-239,-212,-211,-210,-210,-210,-182,-151,-150,-150,-121,-120,-91,-90,-90,-61,-60,-31,-30,-30,-1,0,0,29,30,59,60,60,89,90,119,120,120,178,179,181
24
+ 2007-08-31,-239,-212,-211,-210,-210,-210,-182,-151,-150,-150,-121,-120,-91,-90,-90,-61,-60,-31,-30,-30,-1,0,0,29,30,59,60,60,89,90,119,120,120,178,179,181
25
+ 2007-09-29,-268,-241,-240,-239,-239,-239,-211,-180,-179,-179,-150,-149,-120,-119,-119,-90,-89,-60,-59,-59,-30,-29,-29,0,1,30,31,31,60,61,90,91,91,149,150,152
26
+ 2007-09-30,-269,-242,-241,-240,-240,-240,-212,-181,-180,-180,-151,-150,-121,-120,-120,-91,-90,-61,-60,-60,-31,-30,-30,-1,0,29,30,30,59,60,89,90,90,148,149,151
27
+ 2007-10-29,-298,-271,-270,-269,-269,-269,-241,-210,-209,-209,-180,-179,-150,-149,-149,-120,-119,-90,-89,-89,-60,-59,-59,-30,-29,0,1,1,30,31,60,61,61,119,120,122
28
+ 2007-10-30,-299,-272,-271,-270,-270,-270,-242,-211,-210,-210,-181,-180,-151,-150,-150,-121,-120,-91,-90,-90,-61,-60,-60,-31,-30,-1,0,0,29,30,59,60,60,118,119,121
29
+ 2007-10-31,-299,-272,-271,-270,-270,-270,-242,-211,-210,-210,-181,-180,-151,-150,-150,-121,-120,-91,-90,-90,-61,-60,-60,-31,-30,-1,0,0,29,30,59,60,60,118,119,121
30
+ 2007-11-29,-328,-301,-300,-299,-299,-299,-271,-240,-239,-239,-210,-209,-180,-179,-179,-150,-149,-120,-119,-119,-90,-89,-89,-60,-59,-30,-29,-29,0,1,30,31,31,89,90,92
31
+ 2007-11-30,-329,-302,-301,-300,-300,-300,-272,-241,-240,-240,-211,-210,-181,-180,-180,-151,-150,-121,-120,-120,-91,-90,-90,-61,-60,-31,-30,-30,-1,0,29,30,30,88,89,91
32
+ 2007-12-29,-358,-331,-330,-329,-329,-329,-301,-270,-269,-269,-240,-239,-210,-209,-209,-180,-179,-150,-149,-149,-120,-119,-119,-90,-89,-60,-59,-59,-30,-29,0,1,1,59,60,62
33
+ 2007-12-30,-359,-332,-331,-330,-330,-330,-302,-271,-270,-270,-241,-240,-211,-210,-210,-181,-180,-151,-150,-150,-121,-120,-120,-91,-90,-61,-60,-60,-31,-30,-1,0,0,58,59,61
34
+ 2007-12-31,-359,-332,-331,-330,-330,-330,-302,-271,-270,-270,-241,-240,-211,-210,-210,-181,-180,-151,-150,-150,-121,-120,-120,-91,-90,-61,-60,-60,-31,-30,-1,0,0,58,59,61
35
+ 2008-02-28,-417,-390,-389,-388,-388,-388,-360,-329,-328,-328,-299,-298,-269,-268,-268,-239,-238,-209,-208,-208,-179,-178,-178,-149,-148,-119,-118,-118,-89,-88,-59,-58,-58,0,1,3
36
+ 2008-02-29,-418,-391,-390,-389,-389,-389,-361,-330,-329,-329,-300,-299,-270,-269,-269,-240,-239,-210,-209,-209,-180,-179,-179,-150,-149,-120,-119,-119,-90,-89,-60,-59,-59,-1,0,2
37
+ 2008-03-01,-420,-393,-392,-391,-391,-391,-363,-332,-331,-331,-302,-301,-272,-271,-271,-242,-241,-212,-211,-211,-182,-181,-181,-152,-151,-122,-121,-121,-92,-91,-62,-61,-61,-3,-2,0
@@ -0,0 +1,37 @@
1
+ ,2007-01-01,2007-01-28,2007-01-29,2007-01-30,2007-01-31,2007-01-30,2007-02-28,2007-03-29,2007-03-30,2007-03-31,2007-04-29,2007-04-30,2007-05-29,2007-05-30,2007-05-31,2007-06-29,2007-06-30,2007-07-29,2007-07-30,2007-07-31,2007-08-29,2007-08-30,2007-08-31,2007-09-29,2007-09-30,2007-10-29,2007-10-30,2007-10-31,2007-11-29,2007-11-30,2007-12-29,2007-12-30,2007-12-31,2008-02-28,2008-02-29,2008-03-01
2
+ 2007-01-01,0,27,28,29,30,29,57,88,89,90,118,119,148,149,150,178,179,208,209,210,238,239,240,268,269,298,299,300,328,329,358,359,360,417,418,420
3
+ 2007-01-28,-27,0,1,2,3,2,30,61,62,63,91,92,121,122,123,151,152,181,182,183,211,212,213,241,242,271,272,273,301,302,331,332,333,390,391,393
4
+ 2007-01-29,-28,-1,0,1,2,1,29,60,61,62,90,91,120,121,122,150,151,180,181,182,210,211,212,240,241,270,271,272,300,301,330,331,332,389,390,392
5
+ 2007-01-30,-29,-2,-1,0,0,0,28,59,60,60,89,90,119,120,120,149,150,179,180,180,209,210,210,239,240,269,270,270,299,300,329,330,330,388,389,391
6
+ 2007-01-31,-29,-2,-1,0,0,0,28,59,60,60,89,90,119,120,120,149,150,179,180,180,209,210,210,239,240,269,270,270,299,300,329,330,330,388,389,391
7
+ 2007-01-30,-29,-2,-1,0,0,0,28,59,60,60,89,90,119,120,120,149,150,179,180,180,209,210,210,239,240,269,270,270,299,300,329,330,330,388,389,391
8
+ 2007-02-28,-59,-32,-31,-30,-30,-30,-2,29,30,30,59,60,89,90,90,119,120,149,150,150,179,180,180,209,210,239,240,240,269,270,299,300,300,358,359,361
9
+ 2007-03-29,-88,-61,-60,-59,-58,-59,-31,0,1,2,30,31,60,61,62,90,91,120,121,122,150,151,152,180,181,210,211,212,240,241,270,271,272,329,330,332
10
+ 2007-03-30,-89,-62,-61,-60,-60,-60,-32,-1,0,0,29,30,59,60,60,89,90,119,120,120,149,150,150,179,180,209,210,210,239,240,269,270,270,328,329,331
11
+ 2007-03-31,-89,-62,-61,-60,-60,-60,-32,-1,0,0,29,30,59,60,60,89,90,119,120,120,149,150,150,179,180,209,210,210,239,240,269,270,270,328,329,331
12
+ 2007-04-29,-118,-91,-90,-89,-88,-89,-61,-30,-29,-28,0,1,30,31,32,60,61,90,91,92,120,121,122,150,151,180,181,182,210,211,240,241,242,299,300,302
13
+ 2007-04-30,-119,-92,-91,-90,-90,-90,-62,-31,-30,-30,-1,0,29,30,30,59,60,89,90,90,119,120,120,149,150,179,180,180,209,210,239,240,240,298,299,301
14
+ 2007-05-29,-148,-121,-120,-119,-118,-119,-91,-60,-59,-58,-30,-29,0,1,2,30,31,60,61,62,90,91,92,120,121,150,151,152,180,181,210,211,212,269,270,272
15
+ 2007-05-30,-149,-122,-121,-120,-120,-120,-92,-61,-60,-60,-31,-30,-1,0,0,29,30,59,60,60,89,90,90,119,120,149,150,150,179,180,209,210,210,268,269,271
16
+ 2007-05-31,-149,-122,-121,-120,-120,-120,-92,-61,-60,-60,-31,-30,-1,0,0,29,30,59,60,60,89,90,90,119,120,149,150,150,179,180,209,210,210,268,269,271
17
+ 2007-06-29,-178,-151,-150,-149,-148,-149,-121,-90,-89,-88,-60,-59,-30,-29,-28,0,1,30,31,32,60,61,62,90,91,120,121,122,150,151,180,181,182,239,240,242
18
+ 2007-06-30,-179,-152,-151,-150,-150,-150,-122,-91,-90,-90,-61,-60,-31,-30,-30,-1,0,29,30,30,59,60,60,89,90,119,120,120,149,150,179,180,180,238,239,241
19
+ 2007-07-29,-208,-181,-180,-179,-178,-179,-151,-120,-119,-118,-90,-89,-60,-59,-58,-30,-29,0,1,2,30,31,32,60,61,90,91,92,120,121,150,151,152,209,210,212
20
+ 2007-07-30,-209,-182,-181,-180,-180,-180,-152,-121,-120,-120,-91,-90,-61,-60,-60,-31,-30,-1,0,0,29,30,30,59,60,89,90,90,119,120,149,150,150,208,209,211
21
+ 2007-07-31,-209,-182,-181,-180,-180,-180,-152,-121,-120,-120,-91,-90,-61,-60,-60,-31,-30,-1,0,0,29,30,30,59,60,89,90,90,119,120,149,150,150,208,209,211
22
+ 2007-08-29,-238,-211,-210,-209,-208,-209,-181,-150,-149,-148,-120,-119,-90,-89,-88,-60,-59,-30,-29,-28,0,1,2,30,31,60,61,62,90,91,120,121,122,179,180,182
23
+ 2007-08-30,-239,-212,-211,-210,-210,-210,-182,-151,-150,-150,-121,-120,-91,-90,-90,-61,-60,-31,-30,-30,-1,0,0,29,30,59,60,60,89,90,119,120,120,178,179,181
24
+ 2007-08-31,-239,-212,-211,-210,-210,-210,-182,-151,-150,-150,-121,-120,-91,-90,-90,-61,-60,-31,-30,-30,-1,0,0,29,30,59,60,60,89,90,119,120,120,178,179,181
25
+ 2007-09-29,-268,-241,-240,-239,-238,-239,-211,-180,-179,-178,-150,-149,-120,-119,-118,-90,-89,-60,-59,-58,-30,-29,-28,0,1,30,31,32,60,61,90,91,92,149,150,152
26
+ 2007-09-30,-269,-242,-241,-240,-240,-240,-212,-181,-180,-180,-151,-150,-121,-120,-120,-91,-90,-61,-60,-60,-31,-30,-30,-1,0,29,30,30,59,60,89,90,90,148,149,151
27
+ 2007-10-29,-298,-271,-270,-269,-268,-269,-241,-210,-209,-208,-180,-179,-150,-149,-148,-120,-119,-90,-89,-88,-60,-59,-58,-30,-29,0,1,2,30,31,60,61,62,119,120,122
28
+ 2007-10-30,-299,-272,-271,-270,-270,-270,-242,-211,-210,-210,-181,-180,-151,-150,-150,-121,-120,-91,-90,-90,-61,-60,-60,-31,-30,-1,0,0,29,30,59,60,60,118,119,121
29
+ 2007-10-31,-299,-272,-271,-270,-270,-270,-242,-211,-210,-210,-181,-180,-151,-150,-150,-121,-120,-91,-90,-90,-61,-60,-60,-31,-30,-1,0,0,29,30,59,60,60,118,119,121
30
+ 2007-11-29,-328,-301,-300,-299,-298,-299,-271,-240,-239,-238,-210,-209,-180,-179,-178,-150,-149,-120,-119,-118,-90,-89,-88,-60,-59,-30,-29,-28,0,1,30,31,32,89,90,92
31
+ 2007-11-30,-329,-302,-301,-300,-300,-300,-272,-241,-240,-240,-211,-210,-181,-180,-180,-151,-150,-121,-120,-120,-91,-90,-90,-61,-60,-31,-30,-30,-1,0,29,30,30,88,89,91
32
+ 2007-12-29,-358,-331,-330,-329,-328,-329,-301,-270,-269,-268,-240,-239,-210,-209,-208,-180,-179,-150,-149,-148,-120,-119,-118,-90,-89,-60,-59,-58,-30,-29,0,1,2,59,60,62
33
+ 2007-12-30,-359,-332,-331,-330,-330,-330,-302,-271,-270,-270,-241,-240,-211,-210,-210,-181,-180,-151,-150,-150,-121,-120,-120,-91,-90,-61,-60,-60,-31,-30,-1,0,0,58,59,61
34
+ 2007-12-31,-359,-332,-331,-330,-330,-330,-302,-271,-270,-270,-241,-240,-211,-210,-210,-181,-180,-151,-150,-150,-121,-120,-120,-91,-90,-61,-60,-60,-31,-30,-1,0,0,58,59,61
35
+ 2008-02-28,-417,-390,-389,-388,-387,-388,-360,-329,-328,-327,-299,-298,-269,-268,-267,-239,-238,-209,-208,-207,-179,-178,-177,-149,-148,-119,-118,-117,-89,-88,-59,-58,-57,0,1,3
36
+ 2008-02-29,-419,-392,-391,-390,-390,-390,-362,-331,-330,-330,-301,-300,-271,-270,-270,-241,-240,-211,-210,-210,-181,-180,-180,-151,-150,-121,-120,-120,-91,-90,-61,-60,-60,-2,-1,1
37
+ 2008-03-01,-420,-393,-392,-391,-390,-391,-363,-332,-331,-330,-302,-301,-272,-271,-270,-242,-241,-212,-211,-210,-182,-181,-180,-152,-151,-122,-121,-120,-92,-91,-62,-61,-60,-3,-2,0
@@ -0,0 +1,37 @@
1
+ ,2007-01-01,2007-01-28,2007-01-29,2007-01-30,2007-01-31,2007-01-30,2007-02-28,2007-03-29,2007-03-30,2007-03-31,2007-04-29,2007-04-30,2007-05-29,2007-05-30,2007-05-31,2007-06-29,2007-06-30,2007-07-29,2007-07-30,2007-07-31,2007-08-29,2007-08-30,2007-08-31,2007-09-29,2007-09-30,2007-10-29,2007-10-30,2007-10-31,2007-11-29,2007-11-30,2007-12-29,2007-12-30,2007-12-31,2008-02-28,2008-02-29,2008-03-01
2
+ 2007-01-01,,27,28,29,29,29,57,88,89,89,118,119,148,149,149,178,179,208,209,209,238,239,239,268,269,298,299,299,328,329,358,359,359,417,418,420
3
+ 2007-01-28,-27,,1,2,2,2,30,61,62,62,91,92,121,122,122,151,152,181,182,182,211,212,212,241,242,271,272,272,301,302,331,332,332,390,391,393
4
+ 2007-01-29,-28,-1,,1,1,1,29,60,61,61,90,91,120,121,121,150,151,180,181,181,210,211,211,240,241,270,271,271,300,301,330,331,331,389,390,392
5
+ 2007-01-30,-29,-2,-1,,,,28,59,60,60,89,90,119,120,120,149,150,179,180,180,209,210,210,239,240,269,270,270,299,300,329,330,330,388,389,391
6
+ 2007-01-31,-29,-2,-1,,,,28,59,60,60,89,90,119,120,120,149,150,179,180,180,209,210,210,239,240,269,270,270,299,300,329,330,330,388,389,391
7
+ 2007-01-30,-29,-2,-1,,,,28,59,60,60,89,90,119,120,120,149,150,179,180,180,209,210,210,239,240,269,270,270,299,300,329,330,330,388,389,391
8
+ 2007-02-28,-57,-30,-29,-28,-28,-28,,31,32,32,61,62,91,92,92,121,122,151,152,152,181,182,182,211,212,241,242,242,271,272,301,302,302,360,361,363
9
+ 2007-03-29,-88,-61,-60,-59,-59,-59,-31,,1,1,30,31,60,61,61,90,91,120,121,121,150,151,151,180,181,210,211,211,240,241,270,271,271,329,330,332
10
+ 2007-03-30,-89,-62,-61,-60,-60,-60,-32,-1,,,29,30,59,60,60,89,90,119,120,120,149,150,150,179,180,209,210,210,239,240,269,270,270,328,329,331
11
+ 2007-03-31,-89,-62,-61,-60,-60,-60,-32,-1,,,29,30,59,60,60,89,90,119,120,120,149,150,150,179,180,209,210,210,239,240,269,270,270,328,329,331
12
+ 2007-04-29,-118,-91,-90,-89,-89,-89,-61,-30,-29,-29,,1,30,31,31,60,61,90,91,91,120,121,121,150,151,180,181,181,210,211,240,241,241,299,300,302
13
+ 2007-04-30,-119,-92,-91,-90,-90,-90,-62,-31,-30,-30,-1,,29,30,30,59,60,89,90,90,119,120,120,149,150,179,180,180,209,210,239,240,240,298,299,301
14
+ 2007-05-29,-148,-121,-120,-119,-119,-119,-91,-60,-59,-59,-30,-29,,1,1,30,31,60,61,61,90,91,91,120,121,150,151,151,180,181,210,211,211,269,270,272
15
+ 2007-05-30,-149,-122,-121,-120,-120,-120,-92,-61,-60,-60,-31,-30,-1,,,29,30,59,60,60,89,90,90,119,120,149,150,150,179,180,209,210,210,268,269,271
16
+ 2007-05-31,-149,-122,-121,-120,-120,-120,-92,-61,-60,-60,-31,-30,-1,,,29,30,59,60,60,89,90,90,119,120,149,150,150,179,180,209,210,210,268,269,271
17
+ 2007-06-29,-178,-151,-150,-149,-149,-149,-121,-90,-89,-89,-60,-59,-30,-29,-29,,1,30,31,31,60,61,61,90,91,120,121,121,150,151,180,181,181,239,240,242
18
+ 2007-06-30,-179,-152,-151,-150,-150,-150,-122,-91,-90,-90,-61,-60,-31,-30,-30,-1,,29,30,30,59,60,60,89,90,119,120,120,149,150,179,180,180,238,239,241
19
+ 2007-07-29,-208,-181,-180,-179,-179,-179,-151,-120,-119,-119,-90,-89,-60,-59,-59,-30,-29,,1,1,30,31,31,60,61,90,91,91,120,121,150,151,151,209,210,212
20
+ 2007-07-30,-209,-182,-181,-180,-180,-180,-152,-121,-120,-120,-91,-90,-61,-60,-60,-31,-30,-1,,,29,30,30,59,60,89,90,90,119,120,149,150,150,208,209,211
21
+ 2007-07-31,-209,-182,-181,-180,-180,-180,-152,-121,-120,-120,-91,-90,-61,-60,-60,-31,-30,-1,,,29,30,30,59,60,89,90,90,119,120,149,150,150,208,209,211
22
+ 2007-08-29,-238,-211,-210,-209,-209,-209,-181,-150,-149,-149,-120,-119,-90,-89,-89,-60,-59,-30,-29,-29,,1,1,30,31,60,61,61,90,91,120,121,121,179,180,182
23
+ 2007-08-30,-239,-212,-211,-210,-210,-210,-182,-151,-150,-150,-121,-120,-91,-90,-90,-61,-60,-31,-30,-30,-1,,,29,30,59,60,60,89,90,119,120,120,178,179,181
24
+ 2007-08-31,-239,-212,-211,-210,-210,-210,-182,-151,-150,-150,-121,-120,-91,-90,-90,-61,-60,-31,-30,-30,-1,,,29,30,59,60,60,89,90,119,120,120,178,179,181
25
+ 2007-09-29,-268,-241,-240,-239,-239,-239,-211,-180,-179,-179,-150,-149,-120,-119,-119,-90,-89,-60,-59,-59,-30,-29,-29,,1,30,31,31,60,61,90,91,91,149,150,152
26
+ 2007-09-30,-269,-242,-241,-240,-240,-240,-212,-181,-180,-180,-151,-150,-121,-120,-120,-91,-90,-61,-60,-60,-31,-30,-30,-1,,29,30,30,59,60,89,90,90,148,149,151
27
+ 2007-10-29,-298,-271,-270,-269,-269,-269,-241,-210,-209,-209,-180,-179,-150,-149,-149,-120,-119,-90,-89,-89,-60,-59,-59,-30,-29,,1,1,30,31,60,61,61,119,120,122
28
+ 2007-10-30,-299,-272,-271,-270,-270,-270,-242,-211,-210,-210,-181,-180,-151,-150,-150,-121,-120,-91,-90,-90,-61,-60,-60,-31,-30,-1,,,29,30,59,60,60,118,119,121
29
+ 2007-10-31,-299,-272,-271,-270,-270,-270,-242,-211,-210,-210,-181,-180,-151,-150,-150,-121,-120,-91,-90,-90,-61,-60,-60,-31,-30,-1,,,29,30,59,60,60,118,119,121
30
+ 2007-11-29,-328,-301,-300,-299,-299,-299,-271,-240,-239,-239,-210,-209,-180,-179,-179,-150,-149,-120,-119,-119,-90,-89,-89,-60,-59,-30,-29,-29,,1,30,31,31,89,90,92
31
+ 2007-11-30,-329,-302,-301,-300,-300,-300,-272,-241,-240,-240,-211,-210,-181,-180,-180,-151,-150,-121,-120,-120,-91,-90,-90,-61,-60,-31,-30,-30,-1,,29,30,30,88,89,91
32
+ 2007-12-29,-358,-331,-330,-329,-329,-329,-301,-270,-269,-269,-240,-239,-210,-209,-209,-180,-179,-150,-149,-149,-120,-119,-119,-90,-89,-60,-59,-59,-30,-29,,1,1,59,60,62
33
+ 2007-12-30,-359,-332,-331,-330,-330,-330,-302,-271,-270,-270,-241,-240,-211,-210,-210,-181,-180,-151,-150,-150,-121,-120,-120,-91,-90,-61,-60,-60,-31,-30,-1,,,58,59,61
34
+ 2007-12-31,-359,-332,-331,-330,-330,-330,-302,-271,-270,-270,-241,-240,-211,-210,-210,-181,-180,-151,-150,-150,-121,-120,-120,-91,-90,-61,-60,-60,-31,-30,-1,,,58,59,61
35
+ 2008-02-28,-417,-390,-389,-388,-388,-388,-360,-329,-328,-328,-299,-298,-269,-268,-268,-239,-238,-209,-208,-208,-179,-178,-178,-149,-148,-119,-118,-118,-89,-88,-59,-58,-58,,1,3
36
+ 2008-02-29,-418,-391,-390,-389,-389,-389,-361,-330,-329,-329,-300,-299,-270,-269,-269,-240,-239,-210,-209,-209,-180,-179,-179,-150,-149,-120,-119,-119,-90,-89,-60,-59,-59,-1,,2
37
+ 2008-03-01,-420,-393,-392,-391,-391,-391,-363,-332,-331,-331,-302,-301,-272,-271,-271,-242,-241,-212,-211,-211,-182,-181,-181,-152,-151,-122,-121,-121,-92,-91,-62,-61,-61,-3,-2,
@@ -0,0 +1,37 @@
1
+ ,2007-01-01,2007-01-28,2007-01-29,2007-01-30,2007-01-31,2007-01-30,2007-02-28,2007-03-29,2007-03-30,2007-03-31,2007-04-29,2007-04-30,2007-05-29,2007-05-30,2007-05-31,2007-06-29,2007-06-30,2007-07-29,2007-07-30,2007-07-31,2007-08-29,2007-08-30,2007-08-31,2007-09-29,2007-09-30,2007-10-29,2007-10-30,2007-10-31,2007-11-29,2007-11-30,2007-12-29,2007-12-30,2007-12-31,2008-02-28,2008-02-29,2008-03-01
2
+ 2007-01-01,,27,28,29,30,29,57,88,89,90,118,119,148,149,150,178,179,208,209,210,238,239,240,268,269,298,299,300,328,329,358,359,360,417,418,420
3
+ 2007-01-28,-27,,1,2,3,2,30,61,62,63,91,92,121,122,123,151,152,181,182,183,211,212,213,241,242,271,272,273,301,302,331,332,333,390,391,393
4
+ 2007-01-29,-28,-1,,1,2,1,29,60,61,62,90,91,120,121,122,150,151,180,181,182,210,211,212,240,241,270,271,272,300,301,330,331,332,389,390,392
5
+ 2007-01-30,-29,-2,-1,,,,28,59,60,60,89,90,119,120,120,149,150,179,180,180,209,210,210,239,240,269,270,270,299,300,329,330,330,388,389,391
6
+ 2007-01-31,-29,-2,-1,,,,28,59,60,60,89,90,119,120,120,149,150,179,180,180,209,210,210,239,240,269,270,270,299,300,329,330,330,388,389,391
7
+ 2007-01-30,-29,-2,-1,,,,28,59,60,60,89,90,119,120,120,149,150,179,180,180,209,210,210,239,240,269,270,270,299,300,329,330,330,388,389,391
8
+ 2007-02-28,-59,-32,-31,-30,-30,-30,-2,29,30,30,59,60,89,90,90,119,120,149,150,150,179,180,180,209,210,239,240,240,269,270,299,300,300,358,359,361
9
+ 2007-03-29,-88,-61,-60,-59,-58,-59,-31,,1,2,30,31,60,61,62,90,91,120,121,122,150,151,152,180,181,210,211,212,240,241,270,271,272,329,330,332
10
+ 2007-03-30,-89,-62,-61,-60,-60,-60,-32,-1,,,29,30,59,60,60,89,90,119,120,120,149,150,150,179,180,209,210,210,239,240,269,270,270,328,329,331
11
+ 2007-03-31,-89,-62,-61,-60,-60,-60,-32,-1,,,29,30,59,60,60,89,90,119,120,120,149,150,150,179,180,209,210,210,239,240,269,270,270,328,329,331
12
+ 2007-04-29,-118,-91,-90,-89,-88,-89,-61,-30,-29,-28,,1,30,31,32,60,61,90,91,92,120,121,122,150,151,180,181,182,210,211,240,241,242,299,300,302
13
+ 2007-04-30,-119,-92,-91,-90,-90,-90,-62,-31,-30,-30,-1,,29,30,30,59,60,89,90,90,119,120,120,149,150,179,180,180,209,210,239,240,240,298,299,301
14
+ 2007-05-29,-148,-121,-120,-119,-118,-119,-91,-60,-59,-58,-30,-29,,1,2,30,31,60,61,62,90,91,92,120,121,150,151,152,180,181,210,211,212,269,270,272
15
+ 2007-05-30,-149,-122,-121,-120,-120,-120,-92,-61,-60,-60,-31,-30,-1,,,29,30,59,60,60,89,90,90,119,120,149,150,150,179,180,209,210,210,268,269,271
16
+ 2007-05-31,-149,-122,-121,-120,-120,-120,-92,-61,-60,-60,-31,-30,-1,,,29,30,59,60,60,89,90,90,119,120,149,150,150,179,180,209,210,210,268,269,271
17
+ 2007-06-29,-178,-151,-150,-149,-148,-149,-121,-90,-89,-88,-60,-59,-30,-29,-28,,1,30,31,32,60,61,62,90,91,120,121,122,150,151,180,181,182,239,240,242
18
+ 2007-06-30,-179,-152,-151,-150,-150,-150,-122,-91,-90,-90,-61,-60,-31,-30,-30,-1,,29,30,30,59,60,60,89,90,119,120,120,149,150,179,180,180,238,239,241
19
+ 2007-07-29,-208,-181,-180,-179,-178,-179,-151,-120,-119,-118,-90,-89,-60,-59,-58,-30,-29,,1,2,30,31,32,60,61,90,91,92,120,121,150,151,152,209,210,212
20
+ 2007-07-30,-209,-182,-181,-180,-180,-180,-152,-121,-120,-120,-91,-90,-61,-60,-60,-31,-30,-1,,,29,30,30,59,60,89,90,90,119,120,149,150,150,208,209,211
21
+ 2007-07-31,-209,-182,-181,-180,-180,-180,-152,-121,-120,-120,-91,-90,-61,-60,-60,-31,-30,-1,,,29,30,30,59,60,89,90,90,119,120,149,150,150,208,209,211
22
+ 2007-08-29,-238,-211,-210,-209,-208,-209,-181,-150,-149,-148,-120,-119,-90,-89,-88,-60,-59,-30,-29,-28,,1,2,30,31,60,61,62,90,91,120,121,122,179,180,182
23
+ 2007-08-30,-239,-212,-211,-210,-210,-210,-182,-151,-150,-150,-121,-120,-91,-90,-90,-61,-60,-31,-30,-30,-1,,,29,30,59,60,60,89,90,119,120,120,178,179,181
24
+ 2007-08-31,-239,-212,-211,-210,-210,-210,-182,-151,-150,-150,-121,-120,-91,-90,-90,-61,-60,-31,-30,-30,-1,,,29,30,59,60,60,89,90,119,120,120,178,179,181
25
+ 2007-09-29,-268,-241,-240,-239,-238,-239,-211,-180,-179,-178,-150,-149,-120,-119,-118,-90,-89,-60,-59,-58,-30,-29,-28,,1,30,31,32,60,61,90,91,92,149,150,152
26
+ 2007-09-30,-269,-242,-241,-240,-240,-240,-212,-181,-180,-180,-151,-150,-121,-120,-120,-91,-90,-61,-60,-60,-31,-30,-30,-1,,29,30,30,59,60,89,90,90,148,149,151
27
+ 2007-10-29,-298,-271,-270,-269,-268,-269,-241,-210,-209,-208,-180,-179,-150,-149,-148,-120,-119,-90,-89,-88,-60,-59,-58,-30,-29,,1,2,30,31,60,61,62,119,120,122
28
+ 2007-10-30,-299,-272,-271,-270,-270,-270,-242,-211,-210,-210,-181,-180,-151,-150,-150,-121,-120,-91,-90,-90,-61,-60,-60,-31,-30,-1,,,29,30,59,60,60,118,119,121
29
+ 2007-10-31,-299,-272,-271,-270,-270,-270,-242,-211,-210,-210,-181,-180,-151,-150,-150,-121,-120,-91,-90,-90,-61,-60,-60,-31,-30,-1,,,29,30,59,60,60,118,119,121
30
+ 2007-11-29,-328,-301,-300,-299,-298,-299,-271,-240,-239,-238,-210,-209,-180,-179,-178,-150,-149,-120,-119,-118,-90,-89,-88,-60,-59,-30,-29,-28,,1,30,31,32,89,90,92
31
+ 2007-11-30,-329,-302,-301,-300,-300,-300,-272,-241,-240,-240,-211,-210,-181,-180,-180,-151,-150,-121,-120,-120,-91,-90,-90,-61,-60,-31,-30,-30,-1,,29,30,30,88,89,91
32
+ 2007-12-29,-358,-331,-330,-329,-328,-329,-301,-270,-269,-268,-240,-239,-210,-209,-208,-180,-179,-150,-149,-148,-120,-119,-118,-90,-89,-60,-59,-58,-30,-29,,1,2,59,60,62
33
+ 2007-12-30,-359,-332,-331,-330,-330,-330,-302,-271,-270,-270,-241,-240,-211,-210,-210,-181,-180,-151,-150,-150,-121,-120,-120,-91,-90,-61,-60,-60,-31,-30,-1,,,58,59,61
34
+ 2007-12-31,-359,-332,-331,-330,-330,-330,-302,-271,-270,-270,-241,-240,-211,-210,-210,-181,-180,-151,-150,-150,-121,-120,-120,-91,-90,-61,-60,-60,-31,-30,-1,,,58,59,61
35
+ 2008-02-28,-417,-390,-389,-388,-387,-388,-360,-329,-328,-327,-299,-298,-269,-268,-267,-239,-238,-209,-208,-207,-179,-178,-177,-149,-148,-119,-118,-117,-89,-88,-59,-58,-57,,1,3
36
+ 2008-02-29,-419,-392,-391,-390,-390,-390,-362,-331,-330,-330,-301,-300,-271,-270,-270,-241,-240,-211,-210,-210,-181,-180,-180,-151,-150,-121,-120,-120,-91,-90,-61,-60,-60,-2,-1,1
37
+ 2008-03-01,-420,-393,-392,-391,-390,-391,-363,-332,-331,-330,-302,-301,-272,-271,-270,-242,-241,-212,-211,-210,-182,-181,-180,-152,-151,-122,-121,-120,-92,-91,-62,-61,-60,-3,-2,
@@ -0,0 +1,70 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
+ require 'date'
3
+
4
+ class Days360Test < Test::Unit::TestCase
5
+ include Days360
6
+
7
+ test "last_day_of_february should tell if it is the last day of february" do
8
+ assert_equal false, send(:last_day_of_february?, Date.parse("20012-01-01"))
9
+ assert_equal false, send(:last_day_of_february?, Date.parse("20012-02-10"))
10
+ assert_equal false, send(:last_day_of_february?, Date.parse("20012-02-28"))
11
+ assert_equal true, send(:last_day_of_february?, Date.parse("20012-02-29"))
12
+ assert_equal true, send(:last_day_of_february?, Date.parse("2007-02-28"))
13
+ assert_equal false, send(:last_day_of_february?, Date.parse("20012-01-31"))
14
+ end
15
+
16
+ test "some more calculations" do
17
+ #From http://zinsmethoden.de/#
18
+ date_a = Date.parse('18.11.2003')
19
+ date_b = Date.parse('18.03.2004')
20
+ assert_equal 120, days360_EU(date_a, date_b), "Deutsche (kaufmaennische) Zinsmethode"
21
+ end
22
+
23
+ test "days360 should calculate the correct number of days" do
24
+ assert_equal days360_US(Date.parse('2012-01-23'), Date.parse('2012-12-31')), 338
25
+ assert_equal days360_US(Date.parse('2012-03-19'), Date.parse('2012-12-31')), 282
26
+ assert_equal days360_US(Date.parse('2012-01-01'), Date.parse('2012-12-31')), 360
27
+ end
28
+
29
+
30
+ test "days360_US should give same result as Open Office Calc" do
31
+ reference_results = read_csv_file_from_data_dir('calc_DAYS360_US.csv')
32
+ result = compare_gem_to_reference(:US, reference_results)
33
+
34
+ assert_equal 36*36, result[:comparisons], "We expect the same number of comparisons as put into the test data"
35
+ assert result[:differences].eql?(0), "The method should calculate the same results as given by reference implementations"
36
+ end
37
+
38
+ test "days360_US should give same result as Microsoft Office Excel" do
39
+ reference_results = read_csv_file_from_data_dir('excel_DAYS360_US.csv')
40
+ result = compare_gem_to_reference(:US, reference_results)
41
+
42
+ assert_equal 36*36, result[:comparisons], "We expect the same number of comparisons as put into the test data"
43
+ assert result[:differences].eql?(0), "The method should calculate the same results as given by reference implementations"
44
+ end
45
+
46
+ test "days360_US without excel compatibility should give same result as NASD reference" do
47
+ reference_results = read_csv_file_from_data_dir('NASD_reference_DAYS360_US.csv')
48
+ result = compare_gem_to_reference(:US_NASD, reference_results)
49
+
50
+ assert_equal 36*36, result[:comparisons], "We expect the same number of comparisons as put into the test data"
51
+ assert result[:differences].eql?(0), "The method should calculate the same results as given by reference implementations"
52
+ end
53
+
54
+ test "days360_EU should give same result as Open Office Calc" do
55
+ reference_results = read_csv_file_from_data_dir('calc_DAYS360_EU.csv')
56
+ result = compare_gem_to_reference(:EU, reference_results)
57
+
58
+ assert_equal 36*36, result[:comparisons], "We expect the same number of comparisons as put into the test data"
59
+ assert result[:differences].eql?(0), "The method should calculate the same results as given by reference implementations"
60
+ end
61
+
62
+ test "days360_EU should give same result as Microsoft Office Excel" do
63
+ reference_results = read_csv_file_from_data_dir('excel_DAYS360_EU.csv')
64
+ result = compare_gem_to_reference(:EU, reference_results)
65
+
66
+ assert_equal 36*36, result[:comparisons], "We expect the same number of comparisons as put into the test data"
67
+ assert result[:differences].eql?(0), "The method should calculate the same results as given by reference implementations"
68
+ end
69
+
70
+ end
@@ -0,0 +1,42 @@
1
+ require 'test-unit'
2
+ require 'csv'
3
+ require File.expand_path('../../lib/days360.rb', __FILE__)
4
+
5
+
6
+ def read_csv_file_from_data_dir(file)
7
+ file = File.expand_path("../data/#{file}", __FILE__)
8
+ reference_calculations = CSV.read file
9
+ reference_calculations
10
+ end
11
+
12
+ # The reference result contains a 36x36 date vector and the results calculated by different office suites / methods
13
+ # Dates should be ISO-formatted as seen below
14
+ # | 2007-01-01 | 2007-01-28
15
+ # 2007-01-01 | 0 | 27
16
+ # 2007-01-28 | -27 | 0
17
+ # 2007-01-29 | -28 | -1
18
+ def compare_gem_to_reference(calculation_method, reference_results)
19
+ top_dates = reference_results.first.map{|date| Date.parse(date) if date}
20
+ left_dates = reference_results.map{|line| Date.parse(line[0]) if line[0]}
21
+
22
+ differences = same_result = 0
23
+
24
+ top_dates.each_with_index do |top_date, top_index|
25
+ next if top_index == 0
26
+ left_dates.each_with_index do |left_date, left_index|
27
+ next if left_index == 0
28
+ gem_result = days360(left_date, top_date, calculation_method)
29
+ reference_result = reference_results[left_index][top_index].to_i
30
+ equal = reference_result.eql?(gem_result)
31
+
32
+ same_result += 1 if equal
33
+ differences += 1 if not equal
34
+ puts "For DAYS360( #{left_date}, #{top_date} ) the result should be #{reference_result} instead of #{gem_result}." if not equal
35
+
36
+ end
37
+ end
38
+
39
+ p "Compared #{differences + same_result} date combinations to reference results using #{calculation_method} and found #{differences} differences"
40
+
41
+ return {:comparisons => (differences + same_result), :differences => differences}
42
+ end
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: days360
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.1
5
+ platform: ruby
6
+ authors:
7
+ - Michael Prilop
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-06-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: test-unit
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Calculates the difference between two dates based on the 360 day year
56
+ used in interest calculations
57
+ email:
58
+ - Michael.Prilop@gmail.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - .gitignore
64
+ - .travis.yml
65
+ - Gemfile
66
+ - LICENSE.txt
67
+ - README.md
68
+ - Rakefile
69
+ - days360.gemspec
70
+ - lib/days360.rb
71
+ - lib/days360/version.rb
72
+ - test/data/NASD_reference_DAYS360_US.csv
73
+ - test/data/README
74
+ - test/data/calc_DAYS360_EU.csv
75
+ - test/data/calc_DAYS360_US.csv
76
+ - test/data/excel_DAYS360_EU.csv
77
+ - test/data/excel_DAYS360_US.csv
78
+ - test/days360_test.rb
79
+ - test/test_helper.rb
80
+ homepage: https://github.com/tamaloa/days360
81
+ licenses:
82
+ - MIT
83
+ metadata: {}
84
+ post_install_message:
85
+ rdoc_options: []
86
+ require_paths:
87
+ - lib
88
+ required_ruby_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ! '>='
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ! '>='
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ requirements: []
99
+ rubyforge_project:
100
+ rubygems_version: 2.0.3
101
+ signing_key:
102
+ 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.
105
+ test_files:
106
+ - test/data/NASD_reference_DAYS360_US.csv
107
+ - test/data/README
108
+ - test/data/calc_DAYS360_EU.csv
109
+ - test/data/calc_DAYS360_US.csv
110
+ - test/data/excel_DAYS360_EU.csv
111
+ - test/data/excel_DAYS360_US.csv
112
+ - test/days360_test.rb
113
+ - test/test_helper.rb