istox 0.2.3.pre.1 → 0.2.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/istox/helpers/messaging.rb +1 -4
- data/lib/istox/quant/bond.rb +9 -2
- data/lib/istox/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7966045ae225d89f6881853faebfc2b9ac826053964d27f1d79a1870be301da
|
4
|
+
data.tar.gz: ddaf8c7cfcbf15d62d7d5ec739593c2b1f5b93e80d502c852a14c852941b03a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c207054f717f60a2eadc3dab9cd39954e58e2c37748ab18df87ec687516e9b68f2abf44176405028fee8872e61e8a808271e41bbda63d63ca54a1959ff56c37
|
7
|
+
data.tar.gz: eb784318e41850201bd1bfbac812d7d153959141385cb9e01fe7071948e648e46b6fd240e912bd62670b7de9ea6f1eca6a5be75e7731a6ba2cdfede8e7a8b13b
|
@@ -93,7 +93,6 @@ module Istox
|
|
93
93
|
# sample template data, it should be an array
|
94
94
|
# [{
|
95
95
|
# email: email,
|
96
|
-
# sid: xxxxx,
|
97
96
|
# istoxP1: auth.first_name,
|
98
97
|
# <more other sample template attributes>: <other sample template data>,
|
99
98
|
# }]
|
@@ -138,8 +137,7 @@ module Istox
|
|
138
137
|
else
|
139
138
|
# if it is a object hash
|
140
139
|
# {
|
141
|
-
# email: xxxx
|
142
|
-
# sid: xxxx,
|
140
|
+
# email: xxxx
|
143
141
|
# params: {
|
144
142
|
# istoxP1: xxxx,
|
145
143
|
# istoxP2: xxxx
|
@@ -148,7 +146,6 @@ module Istox
|
|
148
146
|
next unless ce[:email].present?
|
149
147
|
|
150
148
|
copy_email_data[:email] = ce[:email]
|
151
|
-
copy_email_data[:sid] = ce[:sid]
|
152
149
|
copy_email_data = copy_email_data.merge(ce[:params])
|
153
150
|
end
|
154
151
|
|
data/lib/istox/quant/bond.rb
CHANGED
@@ -73,6 +73,11 @@ module Istox
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def ytm(date, ex_coupon_date: nil, price: 100, fees: 0, approximation_error: DEFAULT_APPROXIMATION_ERROR)
|
76
|
+
if !is_zero_coupon? && price == @face_value && date <= @start_date
|
77
|
+
# for non zero coupon bond, if price is face value and date is at or before start date
|
78
|
+
# YTM is simply the coupon rate
|
79
|
+
return @coupon
|
80
|
+
end
|
76
81
|
ytm_down, ytm_up = ytm_limits(price, date, ex_coupon_date: ex_coupon_date, fees: fees)
|
77
82
|
approximate_ytm(ytm_down, ytm_up, price, date, ex_coupon_date: ex_coupon_date, fees: fees, approximation_error: approximation_error)
|
78
83
|
end
|
@@ -185,7 +190,7 @@ module Istox
|
|
185
190
|
if @pay_accrued_interest
|
186
191
|
# accrued interest + face value discounted to the current date
|
187
192
|
discounted_accrued_interest = 0
|
188
|
-
if ex_coupon_date.nil? ||
|
193
|
+
if ex_coupon_date.nil? || date < ex_coupon_date
|
189
194
|
discounted_accrued_interest = @coupon*@face_value*accrued_interest_factor*discount_factor
|
190
195
|
end
|
191
196
|
discounted_face_value = @face_value*discount_factor
|
@@ -193,7 +198,7 @@ module Istox
|
|
193
198
|
return price
|
194
199
|
else
|
195
200
|
discounted_last_coupon = 0
|
196
|
-
if ex_coupon_date.nil? ||
|
201
|
+
if ex_coupon_date.nil? || date < ex_coupon_date
|
197
202
|
discounted_last_coupon = @coupon*@face_value/@coupon_frequency*discount_factor
|
198
203
|
end
|
199
204
|
discounted_face_value = @face_value*discount_factor
|
@@ -292,6 +297,8 @@ module Istox
|
|
292
297
|
previous_coupon_date = @coupon_payment_dates.last
|
293
298
|
end
|
294
299
|
end
|
300
|
+
|
301
|
+
return previous_coupon_date
|
295
302
|
end
|
296
303
|
|
297
304
|
def first_coupon_factor
|
data/lib/istox/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: istox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Siong Leng
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: amazing_print
|
@@ -542,9 +542,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
542
542
|
version: '0'
|
543
543
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
544
544
|
requirements:
|
545
|
-
- - "
|
545
|
+
- - ">="
|
546
546
|
- !ruby/object:Gem::Version
|
547
|
-
version:
|
547
|
+
version: '0'
|
548
548
|
requirements: []
|
549
549
|
rubygems_version: 3.0.6
|
550
550
|
signing_key:
|