cns 0.8.8 → 0.8.9
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 +4 -2
- data/lib/cns/bitcoinde.rb +19 -7
- data/lib/cns/greymass.rb +2 -2
- data/lib/cns/kraken.rb +19 -7
- data/lib/cns/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa9737420761247a9d82111220ba71741c591fa08fe035da2f8f4717cd8b179d
|
4
|
+
data.tar.gz: 6e5b7f03930de50c278a0a1d0a6442b6535c67bfa1874f0402b2c4075c363108
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92144b9670390bf051d131f2bdf1b35a8c475ac16fa935dc2f6bb37b04298a5304ceadceeac467da687d70e847ee5cfc3974d6deca8519b8a368c3bec446334d
|
7
|
+
data.tar.gz: 1f519cc3912a0ea47d1cabb557eb191c04dafd6dc308d08da23969ae2fc604f720f3441844c277b1259f446a20aad28645ccf4868d6c5e795efeef17e7f5ef97
|
data/Gemfile.lock
CHANGED
data/lib/cns/bigquery.rb
CHANGED
@@ -45,8 +45,8 @@ module Cns
|
|
45
45
|
def mtudo
|
46
46
|
apius.mresumo
|
47
47
|
apide.mresumo
|
48
|
-
apies.mresumo
|
49
|
-
apigm.mresumo
|
48
|
+
# apies.mresumo
|
49
|
+
# apigm.mresumo
|
50
50
|
end
|
51
51
|
|
52
52
|
# mostra situacao completa entre kraken/etherscan & bigquery
|
@@ -210,6 +210,7 @@ module Cns
|
|
210
210
|
novx = src.send("nov#{prx}#{itm}")
|
211
211
|
next if novx.empty?
|
212
212
|
|
213
|
+
# puts(insert_cus(prx, itm, novx))
|
213
214
|
str << format(' %<n>i %<t>s', n: dml(insert_cus(prx, itm, novx)), t: "#{prx}#{itm}")
|
214
215
|
end
|
215
216
|
str.join
|
@@ -220,6 +221,7 @@ module Cns
|
|
220
221
|
novx = src.send("nov#{prx}#{itm}")
|
221
222
|
next if novx.empty?
|
222
223
|
|
224
|
+
# puts(insert_out(prx, itm, novx))
|
223
225
|
str << format(' %<n>i %<t>s', n: dml(insert_out(prx, itm, novx)), t: "#{prx}#{itm}")
|
224
226
|
end
|
225
227
|
str.join
|
data/lib/cns/bitcoinde.rb
CHANGED
@@ -25,6 +25,11 @@ module Cns
|
|
25
25
|
@ops = pop.transform_keys(&:to_sym)
|
26
26
|
end
|
27
27
|
|
28
|
+
# @return [Hash] dados exchange bitcoinde - saldos & trades & deposits & withdrawals
|
29
|
+
def exd
|
30
|
+
@exd ||= { sl: pdea(api.account_de), tt: pdet(api.trades_de), tl: pdel(api.deposits_de + api.withdrawals_de) }
|
31
|
+
end
|
32
|
+
|
28
33
|
# @return [Array<Hash>] lista trades bitcoinde novos
|
29
34
|
def novcdet
|
30
35
|
@novcdet ||= exd[:tt].select { |obj| kyt.include?(obj[:trade_id]) }
|
@@ -48,19 +53,28 @@ module Cns
|
|
48
53
|
puts("\nstring ajuste dias dos trades\n-h=#{kyt.map { |obj| "#{obj}:0" }.join(' ')}")
|
49
54
|
end
|
50
55
|
|
51
|
-
|
52
|
-
|
53
|
-
|
56
|
+
private
|
57
|
+
|
58
|
+
def show_all?
|
59
|
+
ops[:t] || false
|
60
|
+
end
|
61
|
+
|
62
|
+
def bqkyt
|
63
|
+
show_all? ? [] : (bqd[:nt]&.map { |t| t[:txid] } || [])
|
64
|
+
end
|
65
|
+
|
66
|
+
def bqkyl
|
67
|
+
show_all? ? [] : (bqd[:nl]&.map { |l| l[:txid] } || [])
|
54
68
|
end
|
55
69
|
|
56
70
|
# @return [Array<String>] lista txid dos trades novos
|
57
71
|
def kyt
|
58
|
-
@kyt ||= exd[:tt].map { |oex| oex[:trade_id] }
|
72
|
+
@kyt ||= exd[:tt].map { |oex| oex[:trade_id] } - bqkyt
|
59
73
|
end
|
60
74
|
|
61
75
|
# @return [Array<Integer>] lista txid dos ledger novos
|
62
76
|
def kyl
|
63
|
-
@kyl ||= exd[:tl].map { |oex| oex[:txid] }
|
77
|
+
@kyl ||= exd[:tl].map { |oex| oex[:txid] } - bqkyl
|
64
78
|
end
|
65
79
|
|
66
80
|
# @param [String] moe codigo bitcoinde da moeda
|
@@ -134,8 +148,6 @@ module Cns
|
|
134
148
|
novcdel.sort_by { |itm| -itm[:srx] }.each { |obj| puts(formata_ledger(obj)) }
|
135
149
|
end
|
136
150
|
|
137
|
-
private
|
138
|
-
|
139
151
|
# Processa os trades para garantir que as datas estejam no formato correto
|
140
152
|
def pdea(itm)
|
141
153
|
itm.select { |ky1, _| EM.include?(ky1) }.transform_values { |o| o.merge(total_amount: o[:total_amount].to_d) }
|
data/lib/cns/greymass.rb
CHANGED
@@ -55,7 +55,7 @@ module Cns
|
|
55
55
|
# @return [Hash] dados greymass - address, saldo & transacoes
|
56
56
|
def base_bc(wbq)
|
57
57
|
xbq = wbq[:ax]
|
58
|
-
{ ax: xbq, sl: peosa(xbq).reduce(:+), tx:
|
58
|
+
{ ax: xbq, sl: peosa(xbq).reduce(:+), tx: peost(xbq, api.ledger_gm(xbq)) }
|
59
59
|
end
|
60
60
|
|
61
61
|
# @param wbq (see base_bc)
|
@@ -151,7 +151,7 @@ module Cns
|
|
151
151
|
# @param add (see Apibc#account_gm)
|
152
152
|
# @param [Array<Hash>] ary lista transacoes
|
153
153
|
# @return [Array<Hash>] lista transacoes filtrada
|
154
|
-
def
|
154
|
+
def peost(add, ary)
|
155
155
|
ary.map do |omp|
|
156
156
|
omp.merge(
|
157
157
|
name: (act = omp[:action_trace][:act])[:name],
|
data/lib/cns/kraken.rb
CHANGED
@@ -25,6 +25,11 @@ module Cns
|
|
25
25
|
@ops = pop.transform_keys(&:to_sym)
|
26
26
|
end
|
27
27
|
|
28
|
+
# @return [Hash] dados exchange kraken - saldos & transacoes trades e ledger
|
29
|
+
def exd
|
30
|
+
@exd ||= { sl: pusa(api.account_us), kt: pust(api.trades_us), kl: pusl(api.ledger_us) }
|
31
|
+
end
|
32
|
+
|
28
33
|
# @return [Hash] trades kraken novos
|
29
34
|
def novcust
|
30
35
|
@novcust ||= exd[:kt].slice(*kyt)
|
@@ -48,19 +53,28 @@ module Cns
|
|
48
53
|
puts("\nstring ajuste dias dos trades\n-h=#{kyt.map { |obj| "#{obj}:0" }.join(' ')}")
|
49
54
|
end
|
50
55
|
|
51
|
-
|
52
|
-
|
53
|
-
|
56
|
+
private
|
57
|
+
|
58
|
+
def show_all?
|
59
|
+
ops[:t] || false
|
60
|
+
end
|
61
|
+
|
62
|
+
def bqkyt
|
63
|
+
show_all? ? [] : (bqd[:nt]&.map { |t| t[:txid].to_sym } || [])
|
64
|
+
end
|
65
|
+
|
66
|
+
def bqkyl
|
67
|
+
show_all? ? [] : (bqd[:nl]&.map { |l| l[:txid].to_sym } || [])
|
54
68
|
end
|
55
69
|
|
56
70
|
# @return [Array<String>] lista txid dos trades novos
|
57
71
|
def kyt
|
58
|
-
@kyt ||= exd[:kt].keys -
|
72
|
+
@kyt ||= exd[:kt].keys - bqkyt
|
59
73
|
end
|
60
74
|
|
61
75
|
# @return [Array<String>] lista txid dos ledger novos
|
62
76
|
def kyl
|
63
|
-
@kyl ||= exd[:kl].keys -
|
77
|
+
@kyl ||= exd[:kl].keys - bqkyl
|
64
78
|
end
|
65
79
|
|
66
80
|
# @example (see Apice#account_us)
|
@@ -136,8 +150,6 @@ module Cns
|
|
136
150
|
novcusl.sort_by { |itm| -itm[1][:srx] }.each { |key, val| puts(formata_ledger(key, val)) }
|
137
151
|
end
|
138
152
|
|
139
|
-
private
|
140
|
-
|
141
153
|
# Processa os trades para garantir que as datas estejam no formato correto
|
142
154
|
def pusa(itm)
|
143
155
|
itm.select { |key, _| EM.include?(key) }.transform_values { |val| val.to_d }
|
data/lib/cns/version.rb
CHANGED