istox 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/istox/quant/bond.rb +7 -0
- data/lib/istox/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5d4f2a0587825e06d3ff6a6a3ad516f20b90f1ca7e59e11d686b03c892b8c441
|
|
4
|
+
data.tar.gz: 3b6f8c0f67615b5165f9030343e0713f2b4562109632f93306ebb6a412d87aeb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6fb65f68fed5082be9d4b8ecd73547a06cc77224baf3e57296974768351127c0d39dc51d063c7855d38921bb7ca4925a1edd36eb097747ceb7da83bd1568379f
|
|
7
|
+
data.tar.gz: 0be64c5925913cd5fad7242bc0604bf2f553f3d69a5969c1d3165571967d570d8cd2380d8b57b9e15b1af230b2c2f8a516c0bdd59ce59b9a8f9688d948b7406c
|
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
|
|
@@ -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
|
|
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
|