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], neost: %w[gseq aseq bnum time contract action acfrom acto iax amount moeda memo dias], heost: %i[global_action_seq account_action_seq block_num block_time account name from to iax quantity moe memo], 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', gmt: '', # limit 1091', 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/paymium/therock/etherscan/greymass & bigquery.
-
#pceth ⇒ Object
insere dados novos etherscan no bigquery (output to file).
-
#ptudo ⇒ Object
insere dados novos kraken/bitcoinde/etherscan/greymass 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.
63 64 65 66 67 68 |
# File 'lib/cns/bigquery.rb', line 63 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)
56 57 58 |
# File 'lib/cns/bigquery.rb', line 56 def api @api end |
#job ⇒ Google::Cloud::Bigquery, ... (readonly)
56 57 58 |
# File 'lib/cns/bigquery.rb', line 56 def job @job end |
#ops ⇒ Google::Cloud::Bigquery, ... (readonly)
56 57 58 |
# File 'lib/cns/bigquery.rb', line 56 def ops @ops end |
Instance Method Details
#mseth ⇒ Object
mostra situacao completa entre etherscan & bigquery
81 82 83 |
# File 'lib/cns/bigquery.rb', line 81 def mseth apies.mresumo_simples end |
#mskrk ⇒ Object
mostra situacao completa entre kraken/etherscan & bigquery
76 77 78 |
# File 'lib/cns/bigquery.rb', line 76 def mskrk [apius, apies].each(&:mresumo) end |
#mtudo ⇒ Object
mostra situacao completa entre kraken/bitcoinde/paymium/therock/etherscan/greymass & bigquery
71 72 73 |
# File 'lib/cns/bigquery.rb', line 71 def mtudo [apius, apide, apies].each(&:mresumo) end |
#pceth ⇒ Object
insere dados novos etherscan no bigquery (output to file)
106 107 108 |
# File 'lib/cns/bigquery.rb', line 106 def pceth File.open(FO, mode: 'a') { |o| o.puts("#{tct} #{peth(apiec)}") } end |
#ptudo ⇒ Object
insere dados novos kraken/bitcoinde/etherscan/greymass no bigquery
91 92 93 |
# File 'lib/cns/bigquery.rb', line 91 def ptudo puts("#{tct} #{pus}, #{pde}, #{peth(apies)}") end |
#pweth ⇒ Object
insere dados novos etherscan no bigquery
101 102 103 |
# File 'lib/cns/bigquery.rb', line 101 def pweth puts("#{tct} #{peth(apies)}") end |
#pwkrk ⇒ Object
insere dados novos kraken/etherscan no bigquery
96 97 98 |
# File 'lib/cns/bigquery.rb', line 96 def pwkrk puts("#{tct} #{pus}, #{peth(apies)}") end |
#tct ⇒ String
Returns texto inicial transacoes.
86 87 88 |
# File 'lib/cns/bigquery.rb', line 86 def tct Time.now.strftime('TRANSACOES %Y-%m-%d %H:%M:%S') end |