I am trying to connect to a web socket feed of Gdax. The documentation is here, https://docs.gdax.com/#websocket-feed. There is no account needed and the information is public. I have successfully connected see this post, SocketConnect not connecting to web socket address
After connection, a subscription message needs to be sent. My json looks exactly like the documentation but not successful.
socket = SocketConnect["ws-feed.gdax.com:80"];
json = ExportString[<|"type" -> "subcribe",
"product_ids" -> {"ETH-USD", "ETH-EUR"},
"channels" -> {"level2",
"heartbeat", <|"name" -> "ticker",
"product_ids" -> {"ETH-BTC", "ETH-USD"}|>}|>, "JSON"];
WriteString[socket, json]
result = ReadString[socket]
Yields an error message.
HTTP/1.1 400 Bad Request
Date: Wed, 07 Feb 2018 18:14:59 GMT
Content-Type: text/html
Content-Length: 177
Connection: close
Server: cloudflare-nginx
CF-RAY: -
400 Bad Request
400 Bad Request
cloudflare-nginx
I also tried this as a HTTPRequest
and returns same error message. I have also tried the request as a PUT to no avail.
request = HTTPRequest[<|"Body" -> json, Method -> "GET"|>];
WriteString[socket, request]
result = ReadString[socket]
Comments
Post a Comment