Author

Topic: MtGox Streaming API is Broken (Read 2279 times)

legendary
Activity: 965
Merit: 1000
February 26, 2012, 04:09:02 PM
#7
Wouldn't it be easier to get the json server update more often?  How quick is enough 'real time'?
donator
Activity: 848
Merit: 1078
February 25, 2012, 12:56:26 AM
#6
Anyway we got another option currently on planning stage that may go live by end of may ...

What is your current recommendation for people who need a stable live price feed?

The current socket.io and/or websockets feeds have been really awful the past few days/(weeks?).  While occasionally seeming to work at times, they often go down for hours at a time, pretty much every day.

What do sites like Bitcoinica, trading bots, or merchant sites do when the Mt.Gox feed goes down for hours at a time?

Is "maybe wait until the end of May" the only option here?


The JSON web API with post/get calls.

*edit* actually i just realised you asked for live feed... the json calls aren't live.
sr. member
Activity: 408
Merit: 261
February 23, 2012, 07:22:03 PM
#5
Anyway we got another option currently on planning stage that may go live by end of may ...

What is your current recommendation for people who need a stable live price feed?

The current socket.io and/or websockets feeds have been really awful the past few days/(weeks?).  While occasionally seeming to work at times, they often go down for hours at a time, pretty much every day.

What do sites like Bitcoinica, trading bots, or merchant sites do when the Mt.Gox feed goes down for hours at a time?

Is "maybe wait until the end of May" the only option here?
legendary
Activity: 1050
Merit: 1000
February 23, 2012, 03:24:14 AM
#4
with broken live data feed/s you're missing an action  /me thinks
vip
Activity: 608
Merit: 501
-
February 22, 2012, 08:43:04 PM
#3
I wish they could just re-enable the old socket API. It was working fine for me. I can't get the new one to work either (with Python).

Actually the old one was disabled because it was causing too much strain on the system. We are working on a viable solution (socket.io seemed to be used by some big players, but after testing this ourselves we found out it's far from being stable at all).

Anyway we got another option currently on planning stage that may go live by end of may if socket.io do not fix their thing by then.
legendary
Activity: 980
Merit: 1008
February 22, 2012, 06:28:59 PM
#2
I wish they could just re-enable the old socket API. It was working fine for me. I can't get the new one to work either (with Python).
donator
Activity: 980
Merit: 1004
felonious vagrancy, personified
February 05, 2012, 06:20:34 PM
#1
Here is a self-contained piece of code that demonstrates the problem:

Code:
import io.socket.*;
import org.json.*;
import net.tootallnate.websocket.*;

public class MtGoxStreaming {
    
    private static final String tickerChannel = "d5f06780-30a8-4a48-a2f8-7ed181b4a13f";
    private static final String tradesChannel = "dbf1dee9-4f2e-4a08-8cb7-748919a71b21";
    private static final String depthChannel  = "24e67e0d-1cad-4cc0-9e7a-f8523ef460fe";

    public static void main(String[] args) throws Exception {
        SocketIO socket = new SocketIO("https://socketio.mtgox.com/mtgox");
        socket.connect(new IOCallback() {
                @Override
                    public void onMessage(JSONObject json, IOAcknowledge ack) {
                    try {
                        System.out.println("We received a message: " + json.toString(2));
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                }

                @Override
                    public void onMessage(String data, IOAcknowledge ack) {
                    System.out.println("We received a message:" + data);
                }
                
                @Override
                    public void onError(SocketIOException socketIOException) {
                    System.out.println("Something went wrong: " + socketIOException);
                    socketIOException.printStackTrace();
                    //System.exit(0);
                }

                @Override
                    public void onDisconnect() {
                    System.out.println("Disconnected");
                    System.exit(0);
                }

                @Override
                    public void onConnect() {
                    System.out.println("Connected");
                }

                @Override
                    public void on(String event, IOAcknowledge ack, Object... args) {
                    System.out.println("got: " + event);
                    ack.ack("Roger that!");
                    //socket.emit("answer", new JSONObject().put("msg", "Hello again Socket.io!"));
                }
            });

        // This will be cached until the server is connected.
        //socket.emit("hello", new JSONObject().put("msg", "Hello Socket.io! :D"));
 
        JSONObject obj = new JSONObject();
        obj.put("op",      "subscribe");
        //obj.put("channel", depthChannel);
        obj.put("channel", "d5f06780-30a8-4a48-a2f8-7ed181b4a13f");
        socket.send(obj);
 
    }
}

Run it and you get:

Code:
Connected
> 1::/mtgox
> 4::/mtgox:{"op":"subscribe","channel":"d5f06780-30a8-4a48-a2f8-7ed181b4a13f"}
> 2::
> 2::
> 2::
> 2::
> 2::
> 2::
> 2::
< 7:::1+0
Something went wrong: io.socket.SocketIOException: 1+0
io.socket.SocketIOException: 1+0
Jump to: