Class: Cns::Bigquery
Overview
classe para processar bigquery
Constant Summary collapse
- BD =
'hernanirvaz.coins'- FO =
File.("~/#{File.basename($PROGRAM_NAME)}.log")
- TB =
{ netht: %w[txhash blocknumber timestamp nonce blockhash transactionindex axfrom axto iax value gas gasprice gasused iserror txreceipt_status input contractaddress dias], hetht: %i[hash blockNumber timeStamp nonce blockHash transactionIndex from to iax value gas gasPrice gasUsed isError txreceipt_status input contractAddress], nethi: %w[txhash blocknumber timestamp axfrom axto iax value contractaddress input type gas gasused traceid iserror errcode dias], hethi: %i[hash blockNumber timeStamp from to iax value contractAddress input type gas gasUsed traceId isError errCode], nethp: %w[blocknumber timestamp blockreward iax dias], hethp: %i[blockNumber timeStamp blockReward iax], nethw: %w[withdrawalindex validatorindex address amount blocknumber timestamp dias], hethw: %i[withdrawalIndex validatorIndex address amount blockNumber timeStamp], nethk: %w[txhash blocknumber timestamp nonce blockhash transactionindex axfrom axto iax value tokenname tokensymbol tokendecimal gas gasprice gasused input contractaddress dias], hethk: %i[hash blockNumber timeStamp nonce blockHash transactionIndex from to iax value tokenName tokenSymbol tokenDecimal gas gasPrice gasUsed input contractAddress], cdet: %w[txid time tp user btc eur dtc dias], hdet: %i[trade_id successfully_finished_at type username btc eur trade_marked_as_paid_at], cdel: %w[txid time tp add moe qt fee], hdel: %i[nxid time tp add moe qtd fee], cust: %w[txid ordertxid pair time type ordertype price cost fee vol margin misc ledgers dias], hust: %i[txid ordertxid pair time type ordertype price cost fee vol margin misc ledgers], cusl: %w[txid refid time type aclass asset amount fee], husl: %i[txid refid time type aclass asset amount fee] }.freeze
- TL =
para testes bigquery
{ ins: 'INSERT', exo: false, est: '', # limit 228', esi: '', # limit 22', esp: '', # limit 72', esw: '', # limit 2350', esk: '', # limit 20', ust: '', # limit 182', usl: '', # limit 448', det: '', # limit 27', del: '' # limit 16' }.freeze
Instance Attribute Summary collapse
- #api ⇒ Google::Cloud::Bigquery, ... readonly
- #job ⇒ Google::Cloud::Bigquery, ... readonly
- #ops ⇒ Google::Cloud::Bigquery, ... readonly
Instance Method Summary collapse
-
#initialize(pop) ⇒ Bigquery
constructor
API bigquery.
-
#mseth ⇒ Object
mostra situacao completa entre etherscan & bigquery.
-
#mskrk ⇒ Object
mostra situacao completa entre kraken/etherscan & bigquery.
-
#mtudo ⇒ Object
mostra situacao completa entre kraken/bitcoinde/etherscan & bigquery.
-
#pceth ⇒ Object
insere dados novos etherscan no bigquery (output to file).
-
#ptudo ⇒ Object
insere dados novos kraken/bitcoinde/etherscan no bigquery.
-
#pweth ⇒ Object
insere dados novos etherscan no bigquery.
-
#pwkrk ⇒ Object
insere dados novos kraken/etherscan no bigquery.
-
#tct ⇒ String
Texto inicial transacoes.
Constructor Details
#initialize(pop) ⇒ Bigquery
Returns API bigquery.
61 62 63 64 65 66 |
# File 'lib/cns/bigquery.rb', line 61 def initialize(pop) # usa env GOOGLE_APPLICATION_CREDENTIALS para obter credentials # @see https://cloud.google.com/bigquery/docs/authentication/getting-started @api = Google::Cloud::Bigquery.new @ops = pop.transform_keys(&:to_sym) end |
Instance Attribute Details
#api ⇒ Google::Cloud::Bigquery, ... (readonly)
54 55 56 |
# File 'lib/cns/bigquery.rb', line 54 def api @api end |
#job ⇒ Google::Cloud::Bigquery, ... (readonly)
54 55 56 |
# File 'lib/cns/bigquery.rb', line 54 def job @job end |
#ops ⇒ Google::Cloud::Bigquery, ... (readonly)
54 55 56 |
# File 'lib/cns/bigquery.rb', line 54 def ops @ops end |
Instance Method Details
#mseth ⇒ Object
mostra situacao completa entre etherscan & bigquery
79 80 81 |
# File 'lib/cns/bigquery.rb', line 79 def mseth apies.mresumo end |
#mskrk ⇒ Object
mostra situacao completa entre kraken/etherscan & bigquery
74 75 76 |
# File 'lib/cns/bigquery.rb', line 74 def mskrk [apius, apies].each(&:mresumo) end |
#mtudo ⇒ Object
mostra situacao completa entre kraken/bitcoinde/etherscan & bigquery
69 70 71 |
# File 'lib/cns/bigquery.rb', line 69 def mtudo [apius, apide, apies].each(&:mresumo) end |
#pceth ⇒ Object
insere dados novos etherscan no bigquery (output to file)
104 105 106 |
# File 'lib/cns/bigquery.rb', line 104 def pceth File.open(FO, mode: 'a') { |o| o.puts("#{tct} #{peth(apiec)}") } end |
#ptudo ⇒ Object
insere dados novos kraken/bitcoinde/etherscan no bigquery
89 90 91 |
# File 'lib/cns/bigquery.rb', line 89 def ptudo puts("#{tct} #{pus}, #{pde}, #{peth(apies)}") end |
#pweth ⇒ Object
insere dados novos etherscan no bigquery
99 100 101 |
# File 'lib/cns/bigquery.rb', line 99 def pweth puts("#{tct} #{peth(apies)}") end |
#pwkrk ⇒ Object
insere dados novos kraken/etherscan no bigquery
94 95 96 |
# File 'lib/cns/bigquery.rb', line 94 def pwkrk puts("#{tct} #{pus}, #{peth(apies)}") end |
#tct ⇒ String
Returns texto inicial transacoes.
84 85 86 |
# File 'lib/cns/bigquery.rb', line 84 def tct Time.now.strftime('TRANSACOES %Y-%m-%d %H:%M:%S') end |