Post
Topic
Board Trading Discussion
Re: Chrome Browser extension: MtGox trading bot
by
rikigst
on 10/05/2013, 16:45:04 UTC
Here's a (very brutal, indeed) fix for everyone having issues with v0 gox apis: v1 work very well indeed!
You need to change the following lines in background.js:

Line 128:
Code:
req.open("GET", url);
becomes (preventing chrome to use cached pages)
Code:
req.open("GET", url+"?sid=" + Math.random());

Line 271:
Code:
var url = "https://data.mtgox.com/api/0/data/getTrades.php?Currency="+currency+"&since="+since;
becomes
Code:
var url = "https://data.mtgox.com/api/1/BTC"+currency+"/trades?since="+since;

Line 283:
Code:
var trs = JSON.parse(req.responseText);
becomes (quite raw, but it works!)
Code:
var trs = JSON.parse(req.responseText.replace("{\"result\":\"success\",\"return\":","").replace("]}","]"));

Line 304:
Code:
url = "https://data.mtgox.com/api/0/data/getTrades.php?Currency="+currency+"&since="+since;
becomes
Code:
url = "https://data.mtgox.com/api/1/BTC"+currency+"/trades?since="+since;

The bot is behaving MUCH better now thanks to the new apis  Cheesy

EDIT: probably the big issue was Chrome using the cached content, which stopped the bot any time it went through an empty page. With the line 128 workaround (above), v0 apis should work well, too!