Question

I am trying to use the MtGox gem to cancel orders, however, I only get the following error message:

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

I am using the following code to make the call:

MtGox.configure {|c| c.key = user.mtgox_key; c.secret = user.mtgox_secret}
MtGox.cancel('oid'=>'a3c348d9-36c3-4927-b84d-206f421907f5', 'type'=>1)

I have also tried getting all of the open orders for a specific user using the following:

MtGox.post('/api/0/getOrders.php', {})

Alas, every call returns the same error message. Am I missing something?

Was it helpful?

Solution

This issue was resolved by using a smaller nonce for v1 api calls. Interestingly, a nonce of length 22 was causing subsequent v0 api calls to fail, but not subsequent v1 calls. I compute my nonce by simply using:

var nonce = ((new Date()).getTime()*1000).toString(); // microseconds since epoch
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top