Skip to main content
Notice removed Draw attention by CommunityBot
Bounty Ended with no winning answer by CommunityBot
fixed link
Source Link
b3m2a1
  • 48k
  • 3
  • 98
  • 251

I'm trying to use Binance's API. The following works:

URLExecute[ <|"Scheme" -> "http", "Domain" -> "api.binance.com", 
                   "Method" -> "GET", "Path" -> "/api/v1/time"|>]
(* {"serverTime" -> 1519522573487} *)

but I would like to use the socket instead. I tried

socket = SocketConnect[{"api.binance.com", 443}]
WriteString[socket, "GET /api/v1/time"]
message = SocketReadMessage[socket]

but the last command never stops (even without the WriteString). I also tried replacing the first line with socket = SocketConnect["stream.binance.com:9443"], see binance docbinance doc, with the same result.

What is wrong and how can I connect to the socket to return, e.g., the server time or last orders?

Related: 26875 but does not use Mathematica's latest features and 165297.

I'm trying to use Binance's API. The following works:

URLExecute[ <|"Scheme" -> "http", "Domain" -> "api.binance.com", 
                   "Method" -> "GET", "Path" -> "/api/v1/time"|>]
(* {"serverTime" -> 1519522573487} *)

but I would like to use the socket instead. I tried

socket = SocketConnect[{"api.binance.com", 443}]
WriteString[socket, "GET /api/v1/time"]
message = SocketReadMessage[socket]

but the last command never stops (even without the WriteString). I also tried replacing the first line with socket = SocketConnect["stream.binance.com:9443"], see binance doc, with the same result.

What is wrong and how can I connect to the socket to return, e.g., the server time or last orders?

Related: 26875 but does not use Mathematica's latest features and 165297.

I'm trying to use Binance's API. The following works:

URLExecute[ <|"Scheme" -> "http", "Domain" -> "api.binance.com", 
                   "Method" -> "GET", "Path" -> "/api/v1/time"|>]
(* {"serverTime" -> 1519522573487} *)

but I would like to use the socket instead. I tried

socket = SocketConnect[{"api.binance.com", 443}]
WriteString[socket, "GET /api/v1/time"]
message = SocketReadMessage[socket]

but the last command never stops (even without the WriteString). I also tried replacing the first line with socket = SocketConnect["stream.binance.com:9443"], see binance doc, with the same result.

What is wrong and how can I connect to the socket to return, e.g., the server time or last orders?

Related: 26875 but does not use Mathematica's latest features and 165297.

Tweeted twitter.com/StackMma/status/968611445914198017
added 353 characters in body; edited tags; edited title
Source Link
anderstood
  • 14.6k
  • 2
  • 33
  • 85

SocketReadMessage never stops Using sockets to connect to a trading platform

I'm trying to use Binance's API. The following works:

URLExecute[ <|"Scheme" -> "http", "Domain" -> "api.binance.com", 
                   "Method" -> "GET", "Path" -> "/api/v1/time"|>]
(* {"serverTime" -> 1519522573487} *)

but I would like to use the socket instead. I tried

socket = SocketConnect[{"api.binance.com", 443}]
WriteString[socket, "GET /api/v1/time"]
message = SocketReadMessage[socket]

but the last command never stops (even without the WriteString). I also tried replacing the first line with socket = SocketConnect["stream.binance.com:9443"], see binance doc, with the same result.

What is wrong and how can I connect to the socket to return, e.g., the server time or last orders?

Related: 26875 but does not use Mathematica's latest features and 165297.

SocketReadMessage never stops

I'm trying to use Binance's API. The following works:

URLExecute[ <|"Scheme" -> "http", "Domain" -> "api.binance.com", 
                   "Method" -> "GET", "Path" -> "/api/v1/time"|>]
(* {"serverTime" -> 1519522573487} *)

but I would like to use the socket instead. I tried

socket = SocketConnect[{"api.binance.com", 443}]
WriteString[socket, "GET /api/v1/time"]
message = SocketReadMessage[socket]

but the last command never stops (even without the WriteString). I also tried replacing the first line with socket = SocketConnect["stream.binance.com:9443"], see binance doc, with the same result.

What is wrong and how can I connect to the socket to return, e.g., the server time?

Using sockets to connect to a trading platform

I'm trying to use Binance's API. The following works:

URLExecute[ <|"Scheme" -> "http", "Domain" -> "api.binance.com", 
                   "Method" -> "GET", "Path" -> "/api/v1/time"|>]
(* {"serverTime" -> 1519522573487} *)

but I would like to use the socket instead. I tried

socket = SocketConnect[{"api.binance.com", 443}]
WriteString[socket, "GET /api/v1/time"]
message = SocketReadMessage[socket]

but the last command never stops (even without the WriteString). I also tried replacing the first line with socket = SocketConnect["stream.binance.com:9443"], see binance doc, with the same result.

What is wrong and how can I connect to the socket to return, e.g., the server time or last orders?

Related: 26875 but does not use Mathematica's latest features and 165297.

Notice added Draw attention by anderstood
Bounty Started worth 50 reputation by anderstood
added 8 characters in body; edited title
Source Link
anderstood
  • 14.6k
  • 2
  • 33
  • 85

SocketReadMessage does not endnever stops

I'm trying to use Binance's API. The following works:

URLExecute[ <|"Scheme" -> "http", "Domain" -> "api.binance.com", 
                   "Method" -> "GET", "Path" -> "/api/v1/time"|>]
(* {"serverTime" -> 1519522573487} *)

but I would like to use the socket instead. I tried

socket = SocketConnect[{"api.binance.com", 443}]
WriteString[socket, "GET /api/v1/time"]
message = SocketReadMessage[socket]

but the last command never endsstops (even without the WriteString). I also tried replacing the first line with socket = SocketConnect["stream.binance.com:9443"], see binance doc, with the same result.

What is wrong and how can I connect to the socket to return, e.g., itsthe server time?

SocketReadMessage does not end

I'm trying to use Binance's API. The following works:

URLExecute[ <|"Scheme" -> "http", "Domain" -> "api.binance.com", 
                   "Method" -> "GET", "Path" -> "/api/v1/time"|>]
(* {"serverTime" -> 1519522573487} *)

but I would like to use the socket instead. I tried

socket = SocketConnect[{"api.binance.com", 443}]
WriteString[socket, "GET /api/v1/time"]
message = SocketReadMessage[socket]

but the last command never ends (even without the WriteString). I also tried replacing the first line with socket = SocketConnect["stream.binance.com:9443"], see binance doc, with the same result.

What is wrong and how can I connect to the socket to return, e.g., its time?

SocketReadMessage never stops

I'm trying to use Binance's API. The following works:

URLExecute[ <|"Scheme" -> "http", "Domain" -> "api.binance.com", 
                   "Method" -> "GET", "Path" -> "/api/v1/time"|>]
(* {"serverTime" -> 1519522573487} *)

but I would like to use the socket instead. I tried

socket = SocketConnect[{"api.binance.com", 443}]
WriteString[socket, "GET /api/v1/time"]
message = SocketReadMessage[socket]

but the last command never stops (even without the WriteString). I also tried replacing the first line with socket = SocketConnect["stream.binance.com:9443"], see binance doc, with the same result.

What is wrong and how can I connect to the socket to return, e.g., the server time?

Source Link
anderstood
  • 14.6k
  • 2
  • 33
  • 85
Loading