rupee 0.2.6 → 0.2.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rupee/day_count.rb +2 -2
- data/lib/rupee/{custom.rb → fixed_income.rb} +9 -8
- data/lib/rupee/version.rb +1 -1
- data/lib/rupee.rb +1 -1
- data/spec/ruby/fixed_income_spec.rb +7 -0
- metadata +10 -8
data/lib/rupee/day_count.rb
CHANGED
@@ -4,8 +4,6 @@ module Rupee
|
|
4
4
|
# A class representing a day count convention used to determine cash flow
|
5
5
|
# and accrual dates for fixed income products
|
6
6
|
class DayCount
|
7
|
-
include FindInstance
|
8
|
-
|
9
7
|
autoload :THIRTY_360, "rupee/day_count/30_360"
|
10
8
|
autoload :THIRTY_E_360, "rupee/day_count/30e_360"
|
11
9
|
autoload :THIRTY_E_360_ISDA, "rupee/day_count/30e_360_isda"
|
@@ -30,6 +28,8 @@ module Rupee
|
|
30
28
|
end
|
31
29
|
|
32
30
|
class << self
|
31
|
+
include FindInstance
|
32
|
+
|
33
33
|
# The number of seconds in a day (a difference of <tt>1</tt> between two
|
34
34
|
# dates in Ruby indicates a difference of one second)
|
35
35
|
SECONDS_PER_DAY = 86_400.0
|
@@ -1,10 +1,8 @@
|
|
1
1
|
module Rupee
|
2
|
-
#
|
3
|
-
#
|
4
|
-
# A custom security that allows the user to specify cash flows, discount
|
5
|
-
# curves, payout curves, calendars, currencies, daycounts, roll day
|
2
|
+
# A basic fixed income security that allows the user to specify cash flows,
|
3
|
+
# discount curves, payout curves, calendars, currencies, daycounts, roll day
|
6
4
|
# conventions, etc.
|
7
|
-
class
|
5
|
+
class FixedIncome < Security
|
8
6
|
# The security's business day convention
|
9
7
|
attr :business_day
|
10
8
|
# The calendar used for determining holidays
|
@@ -49,13 +47,16 @@ module Rupee
|
|
49
47
|
# * <tt>:act_365</tt> - Act/365
|
50
48
|
# * <tt>:act_act</tt> - Act/Act
|
51
49
|
#
|
50
|
+
# For example, the following security types can be created (although not
|
51
|
+
# currently priced or anything useful like that):
|
52
|
+
#
|
52
53
|
# require "rupee"
|
53
54
|
#
|
54
55
|
# # A typical pay-fixed bond
|
55
|
-
# bond = Rupee::
|
56
|
+
# bond = Rupee::FixedIncome.new
|
56
57
|
#
|
57
58
|
# # A typical yen LIBOR security
|
58
|
-
# bond = Rupee::
|
59
|
+
# bond = Rupee::FixedIncome.new :calendar => :japan, :currency => :yen,
|
59
60
|
# :day_count => :act_365
|
60
61
|
def initialize(opts = {})
|
61
62
|
opts = {
|
@@ -75,7 +76,7 @@ module Rupee
|
|
75
76
|
@business_day = BusinessDay.find(business_day)
|
76
77
|
end
|
77
78
|
|
78
|
-
def calendar=(calendar)
|
79
|
+
def calendar=(calendar) # :nodoc:
|
79
80
|
@calendar = Calendar.find(calendar)
|
80
81
|
end
|
81
82
|
|
data/lib/rupee/version.rb
CHANGED
data/lib/rupee.rb
CHANGED
@@ -21,7 +21,7 @@ module Rupee
|
|
21
21
|
autoload :Benchmark, "rupee/benchmark"
|
22
22
|
autoload :BusinessDay, "rupee/business_day"
|
23
23
|
autoload :Calendar, "rupee/calendar"
|
24
|
-
autoload :
|
24
|
+
autoload :FixedIncome, "rupee/fixed_income"
|
25
25
|
autoload :Call, "rupee/option"
|
26
26
|
autoload :Currency, "rupee/currency"
|
27
27
|
autoload :DayCount, "rupee/day_count"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rupee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.6
|
4
|
+
version: 0.2.6.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-10-03 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
16
|
-
requirement: &
|
16
|
+
requirement: &82312150 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '1.0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *82312150
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &82311900 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '2.0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *82311900
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: sdoc
|
38
|
-
requirement: &
|
38
|
+
requirement: &82311670 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0.3'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *82311670
|
47
47
|
description: ! " rupee aims to provide user-friendly tools for
|
48
48
|
use in\n financial gems and applications.\n"
|
49
49
|
email:
|
@@ -83,7 +83,6 @@ files:
|
|
83
83
|
- lib/rupee/currency/gbp.rb
|
84
84
|
- lib/rupee/currency/jpy.rb
|
85
85
|
- lib/rupee/currency/usd.rb
|
86
|
-
- lib/rupee/custom.rb
|
87
86
|
- lib/rupee/day_count.rb
|
88
87
|
- lib/rupee/day_count/30_360.rb
|
89
88
|
- lib/rupee/day_count/30e+_360.rb
|
@@ -92,6 +91,7 @@ files:
|
|
92
91
|
- lib/rupee/day_count/act_360.rb
|
93
92
|
- lib/rupee/day_count/act_365.rb
|
94
93
|
- lib/rupee/day_count/act_act.rb
|
94
|
+
- lib/rupee/fixed_income.rb
|
95
95
|
- lib/rupee/mixins/find_instance.rb
|
96
96
|
- lib/rupee/option.rb
|
97
97
|
- lib/rupee/quote.rb
|
@@ -111,6 +111,7 @@ files:
|
|
111
111
|
- spec/ruby/calendar_spec.rb
|
112
112
|
- spec/ruby/currency_spec.rb
|
113
113
|
- spec/ruby/day_count_spec.rb
|
114
|
+
- spec/ruby/fixed_income_spec.rb
|
114
115
|
- spec/ruby/generic_spec.rb
|
115
116
|
- spec/ruby/quote_spec.rb
|
116
117
|
- spec/ruby/source_spec.rb
|
@@ -151,6 +152,7 @@ test_files:
|
|
151
152
|
- spec/ruby/calendar_spec.rb
|
152
153
|
- spec/ruby/currency_spec.rb
|
153
154
|
- spec/ruby/day_count_spec.rb
|
155
|
+
- spec/ruby/fixed_income_spec.rb
|
154
156
|
- spec/ruby/generic_spec.rb
|
155
157
|
- spec/ruby/quote_spec.rb
|
156
158
|
- spec/ruby/source_spec.rb
|