Class: Krkt::Client
- Inherits:
-
Object
- Object
- Krkt::Client
- Defined in:
- lib/krkt/client.rb
Overview
classe para processar dados no kraken
Instance Attribute Summary collapse
-
#aky ⇒ String
readonly
API key.
-
#asc ⇒ String
readonly
API secret.
-
#pru ⇒ String
readonly
API private url.
-
#pth ⇒ String
readonly
API private path.
-
#puu ⇒ String
readonly
API public url.
Instance Method Summary collapse
-
#balance ⇒ Hash
Saldos no kraken.
-
#initialize(pky: ENV['KRAKEN_API_KEY'], psc: ENV['KRAKEN_API_SECRET'], options: {}) ⇒ Client
constructor
API kraken base.
-
#ledger ⇒ Hash
Resultados ultimas transacoes ledger no kraken.
-
#server_time ⇒ Hash
Data hora kraken.
-
#trades_history ⇒ Hash
Resultados ultimas transacoes trades no kraken.
Constructor Details
#initialize(pky: ENV['KRAKEN_API_KEY'], psc: ENV['KRAKEN_API_SECRET'], options: {}) ⇒ Client
Returns API kraken base.
26 27 28 29 30 31 32 33 34 |
# File 'lib/krkt/client.rb', line 26 def initialize(pky: ENV['KRAKEN_API_KEY'], psc: ENV['KRAKEN_API_SECRET'], options: {}) b = .fetch(:base_uri, 'https://api.kraken.com') v = .fetch(:version, 0) @aky = pky @asc = psc @puu = "#{b}/#{v}/public/" @pru = "#{b}/#{v}/private/" @pth = "/#{v}/private/" end |
Instance Attribute Details
#aky ⇒ String (readonly)
Returns API key.
13 14 15 |
# File 'lib/krkt/client.rb', line 13 def aky @aky end |
#asc ⇒ String (readonly)
Returns API secret.
15 16 17 |
# File 'lib/krkt/client.rb', line 15 def asc @asc end |
#pru ⇒ String (readonly)
Returns API private url.
19 20 21 |
# File 'lib/krkt/client.rb', line 19 def pru @pru end |
#pth ⇒ String (readonly)
Returns API private path.
21 22 23 |
# File 'lib/krkt/client.rb', line 21 def pth @pth end |
#puu ⇒ String (readonly)
Returns API public url.
17 18 19 |
# File 'lib/krkt/client.rb', line 17 def puu @puu end |
Instance Method Details
#balance ⇒ Hash
Returns saldos no kraken.
95 96 97 |
# File 'lib/krkt/client.rb', line 95 def balance post_private('Balance')['result'] end |
#ledger ⇒ Hash
Returns resultados ultimas transacoes ledger no kraken.
81 82 83 |
# File 'lib/krkt/client.rb', line 81 def ledger post_private('Ledgers')['result'] end |
#server_time ⇒ Hash
Returns data hora kraken.
105 106 107 |
# File 'lib/krkt/client.rb', line 105 def server_time get_public('Time')['result'] end |
#trades_history ⇒ Hash
Returns resultados ultimas transacoes trades no kraken.
57 58 59 |
# File 'lib/krkt/client.rb', line 57 def trades_history post_private('TradesHistory')['result'] end |