cns 0.4.6 → 0.4.8

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: 3bd191d0bb2b6088a834f51983adbce314f78ce5a55dde2b2ed572cdc601a469
4
- data.tar.gz: '0816b8caf6d0942c023d10666dc14fd7ec2a154d6014cbd2130fe2e687b5d26c'
3
+ metadata.gz: 2790e7da51024d539650ff511f3c998a50c4e25f70608d9211f9c36f0afdc80a
4
+ data.tar.gz: 551634b476b5c41741c4f0fa54e36e6e5ef161d8ac060bff4e11b2a1982ef4bf
5
5
  SHA512:
6
- metadata.gz: fc08e7233ff15f27d006a452fa8df0e8d2e5070d5d26d64636162aee9bf20059bdf4f68ad520103d9b7125ee9094d7f579effa9341effd56b5edf7bb704d9950
7
- data.tar.gz: 603fe81b5a5437c087fcc8f1214716831ef172b0291a1c2c04cd2b021ad5d7310e9da00bc48aa97dd9172e4f9c298f39bd518c4a11e345d8034834bb78f68b6d
6
+ metadata.gz: 48b229ceb863336d1bc1ac6335fe644f5348f324ecac26856f1b1021d31433c9e951f3085f0db949a0f72c354287c994c9c4e2421b5a26e97585100dfa4dbf76
7
+ data.tar.gz: '01822b2bbb01e2df7c0dc7f9e893b40961a2b9c4ca4ca79ce14e117b582ff7b08c5aaf35117c0f01e2f87726401a07eec4f0099bf5b2ed2025e9ad7a65f65728'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cns (0.4.6)
4
+ cns (0.4.8)
5
5
  curb
6
6
  faraday
7
7
  google-cloud-bigquery
@@ -42,11 +42,11 @@ GEM
42
42
  google-cloud-core (~> 1.6)
43
43
  googleauth (>= 0.16.2, < 2.a)
44
44
  mini_mime (~> 1.0)
45
- google-cloud-core (1.6.0)
46
- google-cloud-env (~> 1.0)
45
+ google-cloud-core (1.6.1)
46
+ google-cloud-env (>= 1.0, < 3.a)
47
47
  google-cloud-errors (~> 1.0)
48
- google-cloud-env (1.6.0)
49
- faraday (>= 0.17.3, < 3.0)
48
+ google-cloud-env (2.0.1)
49
+ faraday (>= 1.0, < 3.a)
50
50
  google-cloud-errors (1.3.1)
51
51
  googleauth (1.8.1)
52
52
  faraday (>= 0.17.3, < 3.a)
@@ -80,7 +80,7 @@ GEM
80
80
  parser (>= 2.5.0.0, < 2.8, != 2.5.1.1)
81
81
  psych (~> 3.1)
82
82
  rainbow (>= 2.0, < 4.0)
83
- regexp_parser (2.8.2)
83
+ regexp_parser (2.8.3)
84
84
  representable (3.2.0)
85
85
  declarative (< 0.1.0)
86
86
  trailblazer-option (>= 0.1.1, < 0.2.0)
data/lib/cns/bigquery.rb CHANGED
@@ -6,6 +6,7 @@ require('bigdecimal/util')
6
6
  # @author Hernani Rodrigues Vaz
7
7
  module Cns
8
8
  BD = 'hernanirvaz.coins'
9
+ FO = File.expand_path('~/' + File.basename($0) + '.log')
9
10
 
10
11
  # classe para processar bigquery
11
12
  class Bigquery
@@ -67,39 +68,52 @@ module Cns
67
68
  puts(Time.now.strftime("TRANSACOES %Y-%m-%d %H:%M ") + processa_eth)
68
69
  end
69
70
 
71
+ # insere (caso existam) dados novos etherscan no bigquery (output to file)
72
+ def processa_ceth
73
+ File.open(FO, mode: 'a') { |out| out.puts(Time.now.strftime("TRANSACOES %Y-%m-%d %H:%M ") + processa_eth) }
74
+ end
75
+
70
76
  private
71
77
 
72
78
  # insere transacoes blockchain novas nas tabelas etht (norml), ethi (internas), ethp (block), ethw (withdrawals), ethk (token)
79
+ #
80
+ # @return [String] linhas & tabelas afetadas
73
81
  def processa_eth
74
82
  str = "ETH"
75
- str << format(" %<n>i etht", n: dml(etht_ins)) if apies.novtx.count > 0
76
- str << format(" %<n>i ethi", n: dml(ethi_ins)) if apies.novix.count > 0
77
- str << format(" %<n>i ethp", n: dml(ethp_ins)) if apies.novpx.count > 0
78
- str << format(" %<n>i ethw", n: dml(ethw_ins)) if apies.novwx.count > 0
79
- str << format(" %<n>i ethk", n: dml(ethk_ins)) if apies.novkx.count > 0
83
+ str += format(" %<n>i etht", n: dml(etht_ins)) if apies.novtx.count > 0
84
+ str += format(" %<n>i ethi", n: dml(ethi_ins)) if apies.novix.count > 0
85
+ str += format(" %<n>i ethp", n: dml(ethp_ins)) if apies.novpx.count > 0
86
+ str += format(" %<n>i ethw", n: dml(ethw_ins)) if apies.novwx.count > 0
87
+ str += format(" %<n>i ethk", n: dml(ethk_ins)) if apies.novkx.count > 0
80
88
  str
81
89
  end
82
90
 
83
91
  # insere transacoes exchange kraken novas nas tabelas ust (trades), usl (ledger)
92
+ #
93
+ # @return [String] linhas & tabelas afetadas
84
94
  def processa_us
85
95
  str = "KRAKEN"
86
- str << format(" %<n>i ust", n: dml(ust_ins)) if apius.trades.count > 0
87
- str << format(" %<n>i usl", n: dml(usl_ins)) if apius.ledger.count > 0
96
+ str += format(" %<n>i ust", n: dml(ust_ins)) if apius.trades.count > 0
97
+ str += format(" %<n>i usl", n: dml(usl_ins)) if apius.ledger.count > 0
88
98
  str
89
99
  end
90
100
 
91
101
  # insere transacoes exchange bitcoinde novas nas tabelas det (trades), del (ledger)
102
+ #
103
+ # @return [String] linhas & tabelas afetadas
92
104
  def processa_de
93
105
  str = "BITCOINDE"
94
- str << format(" %<n>i det", n: dml(det_ins)) if apide.trades.count > 0
95
- str << format(" %<n>i del", n: dml(del_ins)) if apide.ledger.count > 0
106
+ str += format(" %<n>i det", n: dml(det_ins)) if apide.trades.count > 0
107
+ str += format(" %<n>i del", n: dml(del_ins)) if apide.ledger.count > 0
96
108
  str
97
109
  end
98
110
 
99
111
  # insere transacoes blockchain novas na tabela eos
112
+ #
113
+ # @return [String] linhas & tabelas afetadas
100
114
  def processa_eos
101
115
  str = "EOS"
102
- str << format(" %<n>i eos ", n: dml(eost_ins)) if apigm.novax.count > 0
116
+ str += format(" %<n>i eos ", n: dml(eost_ins)) if apigm.novax.count > 0
103
117
  str
104
118
  end
105
119
 
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.6'
4
+ VERSION = '0.4.8'
5
5
  end
data/lib/cns.rb CHANGED
@@ -31,6 +31,13 @@ module Cns
31
31
  Bigquery.new(options).processa_weth
32
32
  end
33
33
 
34
+ desc 'ceth', 'carrega transacoes eth no bigquery (cron)'
35
+ option :h, type: :hash, default: {}, desc: 'configuracao ajuste reposicionamento temporal'
36
+ # carrega transacoes eth no bigquery (output to file)
37
+ def ceth
38
+ Bigquery.new(options).processa_ceth
39
+ end
40
+
34
41
  desc 'skrk', 'mostra kraken/eth transacoes'
35
42
  option :v, type: :boolean, default: true, desc: 'mostra transacoes'
36
43
  option :t, type: :boolean, default: false, desc: 'mostra transacoes todas ou somente novas'
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.6
4
+ version: 0.4.8
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-12-03 00:00:00.000000000 Z
11
+ date: 2023-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler