istox 0.2.3.pre.50 → 0.2.5.1
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/.gitignore +0 -0
- data/.rubocop.yml +0 -0
- data/.solargraph.yml +0 -0
- data/CODE_OF_CONDUCT.md +0 -0
- data/Gemfile +0 -0
- data/README.md +0 -0
- data/Rakefile +0 -0
- data/lib/istox/constants/error.rb +0 -0
- data/lib/istox/helpers/f_math.rb +0 -0
- data/lib/istox/helpers/graphql_client.rb +0 -0
- data/lib/istox/helpers/gruf_listener_hook.rb +0 -0
- data/lib/istox/helpers/messaging.rb +3 -5
- data/lib/istox/helpers/my_open_struct.rb +0 -0
- data/lib/istox/helpers/order_book_prorate.rb +0 -0
- data/lib/istox/helpers/rate_limit.rb +0 -0
- data/lib/istox/helpers/regex_helper.rb +0 -0
- data/lib/istox/helpers/result_handler.rb +0 -0
- data/lib/istox/helpers/sns_publisher.rb +5 -1
- data/lib/istox/helpers/vault.rb +0 -0
- data/lib/istox/interfaces/chainhub/transaction.rb +0 -0
- data/lib/istox/models/blockchain_receipt.rb +0 -0
- data/lib/istox/models/concerns/blockchain_receipt_query.rb +0 -0
- data/lib/istox/quant/bond.rb +9 -2
- data/lib/istox/version.rb +1 -1
- metadata +5 -6
- data/lib/istox/helpers/_tmp_07f8e7bcecafce66_common_helper.rb.rb +0 -67
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34d26a89afe540d3c4721977cd2c3b984a1939c61908b093a088f4b305d5d3d8
|
4
|
+
data.tar.gz: ce16f6edd95e844ff75529b2357ab547aee8a405928f28d8f887e12b391d2343
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9f3ef739d924c25fd558a52467570a28946ee2dc50b670f7765dce021ccaf020420b185c9584646d16c4ea525dd378ce0a73c4479616208004ca6ee1b0191b4
|
7
|
+
data.tar.gz: b727597605be43b084c247667db0294fcf0e4f90d65b84cf333a945aa55c8a57cd59fe133ecdc708de7c7e3681155d396bc0220307826ba8da41f9431ed04982
|
data/.gitignore
CHANGED
File without changes
|
data/.rubocop.yml
CHANGED
File without changes
|
data/.solargraph.yml
CHANGED
File without changes
|
data/CODE_OF_CONDUCT.md
CHANGED
File without changes
|
data/Gemfile
CHANGED
File without changes
|
data/README.md
CHANGED
File without changes
|
data/Rakefile
CHANGED
File without changes
|
File without changes
|
data/lib/istox/helpers/f_math.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
@@ -131,7 +131,7 @@ module Istox
|
|
131
131
|
next unless ce.present?
|
132
132
|
|
133
133
|
copy_email_data = email_data.clone
|
134
|
-
|
134
|
+
|
135
135
|
# if it is just email to cc
|
136
136
|
if ce.is_a? String
|
137
137
|
copy_email_data[:email] = ce
|
@@ -148,10 +148,8 @@ module Istox
|
|
148
148
|
next unless ce[:email].present?
|
149
149
|
|
150
150
|
copy_email_data[:email] = ce[:email]
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
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?
|
155
153
|
end
|
156
154
|
|
157
155
|
copy_email_data.delete(:copy_emails)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -14,7 +14,11 @@ module Istox
|
|
14
14
|
|
15
15
|
message = JSON.generate(message) unless message.is_a? String
|
16
16
|
|
17
|
-
|
17
|
+
topic = topic_arn || ENV.fetch('SNS_CLIENT_TOPIC', '')
|
18
|
+
|
19
|
+
log.info("Publishing SNS to topic: #{topic} with message: #{message}")
|
20
|
+
|
21
|
+
sns_client.publish(topic_arn: topic, message: message)
|
18
22
|
|
19
23
|
log.info('Publish to SNS successfully.')
|
20
24
|
rescue StandardError => e
|
data/lib/istox/helpers/vault.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
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.5.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-04-
|
11
|
+
date: 2021-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: amazing_print
|
@@ -494,7 +494,6 @@ files:
|
|
494
494
|
- lib/istox.rb
|
495
495
|
- lib/istox/constants/error.rb
|
496
496
|
- lib/istox/consumers/blockchain_status_handler.rb
|
497
|
-
- lib/istox/helpers/_tmp_07f8e7bcecafce66_common_helper.rb.rb
|
498
497
|
- lib/istox/helpers/blockchain_service.rb
|
499
498
|
- lib/istox/helpers/bunny_boot.rb
|
500
499
|
- lib/istox/helpers/common_helper.rb
|
@@ -543,11 +542,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
543
542
|
version: '0'
|
544
543
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
545
544
|
requirements:
|
546
|
-
- - "
|
545
|
+
- - ">="
|
547
546
|
- !ruby/object:Gem::Version
|
548
|
-
version:
|
547
|
+
version: '0'
|
549
548
|
requirements: []
|
550
|
-
rubygems_version: 3.
|
549
|
+
rubygems_version: 3.0.6
|
551
550
|
signing_key:
|
552
551
|
specification_version: 4
|
553
552
|
summary: istox backend shared gem
|
@@ -1,67 +0,0 @@
|
|
1
|
-
module Istox
|
2
|
-
module CommonHelper
|
3
|
-
def self.to_datetime(input)
|
4
|
-
return nil if input.blank?
|
5
|
-
|
6
|
-
begin
|
7
|
-
is_numeric = true if Integer input
|
8
|
-
rescue StandardError
|
9
|
-
false
|
10
|
-
end
|
11
|
-
|
12
|
-
# is unix timestamp
|
13
|
-
is_numeric ? Time.at(input.to_i).to_datetime : Time.parse(input)
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.to_boolean(input)
|
17
|
-
!(input.blank? || input.to_s.downcase == 'false' || input.to_s.downcase == '0')
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.to_open_struct(model)
|
21
|
-
return nil if model.nil?
|
22
|
-
|
23
|
-
if model.is_a?(Array)
|
24
|
-
model.map do |item|
|
25
|
-
hash = deep_to_h(item).deep_transform_keys { |key| key.to_s.underscore.to_sym }
|
26
|
-
to_recursive_ostruct(hash)
|
27
|
-
end
|
28
|
-
else
|
29
|
-
hash = deep_to_h(model).deep_transform_keys { |key| key.to_s.underscore.to_sym }
|
30
|
-
to_recursive_ostruct(hash)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def self.to_recursive_ostruct(obj)
|
35
|
-
if obj.is_a?(Hash)
|
36
|
-
::Istox::MyOpenStruct.new(obj.map { |key, val| [key, to_recursive_ostruct(val)] }.to_h)
|
37
|
-
elsif obj.is_a?(Array)
|
38
|
-
obj.map { |o| to_recursive_ostruct(o) }
|
39
|
-
elsif obj.is_a?(OpenStruct)
|
40
|
-
::Istox::MyOpenStruct.new(obj)
|
41
|
-
else # Assumed to be a primitive value
|
42
|
-
obj
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def self.deep_to_h(obj)
|
47
|
-
if obj.is_a?(Array)
|
48
|
-
obj.map { |r| deep_to_h(r) }
|
49
|
-
elsif obj.is_a?(OpenStruct) || obj.is_a?(Hash) || (obj.methods.include?(:to_h) && obj.present?)
|
50
|
-
obj.to_h.transform_values do |v|
|
51
|
-
if v.is_a?(OpenStruct) || v.is_a?(Array)
|
52
|
-
deep_to_h(v)
|
53
|
-
else
|
54
|
-
v
|
55
|
-
end
|
56
|
-
end
|
57
|
-
else
|
58
|
-
obj
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
def self.get_currency_decimal(currency)
|
63
|
-
return 0 if currency&.downcase == 'jpy'
|
64
|
-
|
65
|
-
2 end
|
66
|
-
end
|
67
|
-
end
|