istox 0.2.3 → 0.2.6.pre.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3aa5c0d11cb873cfd398db44b8f4a139baf6668bf04f578db3091cb049b7d89f
4
- data.tar.gz: '02109c5b9c3cb01c288d757cef841357f79cc36186d4245f624a619dbb984489'
3
+ metadata.gz: e8961398a3a359f60a4df90adea1f6d1578cafde68a8be2cf496afba08fc069d
4
+ data.tar.gz: ab96f1d839238cb29019adf29137823ea670b23c23b0d86201da08cecc80dacc
5
5
  SHA512:
6
- metadata.gz: bdfe781debfdb6c49ab24140562b55bff2e919090fb6e46c71b6e6dfecbb9607843379e0ac97e58edc26a0426527839494294bcb94703d80fc7a0102b244333a
7
- data.tar.gz: 88b913cbd976f4d85e2e7a140e7fd3747dd42a5c8da83b2135796b20d3121619ed54b8a1f2040179aafd13ee03cae5646fd4c6634258854e2bfb522681dc649f
6
+ metadata.gz: 1b4e009fad77eaa93910e5ffdc43888bbb3aa11da46caa3855736acaebaf548db141a7b0a8d0b48002ea6ddbe355bea69e5fbfffa29e19b53f8ddfbdbeff8a66
7
+ data.tar.gz: 275a41eb82bd672f0a376a099a6d64670bd336215c46be6384f6f32f7d528975c3af301af8ec588343dcdc1531f5d80a3d351572215761134e2c403eb00a7723
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- istox (0.1.157.9)
4
+ istox (0.2.6.pre.0)
5
5
  amazing_print
6
6
  awesome_print
7
7
  aws-sdk-sns (~> 1)
@@ -64,7 +64,7 @@ GEM
64
64
  i18n (>= 0.7, < 2)
65
65
  minitest (~> 5.1)
66
66
  tzinfo (~> 1.1)
67
- amazing_print (1.2.1)
67
+ amazing_print (1.3.0)
68
68
  amq-protocol (2.3.2)
69
69
  arel (9.0.0)
70
70
  awesome_print (1.8.0)
@@ -86,7 +86,7 @@ GEM
86
86
  aws-xray-sdk (0.11.4)
87
87
  aws-sdk-xray (~> 1.4.0)
88
88
  multi_json (~> 1)
89
- binding_of_caller (0.8.0)
89
+ binding_of_caller (1.0.0)
90
90
  debug_inspector (>= 0.0.1)
91
91
  builder (3.2.4)
92
92
  bullet (5.7.6)
@@ -99,8 +99,9 @@ GEM
99
99
  concurrent-ruby (1.1.6)
100
100
  crass (1.0.6)
101
101
  database_cleaner (1.6.2)
102
- debug_inspector (0.0.3)
102
+ debug_inspector (1.1.0)
103
103
  diff-lcs (1.3)
104
+ e2mmap (0.1.0)
104
105
  erubi (1.9.0)
105
106
  exponential-backoff (0.0.4)
106
107
  factory_bot (4.8.2)
@@ -112,21 +113,24 @@ GEM
112
113
  i18n (~> 0.5)
113
114
  fakeredis (0.7.0)
114
115
  redis (>= 3.2, < 5.0)
115
- faraday (1.0.1)
116
+ faraday (1.3.0)
117
+ faraday-net_http (~> 1.0)
116
118
  multipart-post (>= 1.2, < 3)
119
+ ruby2_keywords
120
+ faraday-net_http (1.0.1)
117
121
  faraday_middleware (1.0.0)
118
122
  faraday (~> 1.0)
119
- ffi (1.13.1)
123
+ ffi (1.15.0)
120
124
  globalid (0.4.2)
121
125
  activesupport (>= 4.2.0)
122
126
  google-protobuf (3.13.0-universal-darwin)
123
127
  googleapis-common-protos-types (1.0.5)
124
128
  google-protobuf (~> 3.11)
125
- graphlient (0.4.0)
129
+ graphlient (0.5.0)
126
130
  faraday (>= 1.0)
127
131
  faraday_middleware
128
132
  graphql-client
129
- graphql (1.11.4)
133
+ graphql (1.11.5)
130
134
  graphql-client (0.16.0)
131
135
  activesupport (>= 3.0)
132
136
  graphql (~> 1.8)
@@ -134,12 +138,15 @@ GEM
134
138
  google-protobuf (~> 3.13)
135
139
  googleapis-common-protos-types (~> 1.0)
136
140
  grpc-tools (1.32.0)
137
- gruf (2.8.1)
141
+ gruf (2.9.1)
138
142
  activesupport (> 4)
139
143
  concurrent-ruby (> 1)
144
+ e2mmap (~> 0.1)
140
145
  grpc (~> 1.10)
141
146
  grpc-tools (~> 1.10)
147
+ json (>= 2.3)
142
148
  slop (~> 4.6)
149
+ thwait (~> 0.1)
143
150
  hashie (3.5.7)
144
151
  i18n (0.9.5)
145
152
  concurrent-ruby (~> 1.0)
@@ -150,6 +157,7 @@ GEM
150
157
  grpc-tools (~> 1.10)
151
158
  slop (~> 4.6)
152
159
  jmespath (1.4.0)
160
+ json (2.3.1)
153
161
  listen (3.0.8)
154
162
  rb-fsevent (~> 0.9, >= 0.9.4)
155
163
  rb-inotify (~> 0.9, >= 0.9.7)
@@ -173,8 +181,8 @@ GEM
173
181
  oj (3.10.14)
174
182
  ougai (1.8.5)
175
183
  oj (~> 3.10)
176
- paranoia (2.4.2)
177
- activerecord (>= 4.0, < 6.1)
184
+ paranoia (2.4.3)
185
+ activerecord (>= 4.0, < 6.2)
178
186
  pry (0.12.2)
179
187
  coderay (~> 1.1.0)
180
188
  method_source (~> 0.9.0)
@@ -254,6 +262,7 @@ GEM
254
262
  rspec-mocks (~> 3.8.0)
255
263
  rspec-support (~> 3.8.0)
256
264
  rspec-support (3.8.0)
265
+ ruby2_keywords (0.0.2)
257
266
  slop (4.8.2)
258
267
  sprockets (3.7.2)
259
268
  concurrent-ruby (~> 1.0)
@@ -265,11 +274,13 @@ GEM
265
274
  sqlite3 (1.3.13)
266
275
  thor (0.20.3)
267
276
  thread_safe (0.3.6)
277
+ thwait (0.2.0)
278
+ e2mmap
268
279
  timecop (0.9.1)
269
280
  tzinfo (1.2.6)
270
281
  thread_safe (~> 0.1)
271
282
  uniform_notifier (1.11.0)
272
- vault (0.15.0)
283
+ vault (0.16.0)
273
284
  aws-sigv4
274
285
  websocket-driver (0.7.0)
275
286
  websocket-extensions (>= 0.1.0)
@@ -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,7 +148,8 @@ module Istox
146
148
  next unless ce[:email].present?
147
149
 
148
150
  copy_email_data[:email] = ce[:email]
149
- copy_email_data = copy_email_data.merge(ce[:params])
151
+ copy_email_data[:sid] = ce[:sid]
152
+ copy_email_data = copy_email_data.merge(ce[:params]) if ce[:params].present?
150
153
  end
151
154
 
152
155
  copy_email_data.delete(:copy_emails)
@@ -16,6 +16,14 @@ module Istox
16
16
  db: 6
17
17
  ))
18
18
  end
19
+
20
+ # for general redis cache
21
+ def redis
22
+ @redis ||= Redis::Namespace.new(:redis_cache, redis: Redis.new(
23
+ url: ENV['REDIS_URL'] || 'redis://127.0.0.1:16379',
24
+ db: 6
25
+ ))
26
+ end
19
27
  end
20
28
  end
21
29
  end
@@ -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'.freeze
2
+ VERSION = '0.2.6-0'.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
4
+ version: 0.2.6.pre.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Siong Leng
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-30 00:00:00.000000000 Z
11
+ date: 2021-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: amazing_print
@@ -531,7 +531,7 @@ files:
531
531
  homepage: http://www.abc.com
532
532
  licenses: []
533
533
  metadata: {}
534
- post_install_message:
534
+ post_install_message:
535
535
  rdoc_options: []
536
536
  require_paths:
537
537
  - lib
@@ -542,12 +542,12 @@ 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
- rubygems_version: 3.0.6
550
- signing_key:
549
+ rubygems_version: 3.0.8
550
+ signing_key:
551
551
  specification_version: 4
552
552
  summary: istox backend shared gem
553
553
  test_files: []