cns 0.4.6 → 0.4.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: 3bd191d0bb2b6088a834f51983adbce314f78ce5a55dde2b2ed572cdc601a469
4
- data.tar.gz: '0816b8caf6d0942c023d10666dc14fd7ec2a154d6014cbd2130fe2e687b5d26c'
3
+ metadata.gz: a24c9cad5196eefe37baa1ae78f0cf5a0f5357a8af744f04aa229984ffbad6e8
4
+ data.tar.gz: aafa7826231e9fcb8613bfb0ec5c290c4159fbd64301335c993669a562c640f6
5
5
  SHA512:
6
- metadata.gz: fc08e7233ff15f27d006a452fa8df0e8d2e5070d5d26d64636162aee9bf20059bdf4f68ad520103d9b7125ee9094d7f579effa9341effd56b5edf7bb704d9950
7
- data.tar.gz: 603fe81b5a5437c087fcc8f1214716831ef172b0291a1c2c04cd2b021ad5d7310e9da00bc48aa97dd9172e4f9c298f39bd518c4a11e345d8034834bb78f68b6d
6
+ metadata.gz: d405b5023ab78dcf8b3530fb2f37cc0722b417483a2fa62a43215e9589420758f9a1d6aaf108083ff06a088f695f84bbee0d08e5a2ecdf6fbbfe9669439ed2f7
7
+ data.tar.gz: 7e50888e671d94ac3c5f3b9557577295ebefacc95bd94473dd7f70c95f73f0099a2a9c1f58ea1bcae56dffc4e110506833cd478a492e969064ac1e51510e2ee9
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.7)
5
5
  curb
6
6
  faraday
7
7
  google-cloud-bigquery
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) + '.out')
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.7'
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,7 +1,7 @@
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.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hernâni Rodrigues Vaz