Giter Site home page Giter Site logo

mtgox's People

Contributors

alexchien avatar demonbane avatar elthariel avatar jsl avatar kristianfreeman avatar lavirthewhiolet avatar mschewe avatar parndt avatar sferik avatar smazhara avatar sosiouxme avatar thams avatar yenthefirst avatar yrral86 avatar zewelor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mtgox's Issues

Support specifying cookies in the faraday connection

What are your thoughts on adding an API to allow one to set cookies on the connection?

Here's the use case - we had three people running a bit of code that's a big heavy on the mt. gox api. Mt. Gox uses "I'm Under Attack Mode" with CloudFlare. An undocumented feature of that mode (or at least I couldn't find it, but #mtgox channel mentioned it) was that if CF thinks you're DDoSing they'll flip a bit on your IP and require you to perform a javascript-based unit of work, set a cookie in your browser, and then let you in.

As it stands, from one IP we have to send a given cookie across or our API calls fail. I've got a monkeypatch in place in my project right now to support adding cookies into the header (in both get and post requests), but it seems like it could come up for other users of your API client as well.

MtGox's API method 'getTrades' supports parameter 'since'

MtGox's API method 'getTrades' supports parameter 'since' and so should this library. Following code works fine for me (file lib/mtgox/client.rb):

def trades since = nil
  get('/code/data/getTrades.php', since ? { :since => since } : {}).sort_by{|trade| trade['date']}.map do |trade|
    Trade.new(trade)
  end
end

undefined method `last' for MtGox::Ticker

I added btc alias to my .bashrc
but when I run btc I get this error:
-e:1:in <main>': undefined methodlast' for #MtGox::Ticker:0x8f8057c (NoMethodError)
using latest gem

More Currencies

Hello,

MtGox has support for several currencies other than USD. Would be great if we could extend the mtgox gem to support others as well (in my case, EUR).
I will take a look at the code and see if I could make the changes, in which case I'll add a comment to this Issue.

Part of the specs aren't doing what they appear to be doing - not testing what was posted

expect(a_post('/api/1/BTCUSD/order/cancel').with(body: body, headers: test_headers(@client, body))).to have_been_made

If you change the body: body bit to foo: body, this test still passes for me. This means that the test LOOKS like we're verifying what was posted, but it's not actually verifying it. Can you confirm whether the same happens for you?

I noticed it when trying to add tonce support just now and a test passed that shouldn't have passed yet.

403 issue

Hi there,

Sorry for being such a noob. But I keep getting a 403.

btc in bash shell works, but somehow the ticker in ruby doesn't. I've tried with the fork from issue #26, but that had the same result.

Could someone tell me if there's something extra to the example on the homepage?

Simply this, right?

require 'rubygems'
require 'mtgox'

# Fetch the latest price for 1 BTC in USD
puts MtGox.ticker.sell

Gives 403.. Any advice would be much appreciated!

Can't call history method

There is probably a simple explanation behind this, but I can't call history method.

[5] pry(main)> mtgox.history
NoMethodError: undefined method `history' for #<MtGox::Client:0x00000002749238>

As you can see, I have the latest commit.
I checked the source for the method, and it is there.

bundle show mtgox
${USER}/.rvm/gems/ruby-1.9.3-p448/bundler/gems/mtgox-ddde4cd932bc

Funnily enough though, history isn't one of the client methods...

mtgox = MtGox.new
mtgox.methods.select {|m| m.to_s == 'history'}
[]

Client does not return trading data

When trying to obtain current ticker data from MtGox, the client always returns the same decimal number.

In the terminal:

0.576E3

In irb:

puts MtGox.ticker.sell
=> #<BigDecimal:239ed40,'0.574995E3',18(36)>

Same problem arises when using any of the the other methods, e.g. MtGox.ticker.asks

ruby --version returns ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

Supporting multiple clients in a given process

So at present, MtGox is essentially a singleton. I have a need to support multiple different logged in gox users in a single process. I plan to modify this gem to support it, but I wanted to open up a discussion to see if that would be the sort of thing you would care to have submitted. Otherwise I'll just fork, but I hate to diverge.

It seems that the gem could maintain its current API if MtGox.new just memoized a new instance of MtGox::Client, and everything else on MtGox proxied through to a new instance.

Does this sound like the sort of PR you'd be interested in?

Moderately substantial changes resulting from this

So far, I see the following moderately substantial changes that would result from this:

  • A Request would have to be scoped to a given client (to get its secret and key)
  • We would include MtGox::Configuration in MtGox::Client

...aaaaand I think that's it. MtGox.key and MtGox.secret aren't used anywhere else.

#trades occasionally fails with "EOFError: end of file reached "

EOFError: end of file reached
from ~/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/openssl/buffering.rb:145:in sysread_nonblock' from ~/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/openssl/buffering.rb:145:inread_nonblock'
from ~/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/protocol.rb:135:in rbuf_fill' from ~/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/protocol.rb:86:inread'
from ~/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:2448:in ensure in read_chunked' from ~/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:2448:inread_chunked'
from ~/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:2419:in read_body_0' from ~/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:2379:inread_body'
from ~/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:905:in block in get' from ~/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:1194:inblock in transport_request'
from ~/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:2342:in reading_body' from ~/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:1193:intransport_request'
from ~/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:1177:in request' from ~/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:1170:inblock in request'
from ~/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:627:in start' from ~/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:1168:inrequest'
... 1 levels...
from ~/.rvm/gems/ruby-1.9.2-p180@global/gems/faraday-0.6.1/lib/faraday/adapter/net_http.rb:49:in call' from ~/.rvm/gems/ruby-1.9.2-p180@global/gems/faraday-0.6.1/lib/faraday/response.rb:8:incall'
from ~/.rvm/gems/ruby-1.9.2-p180@global/gems/faraday-0.6.1/lib/faraday/response.rb:8:in call' from ~/.rvm/gems/ruby-1.9.2-p180@global/gems/faraday-0.6.1/lib/faraday/response.rb:8:incall'
from ~/.rvm/gems/ruby-1.9.2-p180@global/gems/faraday-0.6.1/lib/faraday/request/url_encoded.rb:14:in call' from ~/.rvm/gems/ruby-1.9.2-p180@global/gems/faraday-0.6.1/lib/faraday/request.rb:88:inrun'
from ~/.rvm/gems/ruby-1.9.2-p180@global/gems/faraday-0.6.1/lib/faraday/request.rb:28:in run' from ~/.rvm/gems/ruby-1.9.2-p180@global/gems/faraday-0.6.1/lib/faraday/connection.rb:170:inrun_request'
from ~/.rvm/gems/ruby-1.9.2-p180@global/gems/faraday-0.6.1/lib/faraday/connection.rb:64:in get' from ~/.rvm/gems/ruby-1.9.2-p180@global/gems/mtgox-0.0.1/lib/mtgox/request.rb:10:inrequest'
from ~/.rvm/gems/ruby-1.9.2-p180@global/gems/mtgox-0.0.1/lib/mtgox/request.rb:4:in get' from ~/.rvm/gems/ruby-1.9.2-p180@global/gems/mtgox-0.0.1/lib/mtgox/client.rb:42:intrades'
from ~/.rvm/gems/ruby-1.9.2-p180@global/gems/mtgox-0.0.1/lib/mtgox.rb:14:in method_missing' from bc.rb:157:intrade_graphs'
from (irb):571
from ~/.rvm/rubies/ruby-1.9.2-p180/bin/irb:16:in `

'

Expose order status

Can you add a "status" attribute to the Order class to expose the status of the order? According to the documentation I've seen, these are the possible status values: pending, executing, post-pending, open, stop, and invalid.

Any plans on migrating to V2?

nitrous commented that "even though version 1 of the API is available and well-documented, it seems that it will soon be redundant, just as version 0 is, with the advent of version 2." (https://bitbucket.org/nitrous/mtgox-api/overview)

I'm not entirely sure what benefits v2 provides apart from better name spacing. However, if v1 is to become deprecated, it would make sense to migrate to v2 soon.

SSLv3 certificate verify fail

Hi. On Ubuntu with Ruby 1.9.3 just running the simple example

ruby -r rubygems -r mtgox -e "puts MtGox.ticker.sell"

I get this:

/opt/ruby19/lib/ruby/1.9.1/net/http.rb:799:in `connect': SSL_connect 
  returned=1 errno=0 state=SSLv3 read server certificate B: 
  certificate verify failed (Faraday::Error::ConnectionFailed)

Any idea how to fix this, or any further information I could provide to help troubleshoot it?

README examples not working as supposed to

Hey guys,

Title is self explanatory. My guess is that it has something to do with: 503d88e

Anyway, the problem is that I get some weird output after MtGox.balance. It does give me the balance, but like this:

> MtGox.balance
=> [#<MtGox::Balance:0x000000021b2e50
  @amount=#<BigDecimal:21b2ba8,'0.1356836241 2E3',18(27)>,
  @currency="BTC">,
 #<MtGox::Balance:0x000000021b23d8
  @amount=#<BigDecimal:21b2270,'0.44609E0',9(18)>,
  @currency="USD">]

and MtGox.balance[0].to_f doesn't work... should it?

order_result ?

order_result is mentioned in client.rb, but such method isn't present anywhere in the codebase. Is something amiss?

$ git grep order_result
lib/mtgox/client.rb:    # @return [String] order ID for the buy, can be inspected using order_result
lib/mtgox/client.rb:    # @return [String] order ID for the sell, can be inspected using order_result
lib/mtgox/client.rb:    # @return [String] order ID for the order, can be inspected using order_result

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.