Bitcoin Forum
August 25, 2025, 12:22:08 PM *
News: Latest Bitcoin Core release: 29.0 [Torrent]
 
   Home   Help Search Login Register More  
Warning: One or more bitcointalk.org users have reported that they strongly believe that the creator of this topic is a scammer. (Login to see the detailed trust ratings.) While the bitcointalk.org administration does not verify such claims, you should proceed with extreme caution.
Pages: « 1 2 3 4 5 6 7 8 [9] 10 11 12 13 14 15 16 17 18 19 20 21 »  All
  Print  
Author Topic: [BETA] MTGox websocket API, testers wanted  (Read 77963 times)
Ente
Legendary
*
Offline Offline

Activity: 2126
Merit: 1001



View Profile
January 20, 2012, 04:44:26 PM
 #161

Is it possible to query my open trades and/or cancel an order or at least all orders? With the websocket API, that is?
Didnt see any hint that this is possible..

But then I dont remember to have ever seen the commands to post orders via websocket neither?

Is the websocket for "reading" only, like making graphs from the data?

edit:
So, get data from the websocket, and exectue/cancel orders via "API version 1" then?

Ente
rwcp97
Newbie
*
Offline Offline

Activity: 13
Merit: 0


View Profile
January 21, 2012, 08:57:16 AM
 #162

Is it possible to query my open trades and/or cancel an order or at least all orders? With the websocket API, that is?
Didnt see any hint that this is possible..

But then I dont remember to have ever seen the commands to post orders via websocket neither?

Is the websocket for "reading" only, like making graphs from the data?

edit:
So, get data from the websocket, and exectue/cancel orders via "API version 1" then?

Ente

As far as I know there is no possibility to do orders over the websocket... Would be pretty dangerous too, as it isn't SSL encrypted.
But you can subscribe to your "private channel" to be informed about your orders. Use getKey.php to get its name.
Fireball
Hero Member
*****
Offline Offline

Activity: 674
Merit: 500


View Profile WWW
January 21, 2012, 09:53:14 AM
 #163

As far as I know there is no possibility to do orders over the websocket... Would be pretty dangerous too, as it isn't SSL encrypted.
But you can subscribe to your "private channel" to be informed about your orders. Use getKey.php to get its name.

socket.io supports secure connections (https, wss transports). That's what I use in ICBIT trading platform, so I would be quite surprised if that's dangerous Wink

Margin trading platform OrderBook.net (ICBIT): https://orderbook.net
Follow us in Twitter: https://twitter.com/orderbooknet
rwcp97
Newbie
*
Offline Offline

Activity: 13
Merit: 0


View Profile
January 21, 2012, 10:07:08 AM
 #164

socket.io supports secure connections (https, wss transports). That's what I use in ICBIT trading platform, so I would be quite surprised if that's dangerous Wink

ok, I wasn't aware of that - I just connect to websocket.mtgox.com at port 80.
Ente
Legendary
*
Offline Offline

Activity: 2126
Merit: 1001



View Profile
January 21, 2012, 10:10:12 AM
 #165

Thank you for the hints, rwcp and Fireball!

Ente
osmosis
Sr. Member
****
Offline Offline

Activity: 300
Merit: 250



View Profile
January 25, 2012, 02:14:38 AM
 #166

 #> python socketio.py
it should dump the messages to stdout

Thanks molecular.
is4tomj
Newbie
*
Offline Offline

Activity: 48
Merit: 0


View Profile WWW
January 25, 2012, 03:04:54 AM
 #167

I'm using the streaming feed on my website.  If anyone needs a working example feel free to take a look. (http://BitcoinTitan.com)
molecular
Donator
Legendary
*
Offline Offline

Activity: 2800
Merit: 1023



View Profile
January 25, 2012, 10:03:34 AM
 #168

Let me say here that the socket.io/websocket feed has been rather stable in late times. I'm hoping this has nothing to do with the fact that trading volume is declining, but is due to Magicaltux making things better. In that case: thanks, Magicaltux and/or mtgox team.

PGP key molecular F9B70769 fingerprint 9CDD C0D3 20F8 279F 6BE0  3F39 FC49 2362 F9B7 0769
piotr_n
Legendary
*
Offline Offline

Activity: 2058
Merit: 1427


aka tonikt


View Profile WWW
January 25, 2012, 01:14:54 PM
 #169

I don't know guys how you can be using this new socket.io via the websocket interface...

I get my ID nicely from https://socketio.mtgox.com/socket.io/1/ but then after I connect my websocket lib to ws://socketio.mtgox.com:80/socket.io/1/websocket/XXXXX - it just sends me "7:::1+0" and disconnects immediately after that.

Am I the only one who has this problem?

Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.
PGP fingerprint: AB9E A551 E262 A87A 13BB  9059 1BE7 B545 CDF3 FD0E
osmosis
Sr. Member
****
Offline Offline

Activity: 300
Merit: 250



View Profile
January 25, 2012, 01:32:01 PM
 #170

I don't know guys how you can be using this new socket.io via the websocket interface...

I get my ID nicely from https://socketio.mtgox.com/socket.io/1/ but then after I connect my websocket lib to ws://socketio.mtgox.com:80/socket.io/1/websocket/XXXXX - it just sends me "7:::1+0" and disconnects immediately after that.

Am I the only one who has this problem?

Works for me. Sounds like an issue on your side.
piotr_n
Legendary
*
Offline Offline

Activity: 2058
Merit: 1427


aka tonikt


View Profile WWW
January 25, 2012, 01:34:50 PM
 #171

I don't know guys how you can be using this new socket.io via the websocket interface...

I get my ID nicely from https://socketio.mtgox.com/socket.io/1/ but then after I connect my websocket lib to ws://socketio.mtgox.com:80/socket.io/1/websocket/XXXXX - it just sends me "7:::1+0" and disconnects immediately after that.

Am I the only one who has this problem?

Works for me. Sounds like an issue on your side.
But which language / websocket library do you use?

I tried with latest Chrome and this extension: https://chrome.google.com/webstore/detail/pfdhoblngboilpfeibdedpjgfnlcodoo
.... and also tried with websocket package from Go - and they both disconnect me immediately after sending "7:::1+0"

Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.
PGP fingerprint: AB9E A551 E262 A87A 13BB  9059 1BE7 B545 CDF3 FD0E
piotr_n
Legendary
*
Offline Offline

Activity: 2058
Merit: 1427


aka tonikt


View Profile WWW
January 25, 2012, 01:45:21 PM
 #172

Or just try this page: http://websocket.org/echo.html
... using i.e.  ws://socketio.mtgox.com:80/socket.io/1/websocket/14001291971574386363
and tell me that I'm crazy Smiley

Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.
PGP fingerprint: AB9E A551 E262 A87A 13BB  9059 1BE7 B545 CDF3 FD0E
zelyony
Newbie
*
Offline Offline

Activity: 23
Merit: 0



View Profile
January 26, 2012, 03:11:16 PM
 #173

I get my ID nicely from https://socketio.mtgox.com/socket.io/1/ but then after I connect my websocket lib to ws://socketio.mtgox.com:80/socket.io/1/websocket/XXXXX - it just sends me "7:::1+0" and disconnects immediately after that.
If u got ID from https:// than u must connect to wss:// with this ID (SSL/TLS - secure connection)
and if http:// than ws://
piotr_n
Legendary
*
Offline Offline

Activity: 2058
Merit: 1427


aka tonikt


View Profile WWW
January 26, 2012, 03:12:54 PM
 #174

I get my ID nicely from https://socketio.mtgox.com/socket.io/1/ but then after I connect my websocket lib to ws://socketio.mtgox.com:80/socket.io/1/websocket/XXXXX - it just sends me "7:::1+0" and disconnects immediately after that.
If u got ID from https:// than u must connect to wss:// with this ID (SSL/TLS - secure connection)
and if http:// than ws://
shit man.
thank you!!!
that was indeed the problem.

Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.
PGP fingerprint: AB9E A551 E262 A87A 13BB  9059 1BE7 B545 CDF3 FD0E
osmosis
Sr. Member
****
Offline Offline

Activity: 300
Merit: 250



View Profile
January 27, 2012, 09:35:00 PM
 #175

 #> python socketio.py
it should dump the messages to stdout

Thanks molecular.

For the websocket in python, anyone find a way to deal with the disconnect errors?

File "/home/osmosis/proj_venv/proj_proj/websocket_client.py", line 161, in recv
SSLError: [Errno 1] _ssl.c:1325: error:14095044:SSL routines:SSL3_READ_N:internal error
SSLError: [Errno 1] _ssl.c:1325: error:1408F119:SSL routines:SSL3_GET_RECORD:decryption failed or bad record mac
SSLError: [Errno 1] _ssl.c:1325: error:1408F096:SSL routines:SSL3_GET_RECORD:encrypted length too long
SSLError: [Errno 1] _ssl.c:1325: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number
SSLError: [Errno 8] _ssl.c:1325: EOF occurred in violation of protocol
ConnectionClosedException
Ente
Legendary
*
Offline Offline

Activity: 2126
Merit: 1001



View Profile
February 13, 2012, 08:32:28 AM
Last edit: February 14, 2012, 03:51:27 PM by Ente
 #176

TL;DR:
Will ws://websocket.mtgox.com/mtgox continue to work?


Some days ago I connected to the old, deprecated websocket. Connecting works, but no data comes in any more.

Now thats an incentive to figure out socket.io :-)

edit:

As far as I know there is no possibility to do orders over the websocket...

Seems like now you can indeed do orders over socket.io:

Quote from: Bitcoin Wiki link=https://en.bitcoin.it/wiki/MtGox/API#Streaming_API
Authenticated commands
These commands require an API key and secret pair to sign requests. Any of the "version 1" requests from the HTTP API can be called.

So I got the handshake coded, getting me my connection-ID. I then can connect to the websocket just fine.
However, I dont receive any data, only two messages: '1::' and '2::'. Both come once in the first few seconds of being connected, then total silence. I am not being disconnected neither, I think.
Do I have to join a channel? Or am I connected to the default channels just like before?
I dont have "sending messages" finished yet to test..

Any hints?

Ente

zelyony
Newbie
*
Offline Offline

Activity: 23
Merit: 0



View Profile
February 14, 2012, 05:57:55 PM
 #177

So I got the handshake coded, getting me my connection-ID. I then can connect to the websocket just fine.
However, I dont receive any data, only two messages: '1::' and '2::'. Both come once in the first few seconds of being connected, then total silence. I am not being disconnected neither, I think.
Do I have to join a channel? Or am I connected to the default channels just like before?
I dont have "sending messages" finished yet to test..
Any hints?
in the past (3+ weeks ago):
by default u dont subscribed to channels
u may send simple strings over internal (socket.io's) websocket
for "2::" u must send "2::" (or send "2::" every 15secs)
for subscribe u must send post #162
datas stopped in socket after 3-15min.. u can open & sync 2 socket.io..
for now:
post #162 looks no more working - no datas except "1::" & "2::"
Huh
Ente
Legendary
*
Offline Offline

Activity: 2126
Merit: 1001



View Profile
February 14, 2012, 07:39:05 PM
 #178

OH! Thank you a lot for your help, zelyony!

I was already wondering about the heartbeat. I now answer 1:: and 2:: accordingly, now they keep flowing in constantly.
Well, the socket *must* be working, since the websites using it still work. There would be more outcry in the forum if it was dead altogether..

I am glad I'm not the only one here!

Ente
Ente
Legendary
*
Offline Offline

Activity: 2126
Merit: 1001



View Profile
February 14, 2012, 10:29:19 PM
Last edit: February 15, 2012, 10:17:32 AM by Ente
 #179

*bangs head on desk*
I cant get it to work.

1 BTC bounty for the first person who helps me receive regular data again over the websocket!

Here is my (totally stripped) python code:

Code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from websocket import create_connection
import urllib
import re
import time

try:
    import json
except ImportError:
    import simplejson as json


wsurl = "wss://socketio.mtgox.com/socket.io/"
iourl = "https://socketio.mtgox.com/socket.io/"

############

print "Connecting to socket.io.."
url = iourl + "1"
f = urllib.urlopen(url)
output = f.read()
f.close()
ausgabe = re.search('[0-9]+', output, 0)
sessionid = ausgabe.group()

print "New websocket url:"
wssurl = wsurl + "1" + "/websocket/" + sessionid
print wssurl

############

print "Connecting to websocket..\n"

socket = create_connection(wssurl)

while 1:
  echo =  socket.recv()
  if "1::" in echo:
    print "Heartbeat 1"
    socket.send("1::")
  elif "2::" in echo:
    print "Heartbeat 2"
    socket.send("2::")
  else:
    print "Message: ",echo
  time.sleep(2)
      

The websocket client I use here is from http://pypi.python.org/pypi/websocket-client/0.4.
I have a rudimentary heartbeat added here.
The whole script dies eventually, from having stripped all error-handling.
It worked some weeks ago. If you like to see the whole script, let me know.

Bedtime here, will check back in, like, 9 hours..

*frustrated and tired*

Ente

Ente
Legendary
*
Offline Offline

Activity: 2126
Merit: 1001



View Profile
February 15, 2012, 08:49:30 AM
 #180

1 BTC bounty for the first person who helps me receive regular data again over the websocket!

I made a new thread for this error-solving bounty:
https://bitcointalk.org/index.php?topic=63969.msg749747#msg749747

Ente
Pages: « 1 2 3 4 5 6 7 8 [9] 10 11 12 13 14 15 16 17 18 19 20 21 »  All
  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!