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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/cns/bigquery.rb +68 -62
- data/lib/cns/bitcoinde.rb +7 -7
- data/lib/cns/etherscan.rb +20 -20
- data/lib/cns/greymass.rb +5 -5
- data/lib/cns/kraken.rb +9 -9
- data/lib/cns/version.rb +1 -1
- data/lib/cns.rb +7 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3630eeaca7e56e765e2702bc46c885b19c9e5127239f6788ce510358d3b2d7e
|
4
|
+
data.tar.gz: b2b87a278f6042d604d964f1c2bdd8d20db4b7a7d8d3c9448f36afbc2e2d8a08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec9c373225a2870fa14bc4eeefde9c20f6a2152a173108ce14e0f6b4bf948c7784b85337c3b0dc2f94ebaae005313c9145849805eff161f6bff094538ba942eb
|
7
|
+
data.tar.gz: ebd9ed2c6d303bd6e6ba9fd533b9d9198dd8751ebe2f86c81e4b8dfcae4e5b8e632310e45a322b9dd1ed7f78a1bda4efb0a4127fc953710b133f2248b009722c
|
data/Gemfile.lock
CHANGED
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
|
45
|
-
apius.
|
46
|
-
apide.
|
47
|
-
apies.
|
48
|
-
apigm.
|
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
|
53
|
-
apius.
|
54
|
-
apies.
|
52
|
+
def mskrk
|
53
|
+
apius.mresumo
|
54
|
+
apies.mresumo
|
55
55
|
end
|
56
56
|
|
57
57
|
# mostra situacao completa entre etherscan & bigquery
|
58
|
-
def
|
59
|
-
apies.
|
58
|
+
def mseth
|
59
|
+
apies.mresumo_simples
|
60
60
|
end
|
61
61
|
|
62
62
|
# @return [String] texto inicial transacoes
|
63
|
-
def
|
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
|
69
|
-
puts(
|
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
|
74
|
-
puts(
|
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
|
79
|
-
puts(
|
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
|
84
|
-
File.open(FO, mode: 'a') { |out| out.puts(
|
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
|
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
|
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
|
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
|
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
|
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
|
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 ||=
|
170
|
+
@apies ||= apiesg('netb')
|
172
171
|
end
|
173
172
|
|
174
173
|
# @return [Etherscan] API blockchain ETH
|
175
174
|
def apiesc
|
176
|
-
@apiesc ||=
|
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
|
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
|
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
|
-
|
241
|
-
|
242
|
-
"'#{value}'"
|
239
|
+
value.nil? || value.empty? ? 'null' : "'#{value}'"
|
243
240
|
end
|
244
241
|
|
245
242
|
def fnm(value)
|
246
|
-
|
247
|
-
|
248
|
-
|
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
|
-
'
|
251
|
+
'0'
|
257
252
|
end
|
258
253
|
|
259
254
|
def ftm(sec)
|
260
|
-
"PARSE_DATETIME('%s', '#{
|
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
|
-
]
|
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
|
-
]
|
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
|
-
|
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
|
-
]
|
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
|
-
]
|
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
|
379
|
+
fnm(qtd),
|
380
380
|
fqt(qtd[/[[:upper:]]+/]),
|
381
381
|
fqt(str),
|
382
382
|
fin(ops.dig(:h, htx[:itx]))
|
383
|
-
]
|
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
|
-
]
|
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
|
-
]
|
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(
|
438
|
+
fqt(ldg),
|
435
439
|
fin(ops.dig(:h, idx))
|
436
|
-
]
|
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
|
-
|
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
|
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
|
-
|
42
|
+
mtotais
|
43
43
|
|
44
|
-
|
45
|
-
|
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
|
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
|
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
|
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
|
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
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
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
|
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
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
-
|
108
|
-
|
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
|
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
|
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
|
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
|
-
|
42
|
+
mtotais
|
43
43
|
|
44
|
-
|
45
|
-
|
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>
|
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
|
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
|
125
|
+
def mtrades
|
126
126
|
return unless ops[:v] && novcust.count.positive?
|
127
127
|
|
128
|
-
puts("\ntrade data hora tipo par preco
|
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
|
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
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).
|
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).
|
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).
|
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).
|
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).
|
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).
|
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).
|
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.
|
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-
|
10
|
+
date: 2025-02-24 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: bundler
|