jhk753 / hitbtc_ruby

ruby gem: api Wrapper for hitbtc
3 stars 7 forks source link

Error trying to initialise the client #3

Open jsimoes opened 10 years ago

jsimoes commented 10 years ago

When I try to initialise the client I get the following error:

/Users/jsimoes/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/psych.rb:463:in initialize': No such file or directory @ rb_sysopen - key.yml (Errno::ENOENT) from /Users/jsimoes/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/psych.rb:463:inopen' from /Users/jsimoes/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/psych.rb:463:in load_file' from /Users/jsimoes/.rvm/gems/ruby-2.1.0/gems/hitbtc-0.1.3/lib/hitbtc/client.rb:12:ininitialize' from /Users/jsimoes/Code/bit-arbitrage/lib/rbtc_arbitrage/clients/hitbtc_client.rb:60:in new' from /Users/jsimoes/Code/bit-arbitrage/lib/rbtc_arbitrage/clients/hitbtc_client.rb:60:ininterface'

The code I am using is the following:

@interface ||= Hitbtc::Client.new(ENV['HITBTC_KEY'], secret)

Any hints?

jhk753 commented 10 years ago

From the code: def initialize(api_key=nil, api_secret=nil, options={}) @api_key = api_key || YAML.load_file("key.yml")["key"] @api_secret = api_secret || YAML.load_file("key.yml")["secret"] @api_version = options[:version] ||= '1' @base_uri = options[:base_uri] ||= 'api.hitbtc.com' end

if you get an error: No such file or directory @ rb_sysopen key.yml

it means the code is looking for key.yml because either ENV['HITBTC_KEY'] is nil or secret is nil ?

Did you check that those parameters are not nil ?

jhk753 commented 9 years ago

Didi you resolve your issue ?

I'm going to close this ticket