cns 2.1.9 → 2.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f5e34a759d5a3dc566f918d6e0822311511ef817a26b4f5cda3792129306e2d9
4
- data.tar.gz: 31748b2db5858844b87ae861ba7353a58c07bb5d3ab71e452257a8f731ce33cc
3
+ metadata.gz: 42234f88abb7b5c16ffdb019c357ef37d9dd70a0140361c506f7863c018fd41c
4
+ data.tar.gz: 7dabd7b2315715298c3eee435ba331df0f4dd2507648a28cf5a9a6eafdf30782
5
5
  SHA512:
6
- metadata.gz: 9eba36bdb69b39ebe7e87dd42860d05ce72fb47cf0ff9ad164e387cf8ca4ea7cb138f840cd956a9591b8c0daf74c3ee9042b8c652ce3d64930425c9904955630
7
- data.tar.gz: d77d6f77d9754994e3282e21c0394389644ba5df1f54e83f4548dbf820128b434a404a8dc08a72661df8fcdc7b79620937ffad941ad8e96510309cc080326351
6
+ metadata.gz: 224c2044ad95ea5718e3effe7fe22f2dabcf9cd59f0924ffd6cb618d8b32ef6f993e9a8aab934925e1b786395526f57da3e1698762028a25d3710fb7e6b197bb
7
+ data.tar.gz: d4ca9294661f3a26b80ac1aa68068efdf931fdefe76948cdc037f0fd4d1c7ccaef047106a09109b2e066583992242f439270707055ab0bd27a53c61c5c0cd19b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cns (2.1.9)
4
+ cns (2.2.1)
5
5
  curb
6
6
  faraday
7
7
  faraday-retry
@@ -12,19 +12,22 @@ PATH
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
- addressable (2.8.8)
15
+ addressable (2.9.0)
16
16
  public_suffix (>= 2.0.2, < 8.0)
17
17
  ast (2.4.3)
18
18
  backport (1.2.0)
19
19
  base64 (0.3.0)
20
20
  benchmark (0.5.0)
21
- bigdecimal (3.3.1)
22
- concurrent-ruby (1.3.6)
23
- curb (1.2.2)
21
+ bigdecimal (4.1.2)
22
+ commander (5.0.0)
23
+ highline (~> 3.0.0)
24
+ concurrent-ruby (1.3.7)
25
+ curb (1.3.6)
26
+ date (3.5.1)
24
27
  declarative (0.0.20)
25
28
  diff-lcs (1.6.2)
26
- dry-configurable (1.3.0)
27
- dry-core (~> 1.1)
29
+ dry-configurable (1.4.0)
30
+ dry-core (~> 1.0)
28
31
  zeitwerk (~> 2.6)
29
32
  dry-core (1.2.0)
30
33
  concurrent-ruby (~> 1.0)
@@ -37,13 +40,13 @@ GEM
37
40
  concurrent-ruby (~> 1.0)
38
41
  dry-core (~> 1.1)
39
42
  zeitwerk (~> 2.6)
40
- dry-schema (1.15.0)
43
+ dry-schema (1.16.0)
41
44
  concurrent-ruby (~> 1.0)
42
45
  dry-configurable (~> 1.0, >= 1.0.1)
43
46
  dry-core (~> 1.1)
44
47
  dry-initializer (~> 3.2)
45
48
  dry-logic (~> 1.6)
46
- dry-types (~> 1.8)
49
+ dry-types (~> 1.9, >= 1.9.1)
47
50
  zeitwerk (~> 2.6)
48
51
  dry-types (1.9.1)
49
52
  bigdecimal (>= 3.0)
@@ -52,83 +55,100 @@ GEM
52
55
  dry-inflector (~> 1.0)
53
56
  dry-logic (~> 1.4)
54
57
  zeitwerk (~> 2.6)
55
- faraday (2.14.1)
58
+ erb (6.0.4)
59
+ faraday (2.14.3)
56
60
  faraday-net_http (>= 2.0, < 3.5)
57
61
  json
58
62
  logger
59
63
  faraday-follow_redirects (0.5.0)
60
64
  faraday (>= 1, < 3)
61
- faraday-net_http (3.4.2)
65
+ faraday-net_http (3.4.4)
62
66
  net-http (~> 0.5)
63
67
  faraday-retry (2.4.0)
64
68
  faraday (~> 2.0)
65
- google-apis-bigquery_v2 (0.98.0)
69
+ google-apis-bigquery_v2 (0.104.0)
66
70
  google-apis-core (>= 0.15.0, < 2.a)
67
- google-apis-core (1.0.2)
68
- addressable (~> 2.8, >= 2.8.7)
71
+ google-apis-core (1.2.4)
72
+ addressable (~> 2.9)
69
73
  faraday (~> 2.13)
70
74
  faraday-follow_redirects (~> 0.3)
71
75
  googleauth (~> 1.14)
72
76
  mini_mime (~> 1.1)
77
+ multi_json (~> 1.11)
73
78
  representable (~> 3.0)
74
- retriable (~> 3.1)
75
- google-cloud-bigquery (1.62.0)
76
- bigdecimal (~> 3.0)
79
+ retriable (>= 3.1, < 5.0)
80
+ google-cloud-bigquery (1.64.0)
81
+ bigdecimal (>= 3.0, < 5)
77
82
  concurrent-ruby (~> 1.0)
78
83
  google-apis-bigquery_v2 (~> 0.71)
79
84
  google-apis-core (>= 0.18, < 2)
80
85
  google-cloud-core (~> 1.6)
81
86
  googleauth (~> 1.9)
82
87
  mini_mime (~> 1.0)
83
- google-cloud-core (1.8.0)
88
+ google-cloud-core (1.9.0)
84
89
  google-cloud-env (>= 1.0, < 3.a)
85
90
  google-cloud-errors (~> 1.0)
86
91
  google-cloud-env (2.3.1)
87
92
  base64 (~> 0.2)
88
93
  faraday (>= 1.0, < 3.a)
89
- google-cloud-errors (1.5.0)
94
+ google-cloud-errors (1.6.0)
90
95
  google-logging-utils (0.2.0)
91
- googleauth (1.16.1)
96
+ googleauth (1.17.1)
92
97
  faraday (>= 1.0, < 3.a)
93
98
  google-cloud-env (~> 2.2)
94
99
  google-logging-utils (~> 0.1)
95
100
  jwt (>= 1.4, < 4.0)
96
- multi_json (~> 1.11)
97
101
  os (>= 0.9, < 2.0)
102
+ pstore (~> 0.1)
98
103
  signet (>= 0.16, < 2.a)
104
+ highline (3.0.1)
99
105
  jaro_winkler (1.7.0)
100
- json (2.18.1)
101
- jwt (3.1.2)
106
+ json (2.20.0)
107
+ jwt (3.2.0)
102
108
  base64
103
109
  kramdown (2.5.2)
104
110
  rexml (>= 3.4.4)
105
111
  kramdown-parser-gfm (1.1.0)
106
112
  kramdown (~> 2.0)
107
- language_server-protocol (3.17.0.5)
113
+ language_server-protocol (3.17.0.6)
108
114
  lint_roller (1.1.0)
109
115
  logger (1.7.0)
110
116
  memoist (0.16.2)
111
117
  mini_mime (1.1.5)
112
- multi_json (1.19.1)
118
+ multi_json (1.21.1)
113
119
  net-http (0.9.1)
114
120
  uri (>= 0.11.1)
115
- nokogiri (1.19.1-x86_64-linux-gnu)
121
+ nokogiri (1.19.4-x86_64-linux-gnu)
116
122
  racc (~> 1.4)
117
123
  observer (0.1.2)
118
124
  open3 (0.2.1)
119
125
  os (1.1.4)
120
126
  ostruct (0.6.3)
121
- parallel (1.27.0)
122
- parser (3.3.10.1)
127
+ parallel (2.1.0)
128
+ parlour (9.1.2)
129
+ commander (~> 5.0)
130
+ parser
131
+ rainbow (~> 3.0)
132
+ sorbet-runtime (>= 0.5)
133
+ parser (3.3.11.1)
123
134
  ast (~> 2.4.1)
124
135
  racc
125
136
  prism (1.9.0)
126
- public_suffix (7.0.2)
137
+ pstore (0.2.1)
138
+ psych (5.4.0)
139
+ date
140
+ stringio
141
+ public_suffix (7.0.5)
127
142
  racc (1.8.1)
128
143
  rainbow (3.1.1)
129
144
  rake (12.3.3)
130
- rbs (3.10.3)
145
+ rbs (4.0.3)
131
146
  logger
147
+ prism (>= 1.6.0)
148
+ tsort
149
+ rdoc (7.2.0)
150
+ erb
151
+ psych (>= 4.0.0)
132
152
  tsort
133
153
  reek (6.5.0)
134
154
  dry-schema (~> 1.13)
@@ -136,39 +156,38 @@ GEM
136
156
  parser (~> 3.3.0)
137
157
  rainbow (>= 2.0, < 4.0)
138
158
  rexml (~> 3.1)
139
- regexp_parser (2.11.3)
159
+ regexp_parser (2.12.0)
140
160
  representable (3.2.0)
141
161
  declarative (< 0.1.0)
142
162
  trailblazer-option (>= 0.1.1, < 0.2.0)
143
163
  uber (< 0.2.0)
144
- retriable (3.1.2)
164
+ retriable (4.2.0)
145
165
  reverse_markdown (3.0.2)
146
166
  nokogiri
147
167
  rexml (3.4.4)
148
- rubocop (1.84.2)
168
+ rubocop (1.88.1)
149
169
  json (~> 2.3)
150
170
  language_server-protocol (~> 3.17.0.2)
151
171
  lint_roller (~> 1.1.0)
152
- parallel (~> 1.10)
172
+ parallel (>= 1.10)
153
173
  parser (>= 3.3.0.2)
154
174
  rainbow (>= 2.2.2, < 4.0)
155
175
  regexp_parser (>= 2.9.3, < 3.0)
156
176
  rubocop-ast (>= 1.49.0, < 2.0)
157
177
  ruby-progressbar (~> 1.7)
158
178
  unicode-display_width (>= 2.4.0, < 4.0)
159
- rubocop-ast (1.49.0)
179
+ rubocop-ast (1.50.0)
160
180
  parser (>= 3.3.7.2)
161
181
  prism (~> 1.7)
162
182
  rubocop-rake (0.7.1)
163
183
  lint_roller (~> 1.1)
164
184
  rubocop (>= 1.72.1)
165
185
  ruby-progressbar (1.13.0)
166
- signet (0.21.0)
186
+ signet (0.22.0)
167
187
  addressable (~> 2.8)
168
188
  faraday (>= 0.17.5, < 3.a)
169
189
  jwt (>= 1.5, < 4.0)
170
- multi_json (~> 1.10)
171
- solargraph (0.58.2)
190
+ solargraph (0.60.2)
172
191
  ast (~> 2.4.3)
173
192
  backport (~> 1.2)
174
193
  benchmark (~> 0.4)
@@ -183,14 +202,25 @@ GEM
183
202
  ostruct (~> 0.6)
184
203
  parser (~> 3.0)
185
204
  prism (~> 1.4)
186
- rbs (>= 3.6.1, <= 4.0.0.dev.4)
205
+ rbs (>= 3.10.0)
206
+ rdoc (~> 7.0)
187
207
  reverse_markdown (~> 3.0)
188
208
  rubocop (~> 1.76)
209
+ sord (~> 7.0)
189
210
  thor (~> 1.0)
190
211
  tilt (~> 2.0)
191
212
  yard (~> 0.9, >= 0.9.24)
192
213
  yard-activesupport-concern (~> 0.0)
193
214
  yard-solargraph (~> 0.1)
215
+ sorbet-runtime (0.6.13323)
216
+ sord (7.1.0)
217
+ commander (~> 5.0)
218
+ parlour (~> 9.1)
219
+ parser
220
+ rbs (>= 3.0, < 5)
221
+ sorbet-runtime
222
+ yard
223
+ stringio (3.2.0)
194
224
  thor (1.5.0)
195
225
  tilt (2.7.0)
196
226
  trailblazer-option (0.1.2)
@@ -200,12 +230,12 @@ GEM
200
230
  unicode-emoji (~> 4.1)
201
231
  unicode-emoji (4.2.0)
202
232
  uri (1.1.1)
203
- yard (0.9.38)
233
+ yard (0.9.44)
204
234
  yard-activesupport-concern (0.0.1)
205
235
  yard (>= 0.8)
206
236
  yard-solargraph (0.1.0)
207
237
  yard (~> 0.9)
208
- zeitwerk (2.7.4)
238
+ zeitwerk (2.8.2)
209
239
 
210
240
  PLATFORMS
211
241
  x86_64-linux
data/lib/cns/apice.rb CHANGED
@@ -10,6 +10,7 @@ module Cns
10
10
  # classe para acesso dados centralized exchanges
11
11
  class Apice
12
12
  API = {de: 'https://api.bitcoin.de/v4', us: 'https://api.kraken.com/0/private'}.freeze
13
+ MDE = %w[btc eth].freeze
13
14
 
14
15
  def initialize
15
16
  @curl =
@@ -50,15 +51,21 @@ module Cns
50
51
  # Get deposits from Bitcoin.de, uniformly formatted
51
52
  # @return [Array<Hash>] depositos uniformizados bitcoinde
52
53
  def deposits_de
53
- pag_de_req("#{API[:de]}/btc/deposits", {}, :deposits) { |i| i.map { |h| deposit_unif(h) } }
54
+ MDE.flat_map do |cry|
55
+ pag_de_req("#{API[:de]}/#{cry}/deposits", {}, :deposits) { |i| i.map { |h| deposit_unif(h, cry.upcase) } }
56
+ end
57
+ # pag_de_req("#{API[:de]}/btc/deposits", {}, :deposits) { |i| i.map { |h| deposit_unif(h) } }
54
58
  rescue Curl::Err::CurlError
55
59
  []
56
60
  end
57
61
 
58
62
  # Get withdrawals from Bitcoin.de, uniformly formatted
59
63
  # @return [Array<Hash>] withdrawals uniformizadas bitcoinde
60
- def withdrawals_de(tsp = nil)
61
- pag_de_req("#{API[:de]}/btc/withdrawals", {}, :withdrawals) { |i| i.map { |h| withdrawal_unif(h) } }
64
+ def withdrawals_de
65
+ MDE.flat_map do |cry|
66
+ pag_de_req("#{API[:de]}/#{cry}/withdrawals", {}, :withdrawals) { |i| i.map { |h| withdrawal_unif(h, cry.upcase) } }
67
+ end
68
+ # pag_de_req("#{API[:de]}/btc/withdrawals", {}, :withdrawals) { |i| i.map { |h| withdrawal_unif(h) } }
62
69
  rescue Curl::Err::CurlError
63
70
  []
64
71
  end
@@ -201,15 +208,17 @@ module Cns
201
208
 
202
209
  # Uniformly format a deposit from Bitcoin.de
203
210
  # @param [Hash] has Deposit data from Bitcoin.de
211
+ # @param [String] moe Currency code (e.g., 'BTC', 'ETH')
204
212
  # @return [Hash] deposito uniformizado bitcoinde
205
- def deposit_unif(has)
206
- {add: has[:address], time: Time.parse(has[:created_at]), qtd: has[:amount].to_d, nxid: has[:deposit_id].to_i}.merge(tp: 'deposit', moe: 'BTC', fee: 0.to_d)
213
+ def deposit_unif(has, moe)
214
+ {add: has[:address], time: Time.parse(has[:created_at]), qtd: has[:amount].to_d, nxid: has[:deposit_id].to_i}.merge(tp: 'deposit', moe: moe, fee: 0.to_d)
207
215
  end
208
216
 
209
217
  # Uniformly format a withdrawal from Bitcoin.de
210
218
  # @param [Hash] has Withdrawal data from Bitcoin.de
219
+ # @param [String] moe Currency code (e.g., 'BTC', 'ETH')
211
220
  # @return [Hash] withdrawal uniformizada bitcoinde
212
- def withdrawal_unif(has)
221
+ def withdrawal_unif(has, moe)
213
222
  {
214
223
  add: has[:address],
215
224
  time: Time.parse(has[:transferred_at]),
@@ -217,7 +226,7 @@ module Cns
217
226
  fee: has[:network_fee].to_d,
218
227
  nxid: has[:withdrawal_id].to_i,
219
228
  tp: 'withdrawal',
220
- moe: 'BTC'
229
+ moe: moe
221
230
  }
222
231
  end
223
232
 
data/lib/cns/bigquery.rb CHANGED
@@ -252,7 +252,7 @@ module Cns
252
252
  kys.map do |k|
253
253
  case k
254
254
  when :amount, :btc, :cost, :fee, :gas, :gasPrice, :gasUsed, :margin, :price, :quantity, :value, :vol, :eur, :blockReward, :qtd then fnm(hsh[k])
255
- when :blockNumber, :timeStamp, :nonce, :transactionIndex, :isError, :txreceipt_status, :tokenDecimal, :withdrawalIndex, :validatorIndex then fin(hsh[k])
255
+ when :blockNumber, :timeStamp, :nonce, :transactionIndex, :isError, :txreceipt_status, :tokenDecimal, :withdrawalIndex, :validatorIndex, :nxid then fin(hsh[k])
256
256
  when :block_time, :successfully_finished_at, :time, :trade_marked_as_paid_at then fts(hsh[k])
257
257
  when :memo, :input, :misc then fqe(hsh[k])
258
258
  else fqt(hsh[k])
data/lib/cns/bitcoinde.rb CHANGED
@@ -51,7 +51,7 @@ module Cns
51
51
  def mtrades
52
52
  return unless ops[:v] && novxt.any?
53
53
 
54
- puts("\ntrades data hora dt criacao tipo par btc eur")
54
+ puts("\ntrades data hora dt criacao tipo crypto eur")
55
55
  novxt.sort_by { |i| -i[:srx] }.each { |o| puts(fot(o)) }
56
56
  end
57
57
 
@@ -59,7 +59,7 @@ module Cns
59
59
  def mledger
60
60
  return unless ops[:v] && novxl.any?
61
61
 
62
- puts("\nledger data hora tipo moe quantidade custo")
62
+ puts("\nledger data hora tipo moe crypto custo")
63
63
  novxl.sort_by { |i| -i[:srx] }.each { |o| puts(fol(o)) }
64
64
  end
65
65
 
@@ -82,12 +82,11 @@ module Cns
82
82
  # @return [String] texto formatado trade
83
83
  def fot(htx)
84
84
  format(
85
- '%<ky>-6.6s %<dt>19.19s %<dp>10.10s %<ty>-5.5s %<mo>-8.8s %<vl>18.8f %<co>8.2f',
85
+ '%<ky>-6.6s %<dt>19.19s %<dp>10.10s %<ty>-8.8s %<vl>18.8f %<co>14.2f',
86
86
  ky: htx[:trade_id],
87
- dt: htx[:successfully_finished_at].strftime('%F %T'),
88
- dp: htx[:trade_marked_as_paid_at].strftime('%F'),
87
+ dt: htx[:successfully_finished_at]&.strftime('%F %T'),
88
+ dp: htx[:trade_marked_as_paid_at]&.strftime('%F'),
89
89
  ty: htx[:type],
90
- mo: htx[:trading_pair],
91
90
  vl: htx[:btc],
92
91
  co: htx[:eur]
93
92
  )
@@ -138,9 +137,9 @@ module Cns
138
137
  pdes(:successfully_finished_at, t).merge(
139
138
  trade_marked_as_paid_at: ptm(t[:trade_marked_as_paid_at]),
140
139
  username: t[:trading_partner_information][:username],
141
- btc: t[:type] == 'buy' ? t[:amount_currency_to_trade_after_fee].to_d : -1 * t[:amount_currency_to_trade].to_d,
142
- eur: t[:volume_currency_to_pay_after_fee].to_d,
143
- trading_pair: t[:trading_pair].upcase
140
+ type: "#{t[:trading_pair][0..2]}#{t[:type]}",
141
+ btc: t[:type] == 'buy' ? t[:amount_currency_to_trade_after_fee].to_d : t[:amount_currency_to_trade].to_d * -1,
142
+ eur: t[:volume_currency_to_pay_after_fee].to_d
144
143
  )
145
144
  end
146
145
  end
data/lib/cns/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cns
4
- VERSION = '2.1.9'
4
+ VERSION = '2.2.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cns
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.9
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hernâni Rodrigues Vaz
@@ -243,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
243
243
  - !ruby/object:Gem::Version
244
244
  version: '0'
245
245
  requirements: []
246
- rubygems_version: 4.0.6
246
+ rubygems_version: 3.6.9
247
247
  specification_version: 4
248
248
  summary: Arquiva transactions etherscan/greymass/bitcoinde/kraken/paymium/therock
249
249
  no bigquery.