Bitcoin Forum
May 12, 2024, 09:45:42 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: MtGox API  (Read 2296 times)
notme (OP)
Legendary
*
Offline Offline

Activity: 1904
Merit: 1002


View Profile
November 19, 2011, 06:29:54 AM
 #1

I'm trying to update the mtgox ruby gem to use the new authentication mechanism, but I can't seem to get it to work.

My request.rb with key and signature header generation is here:
https://github.com/yrral86/mtgox/blob/master/lib/mtgox/request.rb

post('/api/0/buyBTC.php', {:amount => amount, :price => price})
gives me:
{"error"=>"Must be logged in"}

I've also tried calling Base64.decode64 on the secret before passing it into the hash function.  Same result.

Any MtGox API gurus out there?  Even just an example secret, message, and hash tuple would be helpful to make sure the signature process is correct.

https://www.bitcoin.org/bitcoin.pdf
While no idea is perfect, some ideas are useful.
1715550342
Hero Member
*
Offline Offline

Posts: 1715550342

View Profile Personal Message (Offline)

Ignore
1715550342
Reply with quote  #2

1715550342
Report to moderator
1715550342
Hero Member
*
Offline Offline

Posts: 1715550342

View Profile Personal Message (Offline)

Ignore
1715550342
Reply with quote  #2

1715550342
Report to moderator
The forum strives to allow free discussion of any ideas. All policies are built around this principle. This doesn't mean you can post garbage, though: posts should actually contain ideas, and these ideas should be argued reasonably.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715550342
Hero Member
*
Offline Offline

Posts: 1715550342

View Profile Personal Message (Offline)

Ignore
1715550342
Reply with quote  #2

1715550342
Report to moderator
1715550342
Hero Member
*
Offline Offline

Posts: 1715550342

View Profile Personal Message (Offline)

Ignore
1715550342
Reply with quote  #2

1715550342
Report to moderator
1715550342
Hero Member
*
Offline Offline

Posts: 1715550342

View Profile Personal Message (Offline)

Ignore
1715550342
Reply with quote  #2

1715550342
Report to moderator
notme (OP)
Legendary
*
Offline Offline

Activity: 1904
Merit: 1002


View Profile
November 19, 2011, 07:33:57 AM
 #2

Update: Magical Incantation found!

The link now shows working code.  Feel free to use this repo if you need to use mtgox from Ruby.  I've submitted a pull request to the original author here: https://github.com/sferik/mtgox/pull/10

171dH9Uum6wWLSwH2g8g2yto6SG7NEGyXG if you would like to show some gratitude.

https://www.bitcoin.org/bitcoin.pdf
While no idea is perfect, some ideas are useful.
notme (OP)
Legendary
*
Offline Offline

Activity: 1904
Merit: 1002


View Profile
November 20, 2011, 01:21:35 AM
 #3

New pull request is here:
https://github.com/sferik/mtgox/pull/11

Should be merged soon, and hopefully he'll make a release of the gem.

I fixed up the specs to use the new authentication scheme and fixed a small bug I introduced.

https://www.bitcoin.org/bitcoin.pdf
While no idea is perfect, some ideas are useful.
is4tomj
Newbie
*
Offline Offline

Activity: 48
Merit: 0


View Profile WWW
March 06, 2012, 11:33:44 PM
 #4

I have been trying to get the mtgox gem authentication to work, using ruby 1.9.2.  I attempted the examples in the Readme.  Specifically,

Code:
MtGox.configure do |config|
  config.key = [my key]
  config.secret = [my secret]
end

# Cancel order #1234567890
MtGox.cancel 1234567890

After calling MtGox.cancel(...) Mt. Gox returns:

Code:
{"error":"Must be logged in"}

Did the API change such that the MtGox gem is no longer functional for authenticated functions?
notme (OP)
Legendary
*
Offline Offline

Activity: 1904
Merit: 1002


View Profile
March 07, 2012, 12:03:34 AM
 #5

I have been trying to get the mtgox gem authentication to work, using ruby 1.9.2.  I attempted the examples in the Readme.  Specifically,

Code:
MtGox.configure do |config|
  config.key = [my key]
  config.secret = [my secret]
end

# Cancel order #1234567890
MtGox.cancel 1234567890

After calling MtGox.cancel(...) Mt. Gox returns:

Code:
{"error":"Must be logged in"}

Did the API change such that the MtGox gem is no longer functional for authenticated functions?


Still works for me, with 1.9.2.  Make sure your credentials are correct and that the key pair has the correct permissions on MtGox's site.  Also, ensure your gem version is at least 0.7.3 (latest is 0.7.4).

https://www.bitcoin.org/bitcoin.pdf
While no idea is perfect, some ideas are useful.
daybyter
Legendary
*
Offline Offline

Activity: 965
Merit: 1000


View Profile
March 24, 2012, 05:11:57 PM
 #6

Is there more info available on format of the returned json data? I.e. the structure of the open orders.

TIA,
Andreas

notme (OP)
Legendary
*
Offline Offline

Activity: 1904
Merit: 1002


View Profile
March 25, 2012, 12:38:24 AM
 #7

Is there more info available on format of the returned json data? I.e. the structure of the open orders.

TIA,
Andreas


Use a puts or look at the code to see how the json is parsed.

https://www.bitcoin.org/bitcoin.pdf
While no idea is perfect, some ideas are useful.
daybyter
Legendary
*
Offline Offline

Activity: 965
Merit: 1000


View Profile
March 25, 2012, 01:03:53 AM
 #8

The ruby code seems to use the 0 API?

notme (OP)
Legendary
*
Offline Offline

Activity: 1904
Merit: 1002


View Profile
March 25, 2012, 01:09:00 AM
 #9

The ruby code seems to use the 0 API?

Yes, looking at the code it does appear to be the case.  However, you should be able to add a method to client.rb and call get or post on any URL you'd like.  Any more questions to bug me with during my vacation?

https://www.bitcoin.org/bitcoin.pdf
While no idea is perfect, some ideas are useful.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!