cns 0.8.6 → 0.8.7

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: f4fb8ef5137e35f64fabed9a151d6547d12f21487e602c91404ba5eedcd88a34
4
- data.tar.gz: 037a388cdcd7652fa803d76131ba1e7076b2a0983c74f835484005791c3a1fc3
3
+ metadata.gz: b3630eeaca7e56e765e2702bc46c885b19c9e5127239f6788ce510358d3b2d7e
4
+ data.tar.gz: b2b87a278f6042d604d964f1c2bdd8d20db4b7a7d8d3c9448f36afbc2e2d8a08
5
5
  SHA512:
6
- metadata.gz: bd36261022378f795e64bc814434879b9f99cd7f7c3ff974a719aa0aed0d40bc16a341fcd11038f49c0e1056ea298acb21bca79644dcff7251eb27d69b4b6118
7
- data.tar.gz: b6c078fcfb4e878f6058b785051ba702d8e49afc150767f7a99412d4d9202890e98cd3f3f3896afd11d80d2dc083e94fb220e1ff7a25fd261c8a1c781884abf2
6
+ metadata.gz: ec9c373225a2870fa14bc4eeefde9c20f6a2152a173108ce14e0f6b4bf948c7784b85337c3b0dc2f94ebaae005313c9145849805eff161f6bff094538ba942eb
7
+ data.tar.gz: ebd9ed2c6d303bd6e6ba9fd533b9d9198dd8751ebe2f86c81e4b8dfcae4e5b8e632310e45a322b9dd1ed7f78a1bda4efb0a4127fc953710b133f2248b009722c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cns (0.8.6)
4
+ cns (0.8.7)
5
5
  curb
6
6
  faraday
7
7
  google-cloud-bigquery
data/lib/cns/bigquery.rb CHANGED
@@ -41,47 +41,47 @@ module Cns
41
41
  end
42
42
 
43
43
  # mostra situacao completa entre kraken/bitcoinde/paymium/therock/etherscan/greymass & bigquery
44
- def mostra_tudo
45
- apius.mostra_resumo
46
- apide.mostra_resumo
47
- apies.mostra_resumo
48
- apigm.mostra_resumo
44
+ def mtudo
45
+ apius.mresumo
46
+ apide.mresumo
47
+ apies.mresumo
48
+ apigm.mresumo
49
49
  end
50
50
 
51
51
  # mostra situacao completa entre kraken/etherscan & bigquery
52
- def mostra_skrk
53
- apius.mostra_resumo
54
- apies.mostra_resumo
52
+ def mskrk
53
+ apius.mresumo
54
+ apies.mresumo
55
55
  end
56
56
 
57
57
  # mostra situacao completa entre etherscan & bigquery
58
- def mostra_seth
59
- apies.mostra_resumo_simples
58
+ def mseth
59
+ apies.mresumo_simples
60
60
  end
61
61
 
62
62
  # @return [String] texto inicial transacoes
63
- def trs_ini
64
- Time.now.strftime('TRANSACOES %Y-%m-%d %H:%M:%S ')
63
+ def tct
64
+ Time.now.strftime('TRANSACOES %Y-%m-%d %H:%M:%S')
65
65
  end
66
66
 
67
67
  # insere (caso existam) dados novos kraken/bitcoinde/paymium/therock/etherscan/greymass no bigquery
68
- def processa_tudo
69
- puts(trs_ini + "#{processa_us}, #{processa_de}, #{processa_eth}, #{processa_eos}")
68
+ def ptudo
69
+ puts("#{tct} #{pus}, #{pde}, #{peth}, #{peos}")
70
70
  end
71
71
 
72
72
  # insere (caso existam) dados novos kraken/etherscan no bigquery
73
- def processa_wkrk
74
- puts(trs_ini + "#{processa_us}, #{processa_eth}")
73
+ def pwkrk
74
+ puts("#{tct} #{pus}, #{peth}")
75
75
  end
76
76
 
77
77
  # insere (caso existam) dados novos etherscan no bigquery
78
- def processa_weth
79
- puts(trs_ini + processa_eth)
78
+ def pweth
79
+ puts("#{tct} #{peth}")
80
80
  end
81
81
 
82
82
  # insere (caso existam) dados novos etherscan no bigquery (output to file)
83
- def processa_ceth
84
- File.open(FO, mode: 'a') { |out| out.puts(trs_ini + processa_ethc) }
83
+ def pceth
84
+ File.open(FO, mode: 'a') { |out| out.puts("#{tct} #{pethc}") }
85
85
  end
86
86
 
87
87
  private
@@ -89,35 +89,35 @@ module Cns
89
89
  # insere transacoes blockchain novas nas tabelas netht (norml), nethi (internas), nethp (block), nethw (withdrawals), nethk (token)
90
90
  #
91
91
  # @return [String] linhas & tabelas afetadas
92
- def processa_eth
92
+ def peth
93
93
  tabelas_out(apies, %w[ETH], %i[t i p w k], 'neth')
94
94
  end
95
95
 
96
96
  # insere transacoes blockchain novas nas tabelas netht (norml), nethi (internas), nethp (block), nethw (withdrawals), nethk (token)
97
97
  #
98
98
  # @return [String] linhas & tabelas afetadas
99
- def processa_ethc
99
+ def pethc
100
100
  tabelas_out(apiesc, %w[ETH], %i[t i p w k], 'neth')
101
101
  end
102
102
 
103
103
  # insere transacoes exchange kraken novas nas tabelas ust (trades), usl (ledger)
104
104
  #
105
105
  # @return [String] linhas & tabelas afetadas
106
- def processa_us
106
+ def pus
107
107
  tabelas_cus(apius, %w[KRAKEN], %i[cust cusl])
108
108
  end
109
109
 
110
110
  # insere transacoes exchange bitcoinde novas nas tabelas det (trades), del (ledger)
111
111
  #
112
112
  # @return [String] linhas & tabelas afetadas
113
- def processa_de
113
+ def pde
114
114
  tabelas_out(apide, %w[BITCOINDE], %i[cdet cdel])
115
115
  end
116
116
 
117
117
  # insere transacoes blockchain novas na tabela eos
118
118
  #
119
119
  # @return [String] linhas & tabelas afetadas
120
- def processa_eos
120
+ def peos
121
121
  tabelas_out(apigm, %w[EOS], %i[neost])
122
122
  end
123
123
 
@@ -128,7 +128,6 @@ module Cns
128
128
  def job?(cmd)
129
129
  @job = api.query_job(cmd)
130
130
  job.wait_until_done!
131
-
132
131
  return false unless job.failed?
133
132
 
134
133
  puts("BigQuery Error: #{job.error['message']}")
@@ -152,7 +151,7 @@ module Cns
152
151
  job?(cmd) ? 0 : job.num_dml_affected_rows
153
152
  end
154
153
 
155
- def initialize_etherscan_client(prx)
154
+ def apiesg(prx)
156
155
  Etherscan.new(
157
156
  {
158
157
  wb: sql("SELECT * FROM #{BD}.wet#{prx[-1]} ORDER BY ax"),
@@ -168,12 +167,12 @@ module Cns
168
167
 
169
168
  # @return [Etherscan] API blockchain ETH
170
169
  def apies
171
- @apies ||= initialize_etherscan_client('netb')
170
+ @apies ||= apiesg('netb')
172
171
  end
173
172
 
174
173
  # @return [Etherscan] API blockchain ETH
175
174
  def apiesc
176
- @apiesc ||= initialize_etherscan_client('netc')
175
+ @apiesc ||= apiesg('netc')
177
176
  end
178
177
 
179
178
  # @return [Greymass] API blockchain EOS
@@ -210,7 +209,7 @@ module Cns
210
209
  novx = src.send("nov#{prx}#{itm}")
211
210
  next if novx.empty?
212
211
 
213
- str << format(' %<n>i %<t>s', n: dml(insert_cus(prx, itm, novx)), t: prx + itm.to_s)
212
+ str << format(' %<n>i %<t>s', n: dml(insert_cus(prx, itm, novx)), t: "#{prx}#{itm}")
214
213
  end
215
214
  str.join
216
215
  end
@@ -220,7 +219,7 @@ module Cns
220
219
  novx = src.send("nov#{prx}#{itm}")
221
220
  next if novx.empty?
222
221
 
223
- str << format(' %<n>i %<t>s', n: dml(insert_out(prx, itm, novx)), t: prx + itm.to_s)
222
+ str << format(' %<n>i %<t>s', n: dml(insert_out(prx, itm, novx)), t: "#{prx}#{itm}")
224
223
  end
225
224
  str.join
226
225
  end
@@ -237,27 +236,23 @@ module Cns
237
236
 
238
237
  # SQL value formatting methods with improved safety
239
238
  def fqt(value)
240
- return 'null' if value.nil? || value.empty?
241
-
242
- "'#{value}'"
239
+ value.nil? || value.empty? ? 'null' : "'#{value}'"
243
240
  end
244
241
 
245
242
  def fnm(value)
246
- return 'null' if value.nil?
247
-
248
- "CAST('#{value}' AS NUMERIC)"
243
+ "CAST(#{value.to_d} AS NUMERIC)"
244
+ rescue StandardError
245
+ 'CAST(0 AS NUMERIC)'
249
246
  end
250
247
 
251
248
  def fin(value)
252
- return '0' if value.nil?
253
-
254
249
  Integer(value).to_s
255
250
  rescue StandardError
256
- 'null'
251
+ '0'
257
252
  end
258
253
 
259
254
  def ftm(sec)
260
- "PARSE_DATETIME('%s', '#{String(sec.round)}')"
255
+ "PARSE_DATETIME('%s', '#{sec.round}')"
261
256
  end
262
257
 
263
258
  def fts(value)
@@ -267,7 +262,7 @@ module Cns
267
262
  # @param [Hash] htx transacao norml etherscan
268
263
  # @return [String] valores formatados netht (norml parte1)
269
264
  def netht_val(htx)
270
- "(#{[
265
+ vls = [
271
266
  fin(htx[:blockNumber]),
272
267
  fin(htx[:timeStamp]),
273
268
  fqt(htx[:hash]),
@@ -286,13 +281,14 @@ module Cns
286
281
  fqt(htx[:input]),
287
282
  fqt(htx[:contractAddress]),
288
283
  fin(ops.dig(:h, htx[:hash]))
289
- ].join(',')})"
284
+ ]
285
+ "(#{vls.join(',')})"
290
286
  end
291
287
 
292
288
  # @param [Hash] htx transacao internas etherscan
293
289
  # @return [String] valores formatados nethi (internas parte1)
294
290
  def nethi_val(htx)
295
- "(#{[
291
+ vls = [
296
292
  fin(htx[:blockNumber]),
297
293
  fin(htx[:timeStamp]),
298
294
  fqt(htx[:hash]),
@@ -309,19 +305,21 @@ module Cns
309
305
  fin(htx[:isError]),
310
306
  fin(htx[:errCode]),
311
307
  fin(ops.dig(:h, htx[:hash]))
312
- ].join(',')})"
308
+ ]
309
+ "(#{vls.join(',')})"
313
310
  end
314
311
 
315
312
  # @param [Hash] htx transacao block etherscan
316
313
  # @return [String] valores formatados nethi (block parte1)
317
314
  def nethp_val(htx)
318
- "(#{[fin(htx[:blockNumber]), fin(htx[:timeStamp]), fnm(htx[:blockReward]), fqt(htx[:iax]), fin(ops.dig(:h, htx[:blockNumber]))].join(',')})"
315
+ vls = [fin(htx[:blockNumber]), fin(htx[:timeStamp]), fnm(htx[:blockReward]), fqt(htx[:iax]), fin(ops.dig(:h, htx[:blockNumber]))]
316
+ "(#{vls.join(',')})"
319
317
  end
320
318
 
321
319
  # @param [Hash] htx transacao withdrawals etherscan
322
320
  # @return [String] valores formatados nethi (withdrawals parte1)
323
321
  def nethw_val(htx)
324
- "(#{[
322
+ vls = [
325
323
  fin(htx[:withdrawalIndex]),
326
324
  fin(htx[:validatorIndex]),
327
325
  fqt(htx[:address]),
@@ -329,13 +327,14 @@ module Cns
329
327
  fin(htx[:blockNumber]),
330
328
  fin(htx[:timestamp]),
331
329
  fin(ops.dig(:h, htx[:withdrawalIndex]))
332
- ].join(',')})"
330
+ ]
331
+ "(#{vls.join(',')})"
333
332
  end
334
333
 
335
334
  # @param [Hash] hkx token event etherscan
336
335
  # @return [String] valores formatados nethk (token parte1)
337
336
  def nethk_val(htx)
338
- "(#{[
337
+ vls = [
339
338
  fin(htx[:blockNumber]),
340
339
  fin(htx[:timeStamp]),
341
340
  fqt(htx[:hash]),
@@ -355,7 +354,8 @@ module Cns
355
354
  fqt(htx[:input]),
356
355
  fqt(htx[:contractAddress]),
357
356
  fin(ops.dig(:h, htx[:hash]))
358
- ].join(',')})"
357
+ ]
358
+ "(#{vls.join(',')})"
359
359
  end
360
360
 
361
361
  # @example (see Apibc#ledger_gm)
@@ -366,7 +366,7 @@ module Cns
366
366
  dat = act[:data]
367
367
  qtd = dat[:quantity].to_s
368
368
  str = dat[:memo].inspect
369
- "(#{[
369
+ vls = [
370
370
  fin(htx[:global_action_seq]),
371
371
  fin(htx[:account_action_seq]),
372
372
  fin(htx[:block_num]),
@@ -376,17 +376,18 @@ module Cns
376
376
  fqt(dat[:from]),
377
377
  fqt(dat[:to]),
378
378
  fqt(htx[:iax]),
379
- qtd.to_d,
379
+ fnm(qtd),
380
380
  fqt(qtd[/[[:upper:]]+/]),
381
381
  fqt(str),
382
382
  fin(ops.dig(:h, htx[:itx]))
383
- ].join(',')})"
383
+ ]
384
+ "(#{vls.join(',')})"
384
385
  end
385
386
 
386
387
  # @param [Hash] htx trade bitcoinde
387
388
  # @return [String] valores formatados det (trades parte1)
388
389
  def cdet_val(htx)
389
- "(#{[
390
+ vls = [
390
391
  fqt(htx[:trade_id]),
391
392
  fts(htx[:successfully_finished_at]),
392
393
  fqt(htx[:type]),
@@ -395,7 +396,8 @@ module Cns
395
396
  fnm(htx[:volume_currency_to_pay_after_fee]),
396
397
  fts(htx[:trade_marked_as_paid_at]),
397
398
  fin(ops.dig(:h, htx[:trade_id]))
398
- ].join(',')})"
399
+ ]
400
+ "(#{vls.join(',')})"
399
401
  end
400
402
 
401
403
  # @param [Hash] hlx ledger (deposits + withdrawals) bitcoinde
@@ -403,22 +405,24 @@ module Cns
403
405
  def cdel_val(htx)
404
406
  tip = htx[:tp]
405
407
  qtd = htx[:qt]
406
- "(#{[
408
+ vls = [
407
409
  fin(htx[:txid]),
408
410
  fts(htx[:time].iso8601),
409
411
  fqt(tip),
410
412
  fqt(htx[:add]),
411
413
  fqt(htx[:moe]),
412
- fnm(tip == 'withdrawal' ? "-#{qtd}" : qtd),
414
+ fnm(tip == 'withdrawal' ? "-#{qtd}" : "#{qtd}"),
413
415
  fnm(htx[:fee])
414
- ].join(',')})"
416
+ ]
417
+ "(#{vls.join(',')})"
415
418
  end
416
419
 
417
420
  # @param [String] idx identificador transacao
418
421
  # @param [Hash] htx trade kraken
419
422
  # @return [String] valores formatados ust (trades parte1)
420
423
  def cust_val(idx, htx)
421
- "(#{[
424
+ ldg = apius.exd[:kl].select { |_, obj| obj[:refid] == idx.to_s }.keys.join(',')
425
+ vls = [
422
426
  fqt(idx),
423
427
  fqt(htx[:ordertxid]),
424
428
  fqt(htx[:pair]),
@@ -431,16 +435,18 @@ module Cns
431
435
  fnm(htx[:vol]),
432
436
  fnm(htx[:margin]),
433
437
  fqt(htx[:misc]),
434
- fqt(apius.novcusl.select { |_, obj| obj[:refid] == idx.to_s }.keys.join(',')),
438
+ fqt(ldg),
435
439
  fin(ops.dig(:h, idx))
436
- ].join(',')})"
440
+ ]
441
+ "(#{vls.join(',')})"
437
442
  end
438
443
 
439
444
  # @param idx (see ust_val)
440
445
  # @param [Hash] hlx ledger kraken
441
446
  # @return [String] valores formatados usl (ledger)
442
447
  def cusl_val(idx, hlx)
443
- "(#{[fqt(idx), fqt(hlx[:refid]), ftm(hlx[:time]), fqt(hlx[:type]), fqt(hlx[:aclass]), fqt(hlx[:asset]), fnm(hlx[:amount]), fnm(hlx[:fee])].join(',')})"
448
+ vls = [fqt(idx), fqt(hlx[:refid]), ftm(hlx[:time]), fqt(hlx[:type]), fqt(hlx[:aclass]), fqt(hlx[:asset]), fnm(hlx[:amount]), fnm(hlx[:fee])]
449
+ "(#{vls.join(',')})"
444
450
  end
445
451
  end
446
452
  end
data/lib/cns/bitcoinde.rb CHANGED
@@ -36,13 +36,13 @@ module Cns
36
36
  end
37
37
 
38
38
  # @return [String] texto saldos & transacoes & ajuste dias
39
- def mostra_resumo
39
+ def mresumo
40
40
  puts("\nBITCOINDE\ntipo bitcoinde bigquery")
41
41
  exd[:sl].sort { |ant, prx| ant <=> prx }.each { |key, val| puts(formata_saldos(key, val)) }
42
- mostra_totais
42
+ mtotais
43
43
 
44
- mostra_trades
45
- mostra_ledger
44
+ mtrades
45
+ mledger
46
46
  return if novcdet.empty?
47
47
 
48
48
  puts("\nstring ajuste dias dos trades\n-h=#{kyt.map { |obj| "#{obj}:0" }.join(' ')}")
@@ -108,7 +108,7 @@ module Cns
108
108
  end
109
109
 
110
110
  # @return [String] texto numero de transacoes
111
- def mostra_totais
111
+ def mtotais
112
112
  vtt = exd[:tt].count
113
113
  vnt = bqd[:nt].count
114
114
  vtl = exd[:tl].count
@@ -119,7 +119,7 @@ module Cns
119
119
  end
120
120
 
121
121
  # @return [String] texto transacoes trades
122
- def mostra_trades
122
+ def mtrades
123
123
  return unless ops[:v] && !novcdet.empty?
124
124
 
125
125
  puts("\ntrades data hora dt criacao tipo par qtd eur")
@@ -127,7 +127,7 @@ module Cns
127
127
  end
128
128
 
129
129
  # @return [String] texto transacoes ledger
130
- def mostra_ledger
130
+ def mledger
131
131
  return unless ops[:v] && !novcdel.empty?
132
132
 
133
133
  puts("\nledger data hora tipo moe quantidade custo")
data/lib/cns/etherscan.rb CHANGED
@@ -188,31 +188,31 @@ module Cns
188
188
  end
189
189
 
190
190
  # @return [String] texto carteiras & transacoes & ajuste dias
191
- def mostra_resumo_simples
191
+ def mresumo_simples
192
192
  return unless dados.count.positive?
193
193
 
194
194
  puts("\nid address etherscan bigquery")
195
195
  dados.each { |obj| puts(formata_carteira_simples(obj)) }
196
- mostra_tx_norml
197
- mostra_tx_inter
198
- mostra_tx_block
199
- mostra_tx_token
200
- mostra_tx_withw
201
- mostra_configuracao_ajuste_dias
196
+ mtx_norml
197
+ mtx_inter
198
+ mtx_block
199
+ mtx_token
200
+ mtx_withw
201
+ mconfiguracao_ajuste_dias
202
202
  end
203
203
 
204
204
  # @return [String] texto carteiras & transacoes & ajuste dias
205
- def mostra_resumo
205
+ def mresumo
206
206
  return unless dados.count.positive?
207
207
 
208
208
  puts("\nid address etherscan tn ti tb tk tw bigquery tn ti tb tk tw")
209
209
  dados.each { |obj| puts(formata_carteira(obj)) }
210
- mostra_tx_norml
211
- mostra_tx_inter
212
- mostra_tx_block
213
- mostra_tx_token
214
- mostra_tx_withw
215
- mostra_configuracao_ajuste_dias
210
+ mtx_norml
211
+ mtx_inter
212
+ mtx_block
213
+ mtx_token
214
+ mtx_withw
215
+ mconfiguracao_ajuste_dias
216
216
  end
217
217
 
218
218
  # @param [Hash] hjn dados juntos bigquery & etherscan
@@ -356,7 +356,7 @@ module Cns
356
356
  end
357
357
 
358
358
  # @return [String] texto transacoes normais
359
- def mostra_tx_norml
359
+ def mtx_norml
360
360
  return unless ops[:v] && novnetht.count.positive?
361
361
 
362
362
  puts("\ntx normal from to data valor")
@@ -364,7 +364,7 @@ module Cns
364
364
  end
365
365
 
366
366
  # @return [String] texto transacoes internas
367
- def mostra_tx_inter
367
+ def mtx_inter
368
368
  return unless ops[:v] && novnethi.count.positive?
369
369
 
370
370
  puts("\ntx intern from to data valor")
@@ -372,7 +372,7 @@ module Cns
372
372
  end
373
373
 
374
374
  # @return [String] texto transacoes block
375
- def mostra_tx_block
375
+ def mtx_block
376
376
  return unless ops[:v] && novnethp.count.positive?
377
377
 
378
378
  puts("\ntx block address data valor")
@@ -380,7 +380,7 @@ module Cns
380
380
  end
381
381
 
382
382
  # @return [String] texto transacoes token
383
- def mostra_tx_token
383
+ def mtx_token
384
384
  return unless ops[:v] && novnethk.count.positive?
385
385
 
386
386
  puts("\ntx token from to data valor moeda")
@@ -388,7 +388,7 @@ module Cns
388
388
  end
389
389
 
390
390
  # @return [String] texto transacoes withdrawals
391
- def mostra_tx_withw
391
+ def mtx_withw
392
392
  return unless ops[:v] && novnethw.count.positive?
393
393
 
394
394
  puts("\nwithdrawal validator data valor")
@@ -396,7 +396,7 @@ module Cns
396
396
  end
397
397
 
398
398
  # @return [String] texto configuracao ajuste dias das transacoes (normais & token)
399
- def mostra_configuracao_ajuste_dias
399
+ def mconfiguracao_ajuste_dias
400
400
  puts("\najuste dias transacoes normais \n-h=#{sortx.map { |obj| "#{obj[:hash]}:0" }.join(' ')}") if novnetht.count.positive?
401
401
  puts("\najuste dias transacoes internas \n-h=#{sorix.map { |obj| "#{obj[:hash]}:0" }.join(' ')}") if novnethi.count.positive?
402
402
  puts("\najuste dias transacoes block \n-h=#{sorpx.map { |obj| "#{obj[:blockNumber]}:0" }.join(' ')}") if novnethp.count.positive?
data/lib/cns/greymass.rb CHANGED
@@ -99,13 +99,13 @@ module Cns
99
99
  end
100
100
 
101
101
  # @return [String] texto carteiras & transacoes & ajuste dias
102
- def mostra_resumo
102
+ def mresumo
103
103
  return unless dados.count.positive?
104
104
 
105
105
  puts("\naddress greymass ntx bigquery ntx")
106
106
  dados.each { |obj| puts(formata_carteira(obj)) }
107
- mostra_transacoes_novas
108
- mostra_configuracao_ajuste_dias
107
+ mtransacoes_novas
108
+ mconfiguracao_ajuste_dias
109
109
  end
110
110
 
111
111
  # @param [Hash] hjn dados juntos bigquery & greymass
@@ -145,7 +145,7 @@ module Cns
145
145
  end
146
146
 
147
147
  # @return [String] texto transacoes
148
- def mostra_transacoes_novas
148
+ def mtransacoes_novas
149
149
  return unless ops[:v] && novneost.count.positive?
150
150
 
151
151
  puts("\nsequence num from to accao data valor moeda")
@@ -153,7 +153,7 @@ module Cns
153
153
  end
154
154
 
155
155
  # @return [String] texto configuracao ajuste dias das transacoes
156
- def mostra_configuracao_ajuste_dias
156
+ def mconfiguracao_ajuste_dias
157
157
  return unless novneost.count.positive?
158
158
 
159
159
  puts("\nstring ajuste dias\n-h=#{novneost.sort { |ant, prx| prx[:itx] <=> ant[:itx] }.map { |obj| "#{obj[:itx]}:0" }.join(' ')}")
data/lib/cns/kraken.rb CHANGED
@@ -36,13 +36,13 @@ module Cns
36
36
  end
37
37
 
38
38
  # @return [String] texto saldos & transacoes & ajuste dias
39
- def mostra_resumo
39
+ def mresumo
40
40
  puts("\nKRAKEN\ntipo kraken bigquery")
41
41
  exd[:sl].sort { |ant, prx| ant <=> prx }.each { |key, val| puts(formata_saldos(key, val)) }
42
- mostra_totais
42
+ mtotais
43
43
 
44
- mostra_trades
45
- mostra_ledger
44
+ mtrades
45
+ mledger
46
46
  return if novcust.empty?
47
47
 
48
48
  puts("\nstring ajuste dias dos trades\n-h=#{kyt.map { |obj| "#{obj}:0" }.join(' ')}")
@@ -84,7 +84,7 @@ module Cns
84
84
  # @return [String] texto formatado trade
85
85
  def formata_trades(idx, htx)
86
86
  format(
87
- '%<ky>-6.6s %<dt>19.19s %<ty>-10.10s %<mo>-8.8s %<pr>8.2f %<vl>15.7f %<co>8.2f',
87
+ '%<ky>-6.6s %<dt>19.19s %<ty>-10.10s %<mo>-8.8s %<pr>8.2f %<vl>10.4f %<co>13.2f',
88
88
  ky: idx,
89
89
  dt: Time.at(htx[:time]),
90
90
  ty: "#{htx[:type]}/#{htx[:ordertype]}",
@@ -111,7 +111,7 @@ module Cns
111
111
  end
112
112
 
113
113
  # @return [String] texto totais numero de transacoes
114
- def mostra_totais
114
+ def mtotais
115
115
  vkt = exd[:kt].count
116
116
  vnt = bqd[:nt].count
117
117
  vkl = exd[:kl].count
@@ -122,15 +122,15 @@ module Cns
122
122
  end
123
123
 
124
124
  # @return [String] texto transacoes trades
125
- def mostra_trades
125
+ def mtrades
126
126
  return unless ops[:v] && novcust.count.positive?
127
127
 
128
- puts("\ntrade data hora tipo par preco volume custo")
128
+ puts("\ntrade data hora tipo par preco volume custo")
129
129
  novcust.sort { |ant, prx| prx[1][:time] <=> ant[1][:time] }.each { |key, val| puts(formata_trades(key, val)) }
130
130
  end
131
131
 
132
132
  # @return [String] texto transacoes ledger
133
- def mostra_ledger
133
+ def mledger
134
134
  return unless ops[:v] && novcusl.count.positive?
135
135
 
136
136
  puts("\nledger data hora tipo moeda quantidade custo")
data/lib/cns/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cns
4
- VERSION = '0.8.6'
4
+ VERSION = '0.8.7'
5
5
  end
data/lib/cns.rb CHANGED
@@ -18,21 +18,21 @@ module Cns
18
18
  option :t, type: :boolean, default: false, desc: 'mostra transacoes todas ou somente novas'
19
19
  # mostra eth transacoes
20
20
  def seth
21
- Bigquery.new(options).mostra_seth
21
+ Bigquery.new(options).mseth
22
22
  end
23
23
 
24
24
  desc 'weth', 'carrega transacoes eth no bigquery'
25
25
  option :h, type: :hash, default: {}, desc: 'configuracao ajuste reposicionamento temporal'
26
26
  # carrega transacoes eth no bigquery
27
27
  def weth
28
- Bigquery.new(options).processa_weth
28
+ Bigquery.new(options).pweth
29
29
  end
30
30
 
31
31
  desc 'ceth', 'carrega transacoes eth no bigquery (cron)'
32
32
  option :h, type: :hash, default: {}, desc: 'configuracao ajuste reposicionamento temporal'
33
33
  # carrega transacoes eth no bigquery (output to file)
34
34
  def ceth
35
- Bigquery.new(options).processa_ceth
35
+ Bigquery.new(options).pceth
36
36
  end
37
37
 
38
38
  desc 'skrk', 'mostra kraken/eth transacoes'
@@ -40,21 +40,21 @@ module Cns
40
40
  option :t, type: :boolean, default: false, desc: 'mostra transacoes todas ou somente novas'
41
41
  # mostra kraken/eth transacoes
42
42
  def skrk
43
- Bigquery.new(options).mostra_skrk
43
+ Bigquery.new(options).mskrk
44
44
  end
45
45
 
46
46
  desc 'wkrk', 'carrega transacoes kraken/eth no bigquery'
47
47
  option :h, type: :hash, default: {}, desc: 'configuracao ajuste reposicionamento temporal'
48
48
  # carrega transacoes kraken/eth no bigquery
49
49
  def wkrk
50
- Bigquery.new(options).processa_wkrk
50
+ Bigquery.new(options).pwkrk
51
51
  end
52
52
 
53
53
  desc 'work', 'carrega transacoes novas no bigquery'
54
54
  option :h, type: :hash, default: {}, desc: 'configuracao ajuste reposicionamento temporal'
55
55
  # carrega transacoes novas no bigquery
56
56
  def work
57
- Bigquery.new(options).processa_tudo
57
+ Bigquery.new(options).ptudo
58
58
  end
59
59
 
60
60
  desc 'show', 'mostra resumo transacoes'
@@ -62,7 +62,7 @@ module Cns
62
62
  option :t, type: :boolean, default: false, desc: 'mostra transacoes todas ou somente novas'
63
63
  # mostra resumo transacoes
64
64
  def show
65
- Bigquery.new(options).mostra_tudo
65
+ Bigquery.new(options).mtudo
66
66
  end
67
67
 
68
68
  default_task :seth
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.6
4
+ version: 0.8.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hernâni Rodrigues Vaz
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-02-23 00:00:00.000000000 Z
10
+ date: 2025-02-24 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: bundler