istox 0.2.2 → 0.2.3.pre.1

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: 2518cababd563f81557ac460906f73cbae0be78c6e570170a513f3f7b690dcd1
4
- data.tar.gz: ff2dc59cac13cc28cbf01228f796e7f67631ff8220a9e167f1304527f7a73201
3
+ metadata.gz: 5794449030e0819921e5edb6cdc091dc809b00a06b49facb84a296ef31da001a
4
+ data.tar.gz: 357cf1556b389dfc212ad5521f0e674ba58053fa2a4111183574e921ddbc85b4
5
5
  SHA512:
6
- metadata.gz: 8661709ddff2d71dc54205e52ad0bf864b4707d806e57741f2b5f866acddbe66ca0df3a34a3371df80ec0c7b0b32b57f4d5d29908400ad210a6260625a0dc029
7
- data.tar.gz: 1a0bf97e6c7efb5f11dea2042069643a07b78c7c6585e9db1f3be1c71d0f80ff1f3506c437538cfd440be0421d4664b01b2194fc3dd241c26da1f2be768a466f
6
+ metadata.gz: b190f30771d9fac19c7d4df0d4c1386bb8804e12f0cd0ff81c0c29c13be3528d39d2fc23cb05546a12ca7a2ea69a1d40c65ca160e7fd28bad4d41fa4d31ce391
7
+ data.tar.gz: eebf61512d1009bd1fe584ae498fd558724f55ee24b6af868635b7294ba8eaf2c7b06bb3042150f362bee7b1e2487ea8a803dd09bdf702aa44b49fe60c7364fe
@@ -93,6 +93,7 @@ module Istox
93
93
  # sample template data, it should be an array
94
94
  # [{
95
95
  # email: email,
96
+ # sid: xxxxx,
96
97
  # istoxP1: auth.first_name,
97
98
  # <more other sample template attributes>: <other sample template data>,
98
99
  # }]
@@ -137,7 +138,8 @@ module Istox
137
138
  else
138
139
  # if it is a object hash
139
140
  # {
140
- # email: xxxx
141
+ # email: xxxx,
142
+ # sid: xxxx,
141
143
  # params: {
142
144
  # istoxP1: xxxx,
143
145
  # istoxP2: xxxx
@@ -146,6 +148,7 @@ module Istox
146
148
  next unless ce[:email].present?
147
149
 
148
150
  copy_email_data[:email] = ce[:email]
151
+ copy_email_data[:sid] = ce[:sid]
149
152
  copy_email_data = copy_email_data.merge(ce[:params])
150
153
  end
151
154
 
@@ -12,23 +12,23 @@ module Istox
12
12
 
13
13
  DEFAULT_APPROXIMATION_ERROR = 0.00001
14
14
 
15
- def initialize(coupon: nil, maturity_date: nil, years: nil, coupon_frequency: nil, coupon_payment_dates: nil, face_value: 100, days_of_year: 365)
15
+ def initialize(coupon: nil, maturity_date: nil, start_date: nil, coupon_frequency: nil, coupon_payment_dates: nil, face_value: 100, days_of_year: 365)
16
16
  raise "Invalid coupon #{coupon}" if (coupon.nil? || !is_number?(coupon)) || coupon < 0
17
17
  raise "Invalid maturity_date #{maturity_date}" if (maturity_date.nil? || maturity_date.methods.include?("strftime"))
18
- raise "Invalid years #{years}" if (years.nil? || !is_number?(years)) || years < 0
18
+ raise "Invalid start_date #{start_date}" if (start_date.nil? || start_date.methods.include?("strftime"))
19
19
  raise "Invalid coupon_frequency #{coupon_frequency}" if (coupon_frequency.nil? || !coupon_frequency.is_a?(Integer) || coupon_frequency < 0)
20
20
  raise "Invalid coupon_payment_dates #{coupon_payment_dates}" if (coupon_payment_dates.nil? || (coupon_payment_dates.count == 0 && coupon_frequency != 0) || coupon_payment_dates.any? { |date| date > maturity_date.to_date })
21
21
  raise "Invalid days_of_year #{days_of_year}" if (days_of_year != 365 && days_of_year != 360)
22
+ raise "start_date is not before maturity_date" if start_date>=maturity_date
22
23
 
23
24
  @coupon = coupon.to_d
24
25
  @maturity_date = maturity_date.to_date
25
- @years = years.to_d
26
26
  @coupon_frequency = coupon_frequency.to_i # if this is 0, it means zero coupon
27
27
  @days_of_year = days_of_year.to_d
28
28
  @face_value = face_value.to_d
29
29
  @coupon_payment_dates = coupon_payment_dates.map(&:to_date).uniq.sort
30
30
  # note here we work out the start date based on maturity date and nunber of years
31
- @start_date = (@maturity_date-(years*12).to_i.months)
31
+ @start_date = start_date.to_date
32
32
 
33
33
  @pay_accrued_interest = false
34
34
  @coupon_payment_dates_include_accrued_interest = false
@@ -62,7 +62,7 @@ module Istox
62
62
  end
63
63
  end
64
64
 
65
- log.info "Bond info: start=#{@start_date} maturity=#{@maturity_date} years=#{@years} days_of_years=#{days_of_year} coupon=#{@coupon} coupon_frequency=#{coupon_frequency} face_value=#{@face_value} coupon_payment_dates=#{@coupon_payment_dates} pay_accrued_interest=#{@pay_accrued_interest} coupon_payment_dates_include_accrued_interest=#{@coupon_payment_dates_include_accrued_interest}"
65
+ log.info "Bond info: start_date=#{@start_date} maturity_date=#{@maturity_date} days_of_years=#{days_of_year} coupon=#{@coupon} coupon_frequency=#{coupon_frequency} face_value=#{@face_value} coupon_payment_dates=#{@coupon_payment_dates} pay_accrued_interest=#{@pay_accrued_interest} coupon_payment_dates_include_accrued_interest=#{@coupon_payment_dates_include_accrued_interest}"
66
66
  end
67
67
 
68
68
  def price(ytm, date, ex_coupon_date: nil, fees: 0)
data/lib/istox/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Istox
2
- VERSION = '0.2.2'.freeze
2
+ VERSION = '0.2.3-1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: istox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Siong Leng
@@ -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: '0'
547
+ version: 1.3.1
548
548
  requirements: []
549
549
  rubygems_version: 3.0.6
550
550
  signing_key: