istox 0.2.3.pre.2 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d1176bd57c3e5f7c3cf169446b6aec6c51d101fe1db516fa33a492319bcfd1f
4
- data.tar.gz: e6a8027c9e9f1ab224af5643209bb78165fd3686d384561a3cde9ae441fe40d7
3
+ metadata.gz: 7c8ef7c4357c0feca79a70611b469e24cec0239348762ef2ae4041228814588f
4
+ data.tar.gz: 57135bd1d76bf06b4fb353974f64e79bb62f930d82f1409fe6a944248b5e9d32
5
5
  SHA512:
6
- metadata.gz: 00f2d9c5ed2399e76cab9b940f733e862eae42b79e4de1a7bec5ba301d1240ae95d9487d6a6b68163625da306b69620f2dd926e3ba7a3b67d65a5ad2415a315c
7
- data.tar.gz: 742bd4f7b1bccc45dbf031704b1476d68fa52fc9ce68bb1d8445345d177911f9033c0d00807f9408a1cbe5b8a3ca080d529ad9b050ef76a9aeb0658682017c1a
6
+ metadata.gz: 01bbd03ee866809524a96872e87021dc0ddbfbee1c67eeda8e5cfd7a213cd9d81d4995084dcf7f6fa7e8f5ffab1e425396d3d6e4ca2228f9739b609e9bc316fa
7
+ data.tar.gz: 1a777141736244615a2470bd389382441e435db52c6496bae8ecf92ccb669afb7ef5450409bff9d061b287ca779ab3fb94c84b6615cb9d63dc75a2673ae81ca0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- istox (0.2.3.pre.2)
4
+ istox (0.2.3.pre.1)
5
5
  amazing_print
6
6
  awesome_print
7
7
  aws-sdk-sns (~> 1)
@@ -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? || ex_coupon_date == @maturity_date
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? || ex_coupon_date == @maturity_date
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
@@ -1,3 +1,3 @@
1
1
  module Istox
2
- VERSION = '0.2.3-2'.freeze
2
+ VERSION = '0.2.5'.freeze
3
3
  end
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.3.pre.2
4
+ version: 0.2.5
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-03-30 00:00:00.000000000 Z
11
+ date: 2021-04-12 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: 1.3.1
547
+ version: '0'
548
548
  requirements: []
549
549
  rubygems_version: 3.0.6
550
550
  signing_key: