cns 0.4.0 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 334a8591863fae951394257a0438ee74c93dffcef41a6325bc52af78558db5b7
4
- data.tar.gz: 273a4345c1496657d551f401482218d28a827321b42012b175b5fe7228ee0e82
3
+ metadata.gz: ecd6c6f2d56a62e7cb1a64e9026e8201994261b81d537b38906850290794a4ba
4
+ data.tar.gz: 1403714b61b45a630032a3579bd469cd033a9aa0bc40291d5d2687bd4701425e
5
5
  SHA512:
6
- metadata.gz: 97c85c1c5a964348c13ddc21bbf2c9019b7188cf7e58c486410169957799a9ee6227e1830290fa7e09c4b264edc8e7a1c13ad92caa5c52344f57ef1d17212e63
7
- data.tar.gz: e2957ba0cdd37b4c3a6c34296f7a011a10b3e0face33faab6b1884faaab8748d1bbec91d9a5c51fee9b3c8f76e4589565f31dcb447d05e781aeca95f40aa1905
6
+ metadata.gz: 996a15cebd8abaa76f8e459b0149513369453ddd5b05eaa8dfaec9f15bae5f0b24596c4103baaa66b7aff266790f06a1ea0c0cd02e389f364d027a1f7fdc452e
7
+ data.tar.gz: 9beca3e56a939497c50bbd7d39b3d10fedf6a6017123d83a6ac060304c1fe07aae75491bfd6b0a68c01f0429dc4e3fd6edfea31a9afb1009925e022cc78a86d6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cns (0.4.0)
4
+ cns (0.4.2)
5
5
  curb
6
6
  faraday
7
7
  google-cloud-bigquery
@@ -10,7 +10,7 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- addressable (2.8.4)
13
+ addressable (2.8.5)
14
14
  public_suffix (>= 2.0.2, < 6.0)
15
15
  ast (2.4.2)
16
16
  backport (1.2.0)
@@ -23,9 +23,9 @@ GEM
23
23
  faraday-net_http (>= 2.0, < 3.1)
24
24
  ruby2_keywords (>= 0.0.4)
25
25
  faraday-net_http (3.0.2)
26
- google-apis-bigquery_v2 (0.56.0)
26
+ google-apis-bigquery_v2 (0.57.0)
27
27
  google-apis-core (>= 0.11.0, < 2.a)
28
- google-apis-core (0.11.0)
28
+ google-apis-core (0.11.1)
29
29
  addressable (~> 2.5, >= 2.5.1)
30
30
  googleauth (>= 0.16.2, < 2.a)
31
31
  httpclient (>= 2.8.1, < 3.a)
@@ -46,7 +46,7 @@ GEM
46
46
  google-cloud-env (1.6.0)
47
47
  faraday (>= 0.17.3, < 3.0)
48
48
  google-cloud-errors (1.3.1)
49
- googleauth (1.6.0)
49
+ googleauth (1.7.0)
50
50
  faraday (>= 0.17.3, < 3.a)
51
51
  jwt (>= 1.4, < 3.0)
52
52
  memoist (~> 0.16)
@@ -88,7 +88,7 @@ GEM
88
88
  retriable (3.1.2)
89
89
  reverse_markdown (2.1.1)
90
90
  nokogiri
91
- rexml (3.2.5)
91
+ rexml (3.2.6)
92
92
  rubocop (1.7.0)
93
93
  parallel (~> 1.10)
94
94
  parser (>= 2.7.1.5)
data/lib/cns/bigquery.rb CHANGED
@@ -41,6 +41,12 @@ module Cns
41
41
  #apibc.mostra_resumo
42
42
  end
43
43
 
44
+ # mostra situacao completa entre kraken/etherscan & bigquery
45
+ def mostra_skrk
46
+ apius.mostra_resumo
47
+ apies.mostra_resumo
48
+ end
49
+
44
50
  # insere (caso existam) dados novos kraken/bitcoinde/paymium/therock/etherscan/greymass/beaconchain no bigquery
45
51
  def processa_tudo
46
52
  processa_us
@@ -51,6 +57,12 @@ module Cns
51
57
  #processa_bc
52
58
  end
53
59
 
60
+ # insere (caso existam) dados novos kraken/etherscan/ no bigquery
61
+ def processa_wkrk
62
+ processa_us
63
+ processa_eth
64
+ end
65
+
54
66
  # insere transacoes blockchain novas nas tabelas etht (norml), ethi (internas), ethp (block), ethw (withdrawals), ethk (token)
55
67
  def processa_eth
56
68
  puts(format("%<n>4i TRANSACOES ETH NORMAIS\tINSERIDAS etht", n: apies.novtx.empty? ? 0 : dml(etht_ins)))
@@ -62,7 +74,8 @@ module Cns
62
74
 
63
75
  # insere transacoes blockchain novas nas tabelas etht (norml), ethi (internas), ethp (block), ethw (withdrawals), ethk (token)
64
76
  def processa_weth
65
- puts(format("%<m>16s etht %<t>4i NORMAIS\t;ethi %<i>4i INTERNAS\t;ethp %<p>4i BLOCK\t;ethw %<w>4i WITHDRAWALS\t;ethk %<k>4i TOKENS", m: Time.now.strftime("%Y-%m-%d %k:%M"), t: apies.novtx.empty? ? 0 : dml(etht_ins), i: apies.novix.empty? ? 0 : dml(ethi_ins), p: apies.novpx.empty? ? 0 : dml(ethp_ins), w: apies.novwx.empty? ? 0 : dml(ethw_ins), k: apies.novkx.empty? ? 0 : dml(ethk_ins)))
77
+ #puts(format("%<m>16s etht %<t>4i NORMAIS\t;ethi %<i>4i INTERNAS\t;ethp %<p>4i BLOCK\t;ethw %<w>4i WITHDRAWALS\t;ethk %<k>4i TOKENS", m: Time.now.strftime("%Y-%m-%d %k:%M"), t: apies.novtx.empty? ? 0 : dml(etht_ins), i: apies.novix.empty? ? 0 : dml(ethi_ins), p: apies.novpx.empty? ? 0 : dml(ethp_ins), w: apies.novwx.empty? ? 0 : dml(ethw_ins), k: apies.novkx.empty? ? 0 : dml(ethk_ins)))
78
+ processa_eth
66
79
  end
67
80
 
68
81
  private
data/lib/cns/bitcoinde.rb CHANGED
@@ -38,7 +38,7 @@ module Cns
38
38
  # @return [String] texto saldos & transacoes & ajuste dias
39
39
  def mostra_resumo
40
40
  puts("\nBITCOINDE\ntipo bitcoinde bigquery")
41
- exd[:sl].each { |key, val| puts(formata_saldos(key, val)) }
41
+ exd[:sl].sort { |ant, prx| ant <=> prx }.each { |key, val| puts(formata_saldos(key, val)) }
42
42
  mostra_totais
43
43
 
44
44
  mostra_trades
@@ -72,8 +72,8 @@ module Cns
72
72
  # @param [Hash] hsx saldo bitcoinde da moeda
73
73
  # @return [String] texto formatado saldos
74
74
  def formata_saldos(moe, hsx)
75
- vbq = bqd[:sl][moe.downcase.to_sym].to_d
76
- vex = hsx[:total_amount].to_d
75
+ vbq = bqd[:sl][moe.downcase.to_sym].to_d.round(9)
76
+ vex = hsx[:total_amount].to_d.round(9)
77
77
  format(
78
78
  '%<mo>-5.5s %<ex>21.9f %<bq>21.9f %<ok>3.3s',
79
79
  mo: moe.upcase,
data/lib/cns/kraken.rb CHANGED
@@ -38,7 +38,7 @@ module Cns
38
38
  # @return [String] texto saldos & transacoes & ajuste dias
39
39
  def mostra_resumo
40
40
  puts("\nKRAKEN\ntipo kraken bigquery")
41
- exd[:sl].each { |key, val| puts(formata_saldos(key, val)) }
41
+ exd[:sl].sort { |ant, prx| ant <=> prx }.each { |key, val| puts(formata_saldos(key, val)) }
42
42
  mostra_totais
43
43
 
44
44
  mostra_trades
@@ -72,8 +72,8 @@ module Cns
72
72
  # @param [BigDecimal] sal saldo kraken da moeda
73
73
  # @return [String] texto formatado saldos
74
74
  def formata_saldos(moe, sal)
75
- vbq = bqd[:sl][moe.downcase.to_sym].to_d
76
- vsl = sal.to_d
75
+ vbq = bqd[:sl][moe.downcase.to_sym].to_d.round(9)
76
+ vsl = sal.to_d.round(9)
77
77
  format(
78
78
  '%<mo>-5.5s %<kr>21.9f %<bq>21.9f %<ok>3.3s',
79
79
  mo: moe.upcase,
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.4.0'
4
+ VERSION = '0.4.2'
5
5
  end
data/lib/cns.rb CHANGED
@@ -23,6 +23,13 @@ module Cns
23
23
  Bigquery.new(options).processa_weth
24
24
  end
25
25
 
26
+ desc 'wkrk', 'carrega transacoes kraken/eth no bigquery'
27
+ option :h, type: :hash, default: {}, desc: 'configuracao ajuste reposicionamento temporal'
28
+ # carrega transacoes kraken/eth no bigquery
29
+ def wkrk
30
+ Bigquery.new(options).processa_wkrk
31
+ end
32
+
26
33
  desc 'work', 'carrega transacoes novas no bigquery'
27
34
  option :h, type: :hash, default: {}, desc: 'configuracao ajuste reposicionamento temporal'
28
35
  # carrega transacoes novas no bigquery
@@ -38,6 +45,14 @@ module Cns
38
45
  Bigquery.new(options).mostra_tudo
39
46
  end
40
47
 
41
- default_task :show
48
+ desc 'skrk', 'mostra kraken/eth transacoes'
49
+ option :v, type: :boolean, default: true, desc: 'mostra transacoes'
50
+ option :t, type: :boolean, default: false, desc: 'mostra transacoes todas ou somente novas'
51
+ # mostra kraken/eth transacoes
52
+ def skrk
53
+ Bigquery.new(options).mostra_skrk
54
+ end
55
+
56
+ default_task :skrk
42
57
  end
43
58
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hernâni Rodrigues Vaz
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-07-18 00:00:00.000000000 Z
11
+ date: 2023-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler