shideneyu / kraken_client Goto Github PK
View Code? Open in Web Editor NEWkraken_client is a ruby wrapper for the Kraken API.
License: Other
kraken_client is a ruby wrapper for the Kraken API.
License: Other
Hello, thank you for your good work.
When I try using version 1.2 I get:
gems/kraken_client-1.2/lib/kraken_client/application.rb:7:in `require': cannot load such file -- hashie (LoadError)
from /usr/local/lib/ruby/gems/2.4.0/gems/kraken_client-1.2/lib/kraken_client/application.rb:7:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.4.0/gems/kraken_client-1.2/lib/kraken_client.rb:4:in `require_relative'
from /usr/local/lib/ruby/gems/2.4.0/gems/kraken_client-1.2/lib/kraken_client.rb:4:in `block in <top (required)>'
from /usr/local/lib/ruby/gems/2.4.0/gems/kraken_client-1.2/lib/kraken_client.rb:3:in `each'
from /usr/local/lib/ruby/gems/2.4.0/gems/kraken_client-1.2/lib/kraken_client.rb:3:in `<top (required)>'
....
Is there any way I can implement https://www.kraken.com/help/api#deposit-addresses to get deposit address from kraken?
These are the first few lines of my gemfile:
source 'https://rubygems.org'
gem 'kraken_client'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.6'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
Run bundle install, says it installs, but then class can't be found:
borourke$ bundle exec rails c
Running via Spring preloader in process 79949
Loading development environment (Rails 4.2.6)
irb(main):001:0> KrakenClient.load({
irb(main):002:2* api_key: XXXXXXXX,
irb(main):003:2* api_secret: XXXXXX
irb(main):004:2> })
NameError: uninitialized constant KrakenClient
from (irb):1
from /Users/borourke/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands/console.rb:110:in `start'
from /Users/borourke/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands/console.rb:9:in `start'
from /Users/borourke/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:68:in `console'
from /Users/borourke/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/borourke/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands.rb:17:in `<top (required)>'
from /Users/borourke/Projects/ktifu/bin/rails:9:in `<top (required)>'
from /Users/borourke/.rbenv/versions/2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/borourke/.rbenv/versions/2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1:in `<main>'
irb(main):005:0>
I can use the class in a script, but not in a gemfile/rails context. Would be really nice if it supported that.
I was surprised to see that kraken OHLC api endpoint was not supported:
https://www.kraken.com/help/api#public-market-data
It would be great to add the endpoint to kraken_client
thanks
There seem to be some instances where the gem blows up because Hashie::Mash.new
cannot handle the response returned. See this fork.
Are you aware of this? I don't mind making the change, but is there a test API server for Kraken?
The documentation example shows passing an order id to #cancel_order
:
client.private.cancel("SOME-ORDER-ID")
This raises the error in the title. I figured I needed to pass txid: "SOME-ORDER-ID"
, which worked, but did return the following warning message, due to the success response from the API of #<Hashie::Mash count=1>
:
"You are setting a key that conflicts with a built-in method Hashie::Mash#count defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method."
I'm not sure how much of an issue this is as the cancel worked when passing txid: "SOME-ORDER-ID"
Hello, I would like to add the OHLC endpoint and related params and tests to this repo.
My codeline "require 'kraken_client'" fails:
$ ./test.rb
/Users/torti/.rbenv/versions/2.2.4/lib/ruby/2.2.0/find.rb:42:in `block in find': No such file or directory (Errno::ENOENT)
from /Users/torti/.rbenv/versions/2.2.4/lib/ruby/2.2.0/find.rb:42:in `collect!'
from /Users/torti/.rbenv/versions/2.2.4/lib/ruby/2.2.0/find.rb:42:in `find'
from /Users/torti/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/kraken_client-0.2.1/lib/kraken_client.rb:4:in `each'
from /Users/torti/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/kraken_client-0.2.1/lib/kraken_client.rb:4:in `select'
from /Users/torti/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/kraken_client-0.2.1/lib/kraken_client.rb:4:in `<top (required)>'
from /Users/torti/.rbenv/versions/2.2.4/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `require'
from /Users/torti/.rbenv/versions/2.2.4/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
from /Users/torti/.rbenv/versions/2.2.4/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in `require'
from /Users/torti/src/bc/mytrader/market/kraken.rb:1:in `<top (required)>'
from /Users/torti/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/require_all-1.3.3/lib/require_all.rb:108:in `require'
from /Users/torti/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/require_all-1.3.3/lib/require_all.rb:108:in `block in require_all'
from /Users/torti/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/require_all-1.3.3/lib/require_all.rb:106:in `each'
from /Users/torti/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/require_all-1.3.3/lib/require_all.rb:106:in `require_all'
from /Users/torti/src/bc/mytrader/main.rb:9:in `init'
from ./test.rb:4:in `<main>'
So I guess there's a problem with find in your kraken_client.rb produces this issue:
Find.find('./lib').select { |p| /.*\.rb$/ =~ p }.each do |path|
require_relative("../" + path)
end
I haven't seen such code in other ruby libraries. They all require their files explicitly, e.g.:
require 'configurable.rb'
require 'configuration.rb'
require 'exceptions.rb'
require 'version.rb'
require 'kraken_client/requests/base.rb'
require 'kraken_client/requests/get.rb'
require 'kraken_client/requests/limiter.rb'
require 'kraken_client/requests/post.rb'
require 'kraken_client/application.rb'
I don't know if that's all... but at least I don't get an error anymore when I "require 'kraken_client'". That way you also can remove your dependency of the find gem.
Hello,
I'm getting an exception trying to connect to kraken. Looks like your gem is expecting status in the response, but httparty isn't providing that.
irb
2.2.5 :001 > require 'kraken_client'
2.2.5 :002 > client = KrakenClient.load
=> #<KrakenClient::Application:0x007fdceb085870 @config=#<KrakenClient::Configuration:0x007fdceb084dd0 @api_key=nil, @api_secret=nil, @base_uri="https://api.kraken.com", @api_version=0, @Limiter=true, @tier=2, @limiter_interface=#<KrakenClient::Requests::Limiter:0x007fdceb084da8 @config=#<KrakenClient::Configuration:0x007fdceb084dd0 ...>, @previous_timestamps=2017-12-23 10:31:23 -0700, @counter=10, @current_count=10>>>
2.2.5 :003 > time = client.public.server_time
response - {"error":[],"result":{"unixtime":1514050288,"rfc1123":"Sat, 23 Dec 17 17:31:28 +0000"}}"
Exception - NoMethodError: undefined method status' for #<HTTParty::Response:0x007fdcec0aa2f0> from /Users/ian/.rvm/gems/ruby-2.2.5/gems/httparty-0.15.6/lib/httparty/response.rb:93:in
method_missing'
from /Users/ian/.rvm/gems/ruby-2.2.5/gems/kraken_client-1.3.0/lib/kraken_client/endpoints/public.rb:9:in `perform'_
how i can call this and fetch it
Hi i am using other server for show rates and show my app something like this http://prntscr.com/frwu2l
now i need to fetch from kraken and save it my database
data = ::CSAPI.getRate
data = fetch_rates
binding.pry
data['items'].keys.each do |item|
from = Currency.find_by_code(item.split('/')[0].to_sym)
to = Currency.find_by_code(item.split('/')[1].to_sym)
rate = data['items'][item]
if from && to
reverse_rate = (BigDecimal('1.00000000') / BigDecimal("#{rate}")).truncate(8)
ExchangeRate.create(from: from, to: to, rate: rate)
ExchangeRate.create(from: to, to: from, rate: reverse_rate)
end
# if Currency.find_by_code(:npc)
# ExchangeRate.create from: to, to: Currency.find_by_code(:npc), rate: rate
# ExchangeRate.create from: Currency.find_by_code(:npc), to: to, rate: reverse_rate
# end
end
if recurrent
self.class.set(wait: Rails.env.production? ? 1.minute : 30.minutes).perform_later
end
end```
in kraken somthign like this
```client = KrakenClient.load
spread = client.public.spread('XXBTZUSD')
=> {"XXBTZUSD"=>
[[1499256446, "2555.20000", "2555.20000"],
[1499256447, "2553.43900", "2555.20000"],
[1499256450, "2555.20000", "2555.20000"],
[1499256451, "2553.43900", "2555.20000"],
[1499256452, "2553.44000", "2555.20000"],
[1499256457, "2553.43900", "2555.20000"],
[1499256464, "2553.44000", "2555.20000"],```
but i dont understand which one here is doller and usd
In documentation you wrote
trades = client.private.trade_history
shouldn't it be
trades = client.private.trades_history
?
The public client is checking for response.status
so that it can raise an error if the status is not 200
. It should be checking for response.code
instead.
Error: httparty-0.15.6/lib/httparty/response.rb:93:in
method_missing': undefined method status' for #<HTTParty::Response:0x0000000120ca00> (NoMethodError)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.