{"id":472021,"date":"2025-08-25T03:07:56","date_gmt":"2025-08-25T03:07:56","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=472021"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=472021","title":{"rendered":"<span>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 Binance REST API \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Java<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 <a href=\"https:\/\/habr.com\/ru\/companies\/amvera\/articles\/937894\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u043e\u0441\u043d\u043e\u0432\u044b \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 Java.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u043e \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c, \u043a\u0430\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <strong>Java 11+<\/strong> \u0431\u044b\u0441\u0442\u0440\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c HTTP GET\u2011\u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c JSON \u043e\u0442 <strong>Binance REST API<\/strong> \u0438 \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u044c \u0438\u0437 \u043d\u0435\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b \u043f\u0430\u0440\u044b (symbol) \u0438 \u0446\u0435\u043d\u0443 (price) \u2014 \u0431\u0435\u0437 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439.<\/p>\n<p>Binance \u2014 \u043e\u0434\u043d\u0430 \u0438\u0437 \u043a\u0440\u0443\u043f\u043d\u0435\u0439\u0448\u0438\u0445 \u043a\u0440\u0438\u043f\u0442\u043e\u0431\u0438\u0440\u0436 \u043c\u0438\u0440\u0430, \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u0442 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 REST\u2011\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \/api\/v3\/ticker\/price, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0432\u0438\u0434\u0430:<\/p>\n<pre><code>{ \"symbol\": \"BTCUSDT\", \"price\": \"60713.44000000\" } <\/code><\/pre>\n<p>\u0438\u043b\u0438 \u043c\u0430\u0441\u0441\u0438\u0432 \u0442\u0430\u043a\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043f\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0431\u0435\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 symbol. \u0414\u043e\u0441\u0442\u0443\u043f \u043a \u044d\u0442\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u043c \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439, \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 API\u2011\u043a\u043b\u044e\u0447\u0430 \u0438\u043b\u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<p>\u041c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043d\u0430 Java\u2011\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0441\u0442\u0440\u043e\u043a:<\/p>\n<ul>\n<li>\n<p>\u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c HTTP GET\u2011\u0437\u0430\u043f\u0440\u043e\u0441 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0433\u043e HttpClient (\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e JDK \u0441 Java 11);<\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0441\u0442\u0430\u0442\u0443\u0441 \u043a\u043e\u0434 \u043e\u0442\u0432\u0435\u0442\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 200 OK);<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0435\u043b\u043e \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 JSON \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e BodyHandlers.ofString();<\/p>\n<\/li>\n<li>\n<p>\u043f\u0430\u0440\u0441\u0438\u043c JSON (Jackson\/Gson) \u0432 POJO \u0438 \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u044f symbol \u0438 price.<\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0431\u0445\u043e\u0434 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0441\u0435\u0440\u0432\u0435\u0440\u0430.<\/p>\n<h3>\u0428\u0430\u0433\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 (\u043a\u043e\u0434\u043e\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c)<\/h3>\n<p><strong>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 HttpClient<\/strong><\/p>\n<pre><code>HttpClient client = HttpClient.newBuilder()         .version(HttpClient.Version.HTTP_2)         .connectTimeout(Duration.ofSeconds(10))         .build();<\/code><\/pre>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u043c\u044b \u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u043d\u0430\u0448\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u043a\u0430\u0441\u0430\u044e\u0449\u0443\u044e\u0441\u044f \u043e\u0441\u043d\u043e\u0432 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u0432 Java.<\/p>\n<p><strong>\u0424\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 URL \u0438 HttpRequest<\/strong><\/p>\n<pre><code>URI uri = URI.create(\"https:\/\/api.binance.com\/api\/v3\/ticker\/price?symbol=BTCUSDT\"); HttpRequest req = HttpRequest.newBuilder(uri)         .timeout(Duration.ofSeconds(5))         .header(\"Accept\", \"application\/json\")         .GET()         .build(); <\/code><\/pre>\n<p>\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0442\u0430\u0439\u043c\u0430\u0443\u0442, Accept, HTTPS<\/p>\n<p><strong>\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u0442\u0430\u0442\u0443\u0441\u0430<\/strong><\/p>\n<pre><code>HttpResponse&lt;String&gt; resp = client.send(req, BodyHandlers.ofString()); int code = resp.statusCode();  if (code != 200) {         throw new RuntimeException(\"BTC price HTTP error: \" + code);  }<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c 2xx.<\/p>\n<p><strong>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u0434\u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445<\/strong><\/p>\n<pre><code>class Ticker {     private String symbol;     private String price;      public String getSymbol() {         return symbol;     }      public void setSymbol(String symbol) {         this.symbol = symbol;     }      public String getPrice() {         return price;     }      public void setPrice(String price) {         this.price = price;     } }<\/code><\/pre>\n<p>\u041a\u043b\u0430\u0441\u0441 Ticker \u2014 \u044d\u0442\u043e POJO (Plain Old Java Object), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 API Binance. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u043d \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 JSON-\u043e\u0431\u044a\u0435\u043a\u0442\u0443 \u0441 \u043f\u043e\u043b\u044f\u043c\u0438 symbol (\u0442\u0438\u043a\u0435\u0440, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, BTCUSDT) \u0438 price (\u0442\u0435\u043a\u0443\u0449\u0430\u044f \u0446\u0435\u043d\u0430).<\/p>\n<p>\u0413\u0435\u0442\u0442\u0435\u0440\u044b (get&#8230;()) \u0438 \u0441\u0435\u0442\u0442\u0435\u0440\u044b (set&#8230;()) \u2014 \u044d\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0432 Java \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u043c \u043f\u043e\u043b\u044f\u043c \u043a\u043b\u0430\u0441\u0441\u0430.<\/p>\n<p><strong>\u0413\u0435\u0442\u0442\u0435\u0440\u044b <\/strong>(getters) \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u043e\u0431\u044a\u0435\u043a\u0442\u0430.<\/p>\n<p><strong>\u0421\u0435\u0442\u0442\u0435\u0440\u044b <\/strong>(setters) \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u0435.<\/p>\n<p><strong>\u0427\u0442\u0435\u043d\u0438\u0435 \u0438 \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f JSON<\/strong><\/p>\n<p>\u0414\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043f\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f (\u043c\u0430\u043f\u043f\u0438\u043d\u0433\u0430) \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b JSON-\u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 Java-\u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Jackson.\u00a0<\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 Binance \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 JSON-\u043c\u0430\u0441\u0441\u0438\u0432 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043e \u0442\u0438\u043a\u0435\u0440\u0430\u0445, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043a\u043b\u0430\u0441\u0441\u0430 Ticker, \u0433\u0434\u0435 \u043a\u0430\u0436\u0434\u043e\u0435 \u043f\u043e\u043b\u0435 JSON <em>symbol<\/em>, <em>price<\/em> \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u043f\u043e\u043b\u0435\u043c Java-\u043a\u043b\u0430\u0441\u0441\u0430 \u0447\u0435\u0440\u0435\u0437 \u0433\u0435\u0442\u0442\u0435\u0440\u044b \u0438 \u0441\u0435\u0442\u0442\u0435\u0440\u044b.<\/p>\n<pre><code>String json = resp.body(); Ticker t = new ObjectMapper().readValue(json, Ticker.class); \/\/ \u041f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u043f\u043e\u043b\u044f:  \/\/ public class Ticker { public String symbol; public String price; }  BigDecimal price = new BigDecimal(t.price);<\/code><\/pre>\n<p>(\u0438\u043b\u0438 \u043c\u0430\u0441\u0441\u0438\u0432, \u0435\u0441\u043b\u0438 symbol \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d).<\/p>\n<p><strong>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u043f\u0438\u0441\u043a\u0430<\/strong>:<\/p>\n<p>\u0435\u0441\u043b\u0438 \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <em>symbol<\/em>, JAckson \u0432\u0435\u0440\u043d\u0451\u0442 List&lt;Ticker&gt;, \u0434\u0430\u043b\u0435\u0435 .forEach(t -&gt; \u2026).<\/p>\n<h4>\u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f (\u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0439)<\/h4>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c JSON-\u043e\u0442\u0432\u0435\u0442 \u043e\u0442 Binance API \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u044b Ticker, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 Jackson \u043f\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0438\u0437 <a href=\"https:\/\/habr.com\/ru\/companies\/amvera\/articles\/937894\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438<\/a>, \u043f\u043e\u0441\u0432\u044f\u0449\u0451\u043d\u043d\u043e\u0439 \u043e\u0441\u043d\u043e\u0432\u0430\u043c \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u042f\u043d\u0434\u0435\u043a\u0441 \u041a\u0430\u0440\u0442.<\/p>\n<p><strong>\u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a \u043a\u043e\u0434\u0443<\/strong><\/p>\n<pre><code>CompletableFuture&lt;List&lt;Ticker&gt;&gt; f = client.sendAsync(req, BodyHandlers.ofString())         .thenApply(HttpResponse::body)         .thenApply(body -&gt; Arrays.asList(new ObjectMapper().readValue(body, Ticker[].class)));  f.thenAccept(list -&gt; list.forEach(System.out::println));<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 HTTP GET\u2011\u0437\u0430\u043f\u0440\u043e\u0441 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f sendAsync(&#8230;), \u0447\u0442\u043e \u0441\u0440\u0430\u0437\u0443 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 CompletableFuture&lt;HttpResponse&lt;String&gt;&gt; \u0435\u0449\u0451 \u0434\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f HTTP\u2011\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u2014 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043f\u043e\u0442\u043e\u043a \u043d\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442\u0441\u044f, \u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f.<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 sendAsync \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0438 \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0431\u0443\u0434\u0443\u0449\u0435\u0435, \u043d\u0435 \u0434\u043e\u0436\u0438\u0434\u0430\u044f\u0441\u044c \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f I\/O.\u2003<\/p>\n<p>\u0427\u0435\u0440\u0435\u0437 .thenApply(HttpResponse::body) \u043c\u044b. \u043d\u043e\u0432\u043e\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 CompletableFuture&lt;HttpResponse&lt;String&gt;&gt; \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c \u0432 CompletableFuture&lt;String&gt; \u2014 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u0435 \u0442\u0435\u043b\u043e HTTP\u2011\u043e\u0442\u0432\u0435\u0442\u0430 (JSON\u2011\u0441\u0442\u0440\u043e\u043a\u0443). \u042d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u043a\u043e\u0433\u0434\u0430 \u0442\u0435\u043b\u043e \u0433\u043e\u0442\u043e\u0432\u043e, \u0432\u0435\u0440\u0445\u043d\u0438\u0435 \u0447\u0430\u0441\u0442\u0438 \u043e\u0442\u0432\u0435\u0442\u0430 \u0443\u0436\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b (\u0441\u0442\u0430\u0442\u0443\u0441\/\u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438), \u0438 BodyHandlers.ofString() \u0443\u043f\u0430\u043a\u043e\u0432\u0430\u043b\u0430 \u0442\u0435\u043b\u043e \u0432 String \u043e\u0431\u044a\u0435\u043a\u0442.<\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c .thenApply(&#8230;) \u043c\u044b \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c JSON\u2011\u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 Ticker[], \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Jackson ObjectMapper.readValue(body, Ticker[].class), \u0437\u0430\u0442\u0435\u043c \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0432 List&lt;Ticker&gt; \u2014 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c CompletableFuture&lt;List&lt;Ticker&gt;&gt;. \u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d \u043d\u0430 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430\u0445 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f: \u043a\u0430\u0436\u0434\u0430\u044f \u0441\u0442\u0443\u043f\u0435\u043d\u044c \u0446\u0435\u043f\u043e\u0447\u043a\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0430\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 .thenAccept(list -&gt; &#8230;): \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e CompletableFuture&lt;List&lt;Ticker&gt;&gt; \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u0441\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e, JVM \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 Consumer&lt;List&lt;Ticker&gt;&gt;, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u043a\u0430\u0436\u0434\u0443\u044e \u043f\u0430\u0440\u0443 (symbol + price) \u0447\u0435\u0440\u0435\u0437 println.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439 JSON, I\/O \u043e\u0448\u0438\u0431\u043a\u0430, timeout), \u043e\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0431\u0440\u043e\u0448\u0435\u043d\u043e \u0432\u043d\u0443\u0442\u0440\u044c CompletableFuture, \u0438 \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 .exceptionally(&#8230;) \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u044d\u0442\u0430\u043f\u0435 \u0446\u0435\u043f\u043e\u0447\u043a\u0438.<\/p>\n<p><strong>\u0418\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u043a\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/strong><\/p>\n<pre><code>package org.example;  import java.net.URI; import java.net.http.*; import java.net.http.HttpResponse.BodyHandlers; import java.util.*; import java.util.concurrent.*; import com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException;  class Ticker {     private String symbol;     private String price;      public String getSymbol() {         return symbol;     }      public void setSymbol(String symbol) {         this.symbol = symbol;     }      public String getPrice() {         return price;     }      public void setPrice(String price) {         this.price = price;     } }  public class GetRequestExample {      public static void main(String[] args) {         HttpClient client = HttpClient.newHttpClient();          HttpRequest request = HttpRequest.newBuilder()                 .uri(URI.create(\"https:\/\/api.binance.com\/api\/v3\/ticker\/price\"))                 .header(\"Accept\", \"application\/json\")                 .GET()                 .build();          CompletableFuture&lt;List&lt;Ticker&gt;&gt; future = client.sendAsync(request, BodyHandlers.ofString())                 .thenApply(HttpResponse::body)                 .thenApply(json -&gt; {                     try {                         return Arrays.asList(new ObjectMapper()                                 .readValue(json, Ticker[].class));                     } catch (IOException e) {                         throw new CompletionException(e);                     }                 });          future.thenAccept(tickers -&gt; tickers.forEach(t -&gt;                 System.out.println(t.getSymbol() + \" \u2192 \" + t.getPrice())         )).exceptionally(err -&gt; {             System.err.println(\"\u041e\u0448\u0438\u0431\u043a\u0430: \" + err.getCause());             return null;         });           future.join();     } }<\/code><\/pre>\n<h2>\u041e\u0431\u0445\u043e\u0434 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043e\u043a \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/h2>\n<p>Binance \u043c\u043e\u0436\u0435\u0442 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043f\u0440\u0438 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0447\u0430\u0441\u0442\u043e \u0438\u043b\u0438 \u0431\u0435\u0437 \u0441\u043e\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u0430\u0432\u0438\u043b API. \u0412\u043e\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u0440\u0438\u0447\u0438\u043d\u044b \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0438\u0445 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c:<\/p>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, Binance \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0441\u0442\u0440\u043e\u0433\u0438\u0435 \u043b\u0438\u043c\u0438\u0442\u044b \u043d\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438 \u043f\u0440\u0435\u0432\u044b\u0448\u0435\u043d\u0438\u0438 \u043b\u0438\u043c\u0438\u0442\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043c\u043e\u0436\u0435\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c IP-\u0430\u0434\u0440\u0435\u0441 \u0441 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0435\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c WebSocket \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u043c\u0435\u0441\u0442\u043e \u0447\u0430\u0441\u0442\u044b\u0445 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n<p>\u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u043e\u0448\u0438\u0431\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043c\u0435\u0442\u043a\u043e\u0439 \u0438\u043b\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u044c\u044e. \u042d\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0435.<\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, Binance \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0431\u043e\u0440\u0435\u0442\u0441\u044f \u0441 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u043e\u043c, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0435\u0441\u043b\u0438 \u043e\u043d \u0438\u043c\u0438\u0442\u0438\u0440\u0443\u0435\u0442 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0431\u0435\u0437 API-\u043a\u043b\u044e\u0447\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u044f\u043c\u043e\u0435 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u043c \u043c\u043e\u0433\u0443\u0442 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 API (<a href=\"http:\/\/api.binance.com\" rel=\"noopener noreferrer nofollow\">api.binance.com<\/a>) \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n<p><strong>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c WebSocket. <\/strong>\u041e\u043d \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c, \u0447\u0442\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u043e\u0434\u0438\u043d \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u044b\u0439 \u043a\u0430\u043d\u0430\u043b, \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0448\u043b\u0451\u0442 \u0434\u0430\u043d\u043d\u044b\u0435, \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u0445 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n<p><strong>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 WebSocket \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 WebSocket \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u0445 pom.xml<\/strong><\/p>\n<pre><code>&lt;dependency&gt;     &lt;groupId&gt;org.java-websocket&lt;\/groupId&gt;     &lt;artifactId&gt;Java-WebSocket&lt;\/artifactId&gt;     &lt;version&gt;1.5.3&lt;\/version&gt; &lt;\/dependency&gt;<\/code><\/pre>\n<p><strong>\u0414\u0430\u043b\u0435\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e URI \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f<\/strong><\/p>\n<pre><code>URI uri = new URI(\"wss:\/\/stream.binance.com:9443\/ws\");<\/code><\/pre>\n<p>\u0412 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u043d\u0430\u0448\u0435\u0433\u043e URI \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b <em>&#171;wss:\/\/&#8230;&#187;. <\/em>\u041e\u043d \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u043c WebSocket Secure (\u0430\u043d\u0430\u043b\u043e\u0433 HTTPS \u0434\u043b\u044f WS), \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u043c \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u0430\u043d\u0430\u043b\u0430 \u0441\u0432\u044f\u0437\u0438 \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c \u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442 Binance \u0434\u043b\u044f WebSocket-\u0441\u0442\u0440\u0438\u043c\u043e\u0432 \u2014 <em>stream.binance.com:9443<\/em><\/p>\n<p>\u0412\u0430\u0436\u043d\u043e: Binance \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u0440\u0442 9443 \u0434\u043b\u044f \u0437\u0430\u0449\u0438\u0449\u0451\u043d\u043d\u043e\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p><strong>\/ws<\/strong> \u2014 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043f\u0443\u0442\u044c \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0432\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f \u0441 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u043e\u0439 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0438\u0437 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0433\u0438\u043e\u043d\u043e\u0432 \u0438\u043b\u0438 \u043f\u0440\u0438 \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f. \u0414\u043b\u044f \u043e\u0431\u0445\u043e\u0434\u0430 \u044d\u0442\u043e\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 URI:<\/p>\n<pre><code>URI uri = new URI(\"wss:\/\/stream.binance.us:9443\/ws\"); \/\/ \u0434\u043b\u044f \u0421\u0428\u0410 URI uri = new URI(\"wss:\/\/stream.binance.me:9443\/ws\"); \/\/ \u0434\u043b\u044f \u0415\u0432\u0440\u043e\u043f\u044b<\/code><\/pre>\n<p><strong>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e WebSocketClient<\/strong><\/p>\n<pre><code>WebSocketClient ws = new WebSocketClient(uri){   } <\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 WebSocketClient. \u0412 \u043d\u0451\u043c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c 4 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u0430 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f:<\/p>\n<p><strong>\u041c\u0435\u0442\u043e\u0434 onOpen \u2014 \u043f\u0440\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438<\/strong><\/p>\n<pre><code>@Override public void onOpen(ServerHandshake h) {     System.out.println(\"WS Open\");     subscribeTicker(\"btcusdt\"); }<\/code><\/pre>\n<p>\u041e\u043d \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f. \u0417\u0434\u0435\u0441\u044c <em>ServerHandshake <\/em>\u2014 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0434\u0430\u043d\u043d\u044b\u0435, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c (\u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u0438 \u0442. \u0434.). <em>subscribeTicker(&#171;btcusdt&#187;)<\/em> \u2014 \u043f\u0440\u0438\u043c\u0435\u0440 \u043c\u0435\u0442\u043e\u0434\u0430 \u0434\u043b\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0438 \u043d\u0430 \u0442\u0438\u043a\u0435\u0440\u044b (\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0438\u0436\u0435). \u042d\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0431\u0435\u0437 REST-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c.<\/p>\n<p><strong>\u041c\u0435\u0442\u043e\u0434 onMessage \u2014 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/strong><\/p>\n<pre><code>@Override public void onMessage(String msg) {     handleMessage(msg); }<\/code><\/pre>\n<p>\u041e\u043d \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0412 \u043d\u0451\u043c \u043c\u044b \u0437\u0430\u0434\u0430\u0451\u043c \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <em>msg <\/em>\u2014 \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON. \u0418 \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 <em>handleMessage(msg).<\/em><\/p>\n<p><strong>\u041c\u0435\u0442\u043e\u0434 onClose \u2014 \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u044b\u0432\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f<\/strong><\/p>\n<pre><code>@Override public void onClose(int code, String reason, boolean remote) {     System.err.println(\"Closed: \"+code+\" reason=\"+reason);     scheduleReconnect(); }<\/code><\/pre>\n<p>\u0412 \u043d\u0451\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f <em>code <\/em>\u2014 2\u0445\u0445 \u043a\u043e\u0434 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f, <em>reason <\/em>\u2014 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u0435 2\u0445\u0445 \u043a\u043e\u0434\u0430, <em>remote <\/em>\u2014 true, \u0435\u0441\u043b\u0438 \u0440\u0430\u0437\u0440\u044b\u0432 \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043d \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u0438 <em>scheduleReconnect() <\/em>\u2014 \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u043e\u043d \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e.<\/p>\n<p><strong>\u041c\u0435\u0442\u043e\u0434 onError \u2014 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a<\/strong><\/p>\n<pre><code>@Override public void onError(Exception ex) {     ex.printStackTrace(); }<\/code><\/pre>\n<p>\u041e\u043d \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043e\u0448\u0438\u0431\u043a\u0430\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f. Exception \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c SocketTimeoutException, SSLException \u0438 \u0434\u0440.<\/p>\n<p><strong>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0443 \u043d\u0430 \u043d\u0443\u0436\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 (\u043c\u0435\u0442\u043e\u0434 subscribeTicker)<\/strong><\/p>\n<pre><code>private static String subscribeJson(String symbol) {     ObjectNode n = mapper.createObjectNode();     n.put(\"method\", \"SUBSCRIBE\");     n.putArray(\"params\").add(symbol.toLowerCase() + \"@miniTicker\");     n.put(\"id\", 1);     n.put(\"returnRateLimits\", true);     return n.toString(); }<\/code><\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434 subscribeTicker \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <em>symbol <\/em>(\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 &#171;BTCUSDT&#187;). \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043e\u043d \u0441\u043e\u0437\u0434\u0430\u0435\u0442 JSON-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0438 \u043d\u0430 WebSocket-\u043a\u0430\u043d\u0430\u043b \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 <em>ws.<\/em><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f JSON-\u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u0430 <em>SUBSCRIBE <\/em>\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u043a\u0430\u043d\u0430\u043b\u043e\u0432 <em>%s@miniTicker <\/em>\u0441 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n<p><strong>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439<\/strong><\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 JSON \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u0430:<\/p>\n<ul>\n<li>\n<p>\u0442\u0438\u043f \u0441\u043e\u0431\u044b\u0442\u0438\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, &#171;24hrMiniTicker&#187;)<\/p>\n<\/li>\n<li>\n<p>\u0441\u0438\u043c\u0432\u043e\u043b \u0442\u043e\u0440\u0433\u043e\u0432\u043e\u0439 \u043f\u0430\u0440\u044b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 &#171;BTCUSDT&#187;)<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0446\u0435\u043d\u044b \u0432 \u043f\u043e\u043b\u0435 <em>c<\/em> (\u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0446\u0435\u043d\u0430) \u0438\u043b\u0438 <em>p<\/em> (\u0446\u0435\u043d\u0430 \u0441\u0434\u0435\u043b\u043a\u0438)<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435: BTCUSDT \u2013 50000.00<\/p>\n<\/li>\n<\/ul>\n<pre><code>private void handleMessage(String msg) {     JsonNode node = mapper.readTree(msg);     if (node.has(\"result\") || node.has(\"id\")) {      } else if (node.has(\"e\")) {         String symbol = node.get(\"s\").asText();         String price = node.has(\"c\") ? node.get(\"c\").asText() : node.get(\"p\").asText();         System.out.println(symbol + \" \u2192 \" + price);     } else if (node.has(\"rateLimits\")) {         rateTracker.update(node.get(\"rateLimits\"));     } } <\/code><\/pre>\n<p><strong>e<\/strong> \u2013 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0442\u0438\u043f \u0441\u043e\u0431\u044b\u0442\u0438\u044f, <strong>s \u2013 <\/strong>\u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0438\u043c\u0432\u043e\u043b \u0442\u043e\u0440\u0433\u043e\u0432\u043e\u0439 \u043f\u0430\u0440\u044b<\/p>\n<p>\u041f\u043e\u043b\u0435 <em>rateLimits <\/em>\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u2014 \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043b\u0438\u043c\u0438\u0442\u043e\u0432.<\/p>\n<p><strong>\u041e\u0431\u0445\u043e\u0434 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0438 \u043b\u0438\u043c\u0438\u0442\u0430<\/strong><\/p>\n<p>\u041b\u044e\u0431\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b: PING\/PONG, SUBSCRIBE\/UNSUBSCRIBE \u0441\u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0435 \u0431\u043e\u043b\u0435\u0435 5 \u0442\u0430\u043a\u0438\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 \u2014 \u0441\u0435\u0440\u0432\u0435\u0440 \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u0430\u043d\u0438\u0442\u044c IP. \u0414\u043b\u044f \u043e\u0431\u0445\u043e\u0434\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c:<\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u0435\u0440\u0435\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c <a href=\"http:\/\/backoff.next\" rel=\"noopener noreferrer nofollow\"><em>backoff.next<\/em><\/a><em>()<\/em> \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0438 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 <em>scheduleReconnectDelay()<\/em><\/p>\n<pre><code>private static void scheduleReconnect() {     scheduleReconnectDelay(backoff.next()); }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u043f\u0435\u0440\u0435\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f. \u041e\u043d \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0435\u0440\u0435\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u043f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0434\u043d\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u044b\u0439 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a <em>ScheduledExecutorService <\/em>\u0438 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 <em>delaySec <\/em>\u0441\u0435\u043a\u0443\u043d\u0434. \u041b\u043e\u0433\u0438\u043a\u0430 \u043f\u0435\u0440\u0435\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u0441\u0431\u0440\u043e\u0441 \u0441\u0447\u0451\u0442\u0447\u0438\u043a\u0430 \u043f\u043e\u043f\u044b\u0442\u043e\u043a <em>backoff.reset()<\/em> \u0438 \u0432\u044b\u0437\u043e\u0432\u0430 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f <em>ws.reconnect().<\/em><\/p>\n<pre><code>private static void scheduleReconnectDelay(int delaySec) {     System.err.println(\"Reconnect in \" + delaySec + \"s\");     ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor();     exec.schedule(() -&gt; {         backoff.reset();         ws.reconnect();     }, delaySec, TimeUnit.SECONDS); }<\/code><\/pre>\n<p><strong>\u0414\u0430\u043b\u0435\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0440\u0435\u043a\u043e\u043d\u043d\u0435\u043a\u0442 \u043f\u0440\u0438 \u043e\u0448\u0438\u0431\u043a\u0430\u0445<\/strong><\/p>\n<p>WebSocket \u043c\u043e\u0436\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0447\u0435\u0440\u0435\u0437 24 \u0447\u0430\u0441\u0430 \u0438\u043b\u0438 \u0436\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0414\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0435\u043a\u043e\u043d\u0435\u043a\u0442\u0438\u043d\u0433\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043b\u0430\u0441\u0441 RateTracker.<\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u0437\u0430\u0434\u0430\u0451\u043c \u043f\u043e\u043b\u044f \u043d\u0430\u0448\u0435\u043c\u0443 \u043a\u043b\u0430\u0441\u0441\u0443.<\/p>\n<pre><code>private int current = 0, limit = Integer.MAX_VALUE;<\/code><\/pre>\n<p><strong>current \u2014<\/strong> \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 &#171;\u0435\u0434\u0438\u043d\u0438\u0446 \u0432\u0435\u0441\u0430&#187; \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/p>\n<p><strong>limit \u2014<\/strong> \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0439 \u043b\u0438\u043c\u0438\u0442, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e<em> Integer.MAX_VALUE<\/em><\/p>\n<p><strong>\u0414\u0430\u043b\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u0435\u0442\u043e\u0434 update(JsonNode arr)<\/strong><\/p>\n<p>\u0412 \u043d\u0451\u043c \u0431\u0443\u0434\u0443\u0442 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0442\u0435\u043a\u0443\u0449\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043b\u0438\u043c\u0438\u0442\u043e\u0432 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442 Binance.<\/p>\n<p>\u041b\u043e\u0433\u0438\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c:<\/p>\n<ol>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u043c \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u0430 arr (\u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043e\u0442 Binance)<\/p>\n<\/li>\n<li>\n<p>\u0418\u0449\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u0443\u0434\u0435\u043c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f: <em>REQUEST_WEIGHT<\/em> (\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 \u0432\u0435\u0441 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432), <em>MINUTE <\/em>(\u043b\u0438\u043c\u0438\u0442 \u0432 \u043c\u0438\u043d\u0443\u0442\u0443)<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c <em>current <\/em>\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c <em>count <\/em>(\u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435), \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u043b\u0435 <em>limit <\/em>\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c <em>limit <\/em>(\u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043b\u0438\u043c\u0438\u0442 \u0432\u0435\u0441\u0430), \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c<\/p>\n<\/li>\n<\/ol>\n<p>\u041a\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code>void update(JsonNode arr) {         arr.forEach(elem -&gt; {             if (\"REQUEST_WEIGHT\".equals(elem.get(\"rateLimitType\").asText()) &amp;&amp;                     \"MINUTE\".equals(elem.get(\"interval\").asText())) {                 current = elem.get(\"count\").asInt();                 limit = elem.get(\"limit\").asInt();                 System.out.println(\"Used weight\/min: \" + current + \"\/\" + limit);             }         });     } }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e, \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u0430, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c, \u043d\u0435 \u043f\u0440\u0435\u0432\u044b\u0441\u0438\u0442 \u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 &#171;\u0432\u0435\u0441&#187; \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043b\u0438\u043c\u0438\u0442.<\/p>\n<pre><code>boolean wouldExceed(int cost) {     return current + cost &gt; limit; }<\/code><\/pre>\n<p><strong>\u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430, \u043e\u0434\u043d\u0430\u043a\u043e, \u0434\u043b\u044f \u043b\u0443\u0447\u0448\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u043a\u043b\u0430\u0441\u0441 ExponentialBackoff<\/strong><\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0438 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e\u0433\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u043c\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0430\u043c\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0442\u0438\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0430.<\/p>\n<p>\u041a\u043b\u0430\u0441\u0441 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u043e \u043b\u043e\u0433\u0438\u043a\u0435:<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u043e\u043b\u0435 <em>attempt<\/em>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u0441\u0447\u0451\u0442\u0447\u0438\u043a \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u044b\u0445 \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0443\u0442 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0443\u043b\u0451\u043c \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430.<\/p>\n<pre><code>private int attempt = 0;<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043c\u0435\u0442\u043e\u0434 <em>next()<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0442\u044c \u0441\u0447\u0451\u0442\u0447\u0438\u043a \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439. \u0412 \u043d\u0451\u043c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0443 \u043f\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u0435 \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u043e\u0441\u0442\u0430. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0440\u0435\u0440\u0432\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0443 60 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u043c\u0438 \u0438 \u0432\u0435\u0440\u043d\u0451\u043c \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0438 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445.<\/p>\n<pre><code>int next() {     attempt++;     return Math.min(60, (int)Math.pow(2, attempt)); }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043c\u0435\u0442\u043e\u0434 <em>reset(), <\/em>\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u043d\u0443\u043b\u044f\u0442\u044c \u0441\u0447\u0451\u0442\u0447\u0438\u043a \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f:<\/p>\n<pre><code>void reset() { attempt = 0; }<\/code><\/pre>\n<p><strong>\u0418\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u043a\u043e\u0434 \u0441 \u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u0437\u0432\u0451\u0440\u043d\u0443\u0442\u044b\u043c \u043a\u043b\u0430\u0441\u0441\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/strong><\/p>\n<pre><code>package org.example;  import java.net.URI; import java.util.concurrent.*; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.node.ObjectNode; import org.java_websocket.client.WebSocketClient; import org.java_websocket.handshake.ServerHandshake;  public class Binance {     private static final ObjectMapper mapper = new ObjectMapper();     private static final ScheduledExecutorService controlScheduler = Executors.newSingleThreadScheduledExecutor();     private static final BlockingQueue&lt;String&gt; controlQueue = new LinkedBlockingQueue&lt;&gt;();     private static WebSocketClient ws;     private static RateTracker rateTracker = new RateTracker();     private static ExponentialBackoff backoff = new ExponentialBackoff();      public static void main(String[] args) throws Exception {         URI uri = new URI(\"wss:\/\/stream.binance.us:9443\/ws\");         ws = new WebSocketClient(uri) {             @Override public void onOpen(ServerHandshake h) {                 System.out.println(\"WS Open\");                 enqueue(subscribeJson(\"BTCUSDT\"));             }             @Override public void onMessage(String msg) {                 handleMessage(msg);             }             @Override public void onClose(int code, String reason, boolean remote) {                 System.err.println(\"Closed: \" + code + \" reason=\" + reason);                 scheduleReconnect();             }             @Override public void onError(Exception ex) {                 ex.printStackTrace();             }         };         ws.connect();         controlScheduler.scheduleAtFixedRate(() -&gt; {             String cmd = controlQueue.poll();             if (cmd != null) ws.send(cmd);         }, 0, 200, TimeUnit.MILLISECONDS);     }      private static String subscribeJson(String symbol) {         ObjectNode n = mapper.createObjectNode();         n.put(\"method\", \"SUBSCRIBE\");         n.putArray(\"params\").add(symbol.toLowerCase() + \"@miniTicker\");         n.put(\"id\", 1);         n.put(\"returnRateLimits\", true);         return n.toString();     }      private static void enqueue(String json) {         controlQueue.offer(json);     }      private static void handleMessage(String msg) {         try {             JsonNode n = mapper.readTree(msg);             if (n.has(\"rateLimits\")) {                 rateTracker.update(n.get(\"rateLimits\"));             } else if (n.has(\"e\")) {                 String symbol = n.get(\"s\").asText();                 String price = n.has(\"c\") ? n.get(\"c\").asText() : n.get(\"p\").asText();                 System.out.println(symbol + \" \u2192 \" + price);             } else if (n.has(\"status\") &amp;&amp; n.get(\"status\").asInt() == 429) {                 int ra = n.has(\"retryAfter\") ? n.get(\"retryAfter\").asInt() : 1;                 System.err.println(\"Got 429, retrying after \" + ra + \"s\");                 pauseAndReconnect(ra);             } else if (n.has(\"status\") &amp;&amp; n.get(\"status\").asInt() == 418) {                 long ts = n.get(\"retryAfter\").asLong();                 System.err.println(\"IP banned until \" + ts);                 pauseAndReconnect((int)((ts - System.currentTimeMillis())\/1000));             }         } catch (Exception e) {             e.printStackTrace();         }     }      private static void pauseAndReconnect(int seconds) {         controlQueue.clear();         scheduleReconnectDelay(seconds);     }      private static void scheduleReconnect() {         scheduleReconnectDelay(backoff.next());     }      private static void scheduleReconnectDelay(int delaySec) {         System.err.println(\"Reconnect in \" + delaySec + \"s\");         ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor();         exec.schedule(() -&gt; {             backoff.reset();             ws.reconnect();         }, delaySec, TimeUnit.SECONDS);     }      static class RateTracker {         private int current = 0, limit = Integer.MAX_VALUE;         void update(JsonNode arr) {             arr.forEach(elem -&gt; {                 if (\"REQUEST_WEIGHT\".equals(elem.get(\"rateLimitType\").asText()) &amp;&amp;                         \"MINUTE\".equals(elem.get(\"interval\").asText())) {                     current = elem.get(\"count\").asInt();                     limit = elem.get(\"limit\").asInt();                     System.out.println(\"Used weight\/min: \" + current + \"\/\" + limit);                 }             });         }         boolean wouldExceed(int cost) {             return current + cost &gt; limit;         }     }      static class ExponentialBackoff {         private int attempt = 0;         int next() {             attempt++;             return Math.min(60, (int)Math.pow(2, attempt));         }         void reset() { attempt = 0; }     } } <\/code><\/pre>\n<h2>\u0420\u0430\u0437\u0432\u0435\u0440\u043d\u0451\u043c \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435<\/h2>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0432 \u043e\u0431\u043b\u0430\u043a\u0435<strong> <\/strong><a href=\"https:\/\/amvera.ru\/\" rel=\"noopener noreferrer nofollow\"><strong>Amvera<\/strong><\/a><strong>.<\/strong><\/p>\n<p><strong>\u042d\u0442\u043e \u043d\u0430\u043c \u0434\u0430\u0441\u0442 \u0440\u043e\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0435 IP \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u043e\u0432\/\u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0447\u0442\u043e, \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0431\u0430\u043d\u0430 \u0437\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. <\/strong>\u041c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u043a\u043e\u0434 \u0447\u0435\u0440\u0435\u0437 git push, \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0441 \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0438 \u043f\u043e\u0447\u0442\u0438 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0434\u0443\u043c\u0430\u0442\u044c \u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430.<\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c\u0441\u044f \u043f\u043e <a href=\"https:\/\/amvera.ru\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a>. \u0421\u0442\u0430\u0440\u0442\u043e\u0432\u043e\u0433\u043e \u0431\u0430\u043b\u0430\u043d\u0441\u0430 \u0445\u0432\u0430\u0442\u0438\u0442 \u043d\u0430 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b \u0438 \u043f\u0435\u0440\u0432\u044b\u0435 \u043d\u0435\u0434\u0435\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>\u041d\u0430\u0445\u043e\u0434\u044f\u0441\u044c \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435, \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u00ab\u0421\u043e\u0437\u0434\u0430\u0442\u044c\u00bb.<\/p>\n<p>\u0412\u0432\u043e\u0434\u0438\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0442\u0430\u0440\u0438\u0444 \u00ab\u041d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u041f\u043b\u044e\u0441\u00bb. \u0414\u0430\u043b\u043b\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0442\u0430\u0440\u0438\u0444, \u043d\u043e \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/af4\/bae\/07e\/af4bae07e3443a981862ca69c02d5c17.png\" alt=\"\u041d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u00ab\u0414\u0430\u043b\u0435\u0435\u00bb \u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430.\" title=\"\u041d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u00ab\u0414\u0430\u043b\u0435\u0435\u00bb \u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430.\" width=\"1310\" height=\"622\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/af4\/bae\/07e\/af4bae07e3443a981862ca69c02d5c17.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/af4\/bae\/07e\/af4bae07e3443a981862ca69c02d5c17.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u041d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u00ab\u0414\u0430\u043b\u0435\u0435\u00bb \u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/figcaption><\/div>\n<\/figure>\n<p>\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442: \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c\u0438 git \u0438\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0441\u0435\u0440\u0432\u0438\u0441\u0430. \u041c\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f Git, \u044d\u0442\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0443 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439. \u041d\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443\/\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 \u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u0430\u0431\u0438\u043d\u0435\u0442. \u0422\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u043e\u0441\u043e\u0431\u044b.<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/424\/42f\/5a4\/42442f5a42601e8198518361f475a65b.png\" width=\"1066\" height=\"678\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/424\/42f\/5a4\/42442f5a42601e8198518361f475a65b.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/424\/42f\/5a4\/42442f5a42601e8198518361f475a65b.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0448\u0430\u0433\u0430\u043c\u0438 \u043d\u0430\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u0432 \u043d\u0430\u0448\u0435\u043c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c JAR \u0444\u0430\u0439\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0430\u043c \u0434\u0430\u043b\u0435\u0435.<\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u043f\u0438\u0448\u0435\u043c:<\/p>\n<pre><code>Mvn package<\/code><\/pre>\n<p>\u0423\u0447\u0442\u0438\u0442\u0435, \u0447\u0442\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0440\u0430\u043d\u0435\u0435 \u043f\u0440\u0435\u0434\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 Maven.<\/p>\n<p>\u041d\u0443\u0436\u043d\u044b\u0439 \u043d\u0430\u043c JAR \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0430\u043f\u043a\u0438 \/target. \u0415\u0433\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0432\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u0430\u043b\u0435\u0435 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b amvera.yaml<\/p>\n<p><strong>\u041d\u0430\u043c \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0441\u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u041d\u043e \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0443\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043e, \u043c\u044b \u043f\u043e\u0439\u0434\u0435\u043c \u0438\u043d\u044b\u043c \u043f\u0443\u0442\u0435\u043c.<\/strong><\/p>\n<p>1. \u0412\u044b\u0437\u043e\u0432\u0435\u043c \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u0432 IDE, \u0433\u0434\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0438\u043b\u0438 \u043e\u0442\u043a\u0440\u043e\u0435\u043c \u043f\u0430\u043f\u043a\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0435.<\/p>\n<p>2. \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0433\u0438\u0442-\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439.<\/p>\n<pre><code>git init<\/code><\/pre>\n<p>3. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 (url \u0432\u0430\u0448\u0435\u0433\u043e \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f. \u0412\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u0435 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0439\u0442\u0435 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u043c \u0448\u0430\u0433\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430).<\/p>\n<pre><code>git remote add amvera https:\/\/git.amvera.ru\/\u0438\u043c\u044f_\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\/\u0438\u043c\u044f_\u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/code><\/pre>\n<p>4. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0444\u0430\u0439\u043b\u044b \u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u043a\u043e\u043c\u043c\u0438\u0442<\/p>\n<pre><code>git add .  git commit -m \"init\"<\/code><\/pre>\n<p>5. \u0417\u0430\u043f\u0443\u0448\u0438\u043c \u043d\u0430\u0448 \u043a\u043e\u0434 \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/p>\n<pre><code>git push amvera master<\/code><\/pre>\n<p>6. \u041d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u00ab\u0414\u0430\u043b\u0435\u0435\u00bb \u0438 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430.<\/p>\n<p>\u0421\u0440\u0435\u0434\u0438 \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u0435\u0439 \u043d\u0430\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0432\u043f\u0438\u0441\u0430\u0442\u044c \u0432 jarName \u0438\u043c\u044f \u043d\u0430\u0448\u0435\u0433\u043e jar-\u0444\u0430\u0439\u043b\u0430, \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e PARSEBINANCE-1.0-SNAPSHOT.jar , \u043d\u043e \u0432 \u0432\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0434\u0440\u0443\u0433\u0438\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a9e\/547\/0eb\/a9e5470eb24520bcd24ac892761f138f.png\" width=\"1314\" height=\"586\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/a9e\/547\/0eb\/a9e5470eb24520bcd24ac892761f138f.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a9e\/547\/0eb\/a9e5470eb24520bcd24ac892761f138f.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0430\u0447\u043d\u0451\u0442\u0441\u044f \u0441\u0431\u043e\u0440\u043a\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a \u0441\u0430\u043c\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0421\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0445\u043e\u0434\u043e\u043c \u0441\u0431\u043e\u0440\u043a\u0438 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043c\u043e\u0436\u043d\u043e \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043b\u043e\u0433\u0430\u0445.<\/p>\n<h4>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0435\u043a\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0441\u043e\u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0441\u044f \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u044c \u0437\u0430 \u0445\u043e\u0434\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u043b\u043e\u0433\u0430\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0430\u0440\u0441\u0435\u0440\u0430, \u0443 \u043d\u0430\u0441 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u0432 \u043b\u043e\u0433\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f (\u0430\u043d\u0430\u043b\u043e\u0433 \u043a\u043e\u043d\u0441\u043e\u043b\u0438).<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/6f5\/b54\/fa6\/6f5b54fa6c21378ae7a25f233ecdbb87.png\" width=\"1310\" height=\"220\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/6f5\/b54\/fa6\/6f5b54fa6c21378ae7a25f233ecdbb87.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/6f5\/b54\/fa6\/6f5b54fa6c21378ae7a25f233ecdbb87.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u0439 Java-\u043a\u043b\u0438\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u0441\u0438\u043c\u0432\u043e\u043b(\u044b) (&#171;BTCUSDT&#187;, &#171;ETHUSDT&#187;\u2026), \u0434\u0435\u043b\u0430\u0435\u0442 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u0446\u0435\u043d\u0443; \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 Binance (rate\u2011limit, BPA) \u0438 \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043d\u0435 \u043d\u0430\u0440\u0443\u0448\u0430\u044f API. \u0418 \u0448\u0430\u0431\u043b\u043e\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043b\u0435\u0433\u043a\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u2014 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c WebSocket\u2011\u0441\u0442\u0440\u0438\u043c \u0446\u0435\u043d, \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044e \u0441 \u0431\u0430\u0437\u043e\u0439, \u0433\u0440\u0430\u0444\u0438\u043a \u043d\u0430 JavaFX \u0438\u043b\u0438 \u044d\u043a\u0441\u043f\u043e\u0440\u0442 \u0432 CSV.<\/p>\n<p>\u041a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u043f\u043e <a href=\"https:\/\/github.com\/aglihowstan\/Amvera_java\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a> \u043d\u0430 GitHub.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/939492\/\"> https:\/\/habr.com\/ru\/articles\/939492\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 <a href=\"https:\/\/habr.com\/ru\/companies\/amvera\/articles\/937894\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u043e\u0441\u043d\u043e\u0432\u044b \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 Java.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u043e \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c, \u043a\u0430\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <strong>Java 11+<\/strong> \u0431\u044b\u0441\u0442\u0440\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c HTTP GET\u2011\u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c JSON \u043e\u0442 <strong>Binance REST API<\/strong> \u0438 \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u044c \u0438\u0437 \u043d\u0435\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b \u043f\u0430\u0440\u044b (symbol) \u0438 \u0446\u0435\u043d\u0443 (price) \u2014 \u0431\u0435\u0437 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439.<\/p>\n<p>Binance \u2014 \u043e\u0434\u043d\u0430 \u0438\u0437 \u043a\u0440\u0443\u043f\u043d\u0435\u0439\u0448\u0438\u0445 \u043a\u0440\u0438\u043f\u0442\u043e\u0431\u0438\u0440\u0436 \u043c\u0438\u0440\u0430, \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u0442 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 REST\u2011\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \/api\/v3\/ticker\/price, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0432\u0438\u0434\u0430:<\/p>\n<pre><code>{ \"symbol\": \"BTCUSDT\", \"price\": \"60713.44000000\" } <\/code><\/pre>\n<p>\u0438\u043b\u0438 \u043c\u0430\u0441\u0441\u0438\u0432 \u0442\u0430\u043a\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043f\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0431\u0435\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 symbol. \u0414\u043e\u0441\u0442\u0443\u043f \u043a \u044d\u0442\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u043c \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439, \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 API\u2011\u043a\u043b\u044e\u0447\u0430 \u0438\u043b\u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<p>\u041c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043d\u0430 Java\u2011\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0441\u0442\u0440\u043e\u043a:<\/p>\n<ul>\n<li>\n<p>\u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c HTTP GET\u2011\u0437\u0430\u043f\u0440\u043e\u0441 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0433\u043e HttpClient (\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e JDK \u0441 Java 11);<\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0441\u0442\u0430\u0442\u0443\u0441 \u043a\u043e\u0434 \u043e\u0442\u0432\u0435\u0442\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 200 OK);<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0435\u043b\u043e \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 JSON \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e BodyHandlers.ofString();<\/p>\n<\/li>\n<li>\n<p>\u043f\u0430\u0440\u0441\u0438\u043c JSON (Jackson\/Gson) \u0432 POJO \u0438 \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u044f symbol \u0438 price.<\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0431\u0445\u043e\u0434 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0441\u0435\u0440\u0432\u0435\u0440\u0430.<\/p>\n<h3>\u0428\u0430\u0433\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 (\u043a\u043e\u0434\u043e\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c)<\/h3>\n<p><strong>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 HttpClient<\/strong><\/p>\n<pre><code>HttpClient client = HttpClient.newBuilder()         .version(HttpClient.Version.HTTP_2)         .connectTimeout(Duration.ofSeconds(10))         .build();<\/code><\/pre>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u043c\u044b \u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u043d\u0430\u0448\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u043a\u0430\u0441\u0430\u044e\u0449\u0443\u044e\u0441\u044f \u043e\u0441\u043d\u043e\u0432 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u0432 Java.<\/p>\n<p><strong>\u0424\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 URL \u0438 HttpRequest<\/strong><\/p>\n<pre><code>URI uri = URI.create(\"https:\/\/api.binance.com\/api\/v3\/ticker\/price?symbol=BTCUSDT\"); HttpRequest req = HttpRequest.newBuilder(uri)         .timeout(Duration.ofSeconds(5))         .header(\"Accept\", \"application\/json\")         .GET()         .build(); <\/code><\/pre>\n<p>\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0442\u0430\u0439\u043c\u0430\u0443\u0442, Accept, HTTPS<\/p>\n<p><strong>\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u0442\u0430\u0442\u0443\u0441\u0430<\/strong><\/p>\n<pre><code>HttpResponse&lt;String&gt; resp = client.send(req, BodyHandlers.ofString()); int code = resp.statusCode();  if (code != 200) {         throw new RuntimeException(\"BTC price HTTP error: \" + code);  }<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c 2xx.<\/p>\n<p><strong>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u0434\u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445<\/strong><\/p>\n<pre><code>class Ticker {     private String symbol;     private String price;      public String getSymbol() {         return symbol;     }      public void setSymbol(String symbol) {         this.symbol = symbol;     }      public String getPrice() {         return price;     }      public void setPrice(String price) {         this.price = price;     } }<\/code><\/pre>\n<p>\u041a\u043b\u0430\u0441\u0441 Ticker \u2014 \u044d\u0442\u043e POJO (Plain Old Java Object), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 API Binance. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u043d \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 JSON-\u043e\u0431\u044a\u0435\u043a\u0442\u0443 \u0441 \u043f\u043e\u043b\u044f\u043c\u0438 symbol (\u0442\u0438\u043a\u0435\u0440, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, BTCUSDT) \u0438 price (\u0442\u0435\u043a\u0443\u0449\u0430\u044f \u0446\u0435\u043d\u0430).<\/p>\n<p>\u0413\u0435\u0442\u0442\u0435\u0440\u044b (get&#8230;()) \u0438 \u0441\u0435\u0442\u0442\u0435\u0440\u044b (set&#8230;()) \u2014 \u044d\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0432 Java \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u043c \u043f\u043e\u043b\u044f\u043c \u043a\u043b\u0430\u0441\u0441\u0430.<\/p>\n<p><strong>\u0413\u0435\u0442\u0442\u0435\u0440\u044b <\/strong>(getters) \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u043e\u0431\u044a\u0435\u043a\u0442\u0430.<\/p>\n<p><strong>\u0421\u0435\u0442\u0442\u0435\u0440\u044b <\/strong>(setters) \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u0435.<\/p>\n<p><strong>\u0427\u0442\u0435\u043d\u0438\u0435 \u0438 \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f JSON<\/strong><\/p>\n<p>\u0414\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043f\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f (\u043c\u0430\u043f\u043f\u0438\u043d\u0433\u0430) \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b JSON-\u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 Java-\u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Jackson.\u00a0<\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 Binance \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 JSON-\u043c\u0430\u0441\u0441\u0438\u0432 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043e \u0442\u0438\u043a\u0435\u0440\u0430\u0445, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043a\u043b\u0430\u0441\u0441\u0430 Ticker, \u0433\u0434\u0435 \u043a\u0430\u0436\u0434\u043e\u0435 \u043f\u043e\u043b\u0435 JSON <em>symbol<\/em>, <em>price<\/em> \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u043f\u043e\u043b\u0435\u043c Java-\u043a\u043b\u0430\u0441\u0441\u0430 \u0447\u0435\u0440\u0435\u0437 \u0433\u0435\u0442\u0442\u0435\u0440\u044b \u0438 \u0441\u0435\u0442\u0442\u0435\u0440\u044b.<\/p>\n<pre><code>String json = resp.body(); Ticker t = new ObjectMapper().readValue(json, Ticker.class); \/\/ \u041f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u043f\u043e\u043b\u044f:  \/\/ public class Ticker { public String symbol; public String price; }  BigDecimal price = new BigDecimal(t.price);<\/code><\/pre>\n<p>(\u0438\u043b\u0438 \u043c\u0430\u0441\u0441\u0438\u0432, \u0435\u0441\u043b\u0438 symbol \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d).<\/p>\n<p><strong>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u043f\u0438\u0441\u043a\u0430<\/strong>:<\/p>\n<p>\u0435\u0441\u043b\u0438 \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <em>symbol<\/em>, JAckson \u0432\u0435\u0440\u043d\u0451\u0442 List&lt;Ticker&gt;, \u0434\u0430\u043b\u0435\u0435 .forEach(t -&gt; \u2026).<\/p>\n<h4>\u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f (\u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0439)<\/h4>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c JSON-\u043e\u0442\u0432\u0435\u0442 \u043e\u0442 Binance API \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u044b Ticker, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 Jackson \u043f\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0438\u0437 <a href=\"https:\/\/habr.com\/ru\/companies\/amvera\/articles\/937894\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438<\/a>, \u043f\u043e\u0441\u0432\u044f\u0449\u0451\u043d\u043d\u043e\u0439 \u043e\u0441\u043d\u043e\u0432\u0430\u043c \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u042f\u043d\u0434\u0435\u043a\u0441 \u041a\u0430\u0440\u0442.<\/p>\n<p><strong>\u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a \u043a\u043e\u0434\u0443<\/strong><\/p>\n<pre><code>CompletableFuture&lt;List&lt;Ticker&gt;&gt; f = client.sendAsync(req, BodyHandlers.ofString())         .thenApply(HttpResponse::body)         .thenApply(body -&gt; Arrays.asList(new ObjectMapper().readValue(body, Ticker[].class)));  f.thenAccept(list -&gt; list.forEach(System.out::println));<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 HTTP GET\u2011\u0437\u0430\u043f\u0440\u043e\u0441 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f sendAsync(&#8230;), \u0447\u0442\u043e \u0441\u0440\u0430\u0437\u0443 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 CompletableFuture&lt;HttpResponse&lt;String&gt;&gt; \u0435\u0449\u0451 \u0434\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f HTTP\u2011\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u2014 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043f\u043e\u0442\u043e\u043a \u043d\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442\u0441\u044f, \u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f.<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 sendAsync \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0438 \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0431\u0443\u0434\u0443\u0449\u0435\u0435, \u043d\u0435 \u0434\u043e\u0436\u0438\u0434\u0430\u044f\u0441\u044c \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f I\/O.\u2003<\/p>\n<p>\u0427\u0435\u0440\u0435\u0437 .thenApply(HttpResponse::body) \u043c\u044b. \u043d\u043e\u0432\u043e\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 CompletableFuture&lt;HttpResponse&lt;String&gt;&gt; \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c \u0432 CompletableFuture&lt;String&gt; \u2014 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u0435 \u0442\u0435\u043b\u043e HTTP\u2011\u043e\u0442\u0432\u0435\u0442\u0430 (JSON\u2011\u0441\u0442\u0440\u043e\u043a\u0443). \u042d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u043a\u043e\u0433\u0434\u0430 \u0442\u0435\u043b\u043e \u0433\u043e\u0442\u043e\u0432\u043e, \u0432\u0435\u0440\u0445\u043d\u0438\u0435 \u0447\u0430\u0441\u0442\u0438 \u043e\u0442\u0432\u0435\u0442\u0430 \u0443\u0436\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b (\u0441\u0442\u0430\u0442\u0443\u0441\/\u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438), \u0438 BodyHandlers.ofString() \u0443\u043f\u0430\u043a\u043e\u0432\u0430\u043b\u0430 \u0442\u0435\u043b\u043e \u0432 String \u043e\u0431\u044a\u0435\u043a\u0442.<\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c .thenApply(&#8230;) \u043c\u044b \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c JSON\u2011\u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 Ticker[], \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Jackson ObjectMapper.readValue(body, Ticker[].class), \u0437\u0430\u0442\u0435\u043c \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0432 List&lt;Ticker&gt; \u2014 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c CompletableFuture&lt;List&lt;Ticker&gt;&gt;. \u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d \u043d\u0430 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430\u0445 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f: \u043a\u0430\u0436\u0434\u0430\u044f \u0441\u0442\u0443\u043f\u0435\u043d\u044c \u0446\u0435\u043f\u043e\u0447\u043a\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0430\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 .thenAccept(list -&gt; &#8230;): \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e CompletableFuture&lt;List&lt;Ticker&gt;&gt; \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u0441\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e, JVM \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 Consumer&lt;List&lt;Ticker&gt;&gt;, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u043a\u0430\u0436\u0434\u0443\u044e \u043f\u0430\u0440\u0443 (symbol + price) \u0447\u0435\u0440\u0435\u0437 println.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439 JSON, I\/O \u043e\u0448\u0438\u0431\u043a\u0430, timeout), \u043e\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0431\u0440\u043e\u0448\u0435\u043d\u043e \u0432\u043d\u0443\u0442\u0440\u044c CompletableFuture, \u0438 \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 .exceptionally(&#8230;) \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u044d\u0442\u0430\u043f\u0435 \u0446\u0435\u043f\u043e\u0447\u043a\u0438.<\/p>\n<p><strong>\u0418\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u043a\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/strong><\/p>\n<pre><code>package org.example;  import java.net.URI; import java.net.http.*; import java.net.http.HttpResponse.BodyHandlers; import java.util.*; import java.util.concurrent.*; import com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException;  class Ticker {     private String symbol;     private String price;      public String getSymbol() {         return symbol;     }      public void setSymbol(String symbol) {         this.symbol = symbol;     }      public String getPrice() {         return price;     }      public void setPrice(String price) {         this.price = price;     } }  public class GetRequestExample {      public static void main(String[] args) {         HttpClient client = HttpClient.newHttpClient();          HttpRequest request = HttpRequest.newBuilder()                 .uri(URI.create(\"https:\/\/api.binance.com\/api\/v3\/ticker\/price\"))                 .header(\"Accept\", \"application\/json\")                 .GET()                 .build();          CompletableFuture&lt;List&lt;Ticker&gt;&gt; future = client.sendAsync(request, BodyHandlers.ofString())                 .thenApply(HttpResponse::body)                 .thenApply(json -&gt; {                     try {                         return Arrays.asList(new ObjectMapper()                                 .readValue(json, Ticker[].class));                     } catch (IOException e) {                         throw new CompletionException(e);                     }                 });          future.thenAccept(tickers -&gt; tickers.forEach(t -&gt;                 System.out.println(t.getSymbol() + \" \u2192 \" + t.getPrice())         )).exceptionally(err -&gt; {             System.err.println(\"\u041e\u0448\u0438\u0431\u043a\u0430: \" + err.getCause());             return null;         });           future.join();     } }<\/code><\/pre>\n<h2>\u041e\u0431\u0445\u043e\u0434 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043e\u043a \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/h2>\n<p>Binance \u043c\u043e\u0436\u0435\u0442 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043f\u0440\u0438 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0447\u0430\u0441\u0442\u043e \u0438\u043b\u0438 \u0431\u0435\u0437 \u0441\u043e\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u0430\u0432\u0438\u043b API. \u0412\u043e\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u0440\u0438\u0447\u0438\u043d\u044b \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0438\u0445 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c:<\/p>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, Binance \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0441\u0442\u0440\u043e\u0433\u0438\u0435 \u043b\u0438\u043c\u0438\u0442\u044b \u043d\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438 \u043f\u0440\u0435\u0432\u044b\u0448\u0435\u043d\u0438\u0438 \u043b\u0438\u043c\u0438\u0442\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043c\u043e\u0436\u0435\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c IP-\u0430\u0434\u0440\u0435\u0441 \u0441 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0435\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c WebSocket \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u043c\u0435\u0441\u0442\u043e \u0447\u0430\u0441\u0442\u044b\u0445 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n<p>\u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u043e\u0448\u0438\u0431\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043c\u0435\u0442\u043a\u043e\u0439 \u0438\u043b\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u044c\u044e. \u042d\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0435.<\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, Binance \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0431\u043e\u0440\u0435\u0442\u0441\u044f \u0441 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u043e\u043c, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0435\u0441\u043b\u0438 \u043e\u043d \u0438\u043c\u0438\u0442\u0438\u0440\u0443\u0435\u0442 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0431\u0435\u0437 API-\u043a\u043b\u044e\u0447\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u044f\u043c\u043e\u0435 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u043c \u043c\u043e\u0433\u0443\u0442 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 API (<a href=\"http:\/\/api.binance.com\" rel=\"noopener noreferrer nofollow\">api.binance.com<\/a>) \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n<p><strong>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c WebSocket. <\/strong>\u041e\u043d \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c, \u0447\u0442\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u043e\u0434\u0438\u043d \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u044b\u0439 \u043a\u0430\u043d\u0430\u043b, \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0448\u043b\u0451\u0442 \u0434\u0430\u043d\u043d\u044b\u0435, \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u0445 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n<p><strong>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 WebSocket \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 WebSocket \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u0445 pom.xml<\/strong><\/p>\n<pre><code>&lt;dependency&gt;     &lt;groupId&gt;org.java-websocket&lt;\/groupId&gt;     &lt;artifactId&gt;Java-WebSocket&lt;\/artifactId&gt;     &lt;version&gt;1.5.3&lt;\/version&gt; &lt;\/dependency&gt;<\/code><\/pre>\n<p><strong>\u0414\u0430\u043b\u0435\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e URI \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f<\/strong><\/p>\n<pre><code>URI uri = new URI(\"wss:\/\/stream.binance.com:9443\/ws\");<\/code><\/pre>\n<p>\u0412 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u043d\u0430\u0448\u0435\u0433\u043e URI \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b <em>&#171;wss:\/\/&#8230;&#187;. <\/em>\u041e\u043d \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u043c WebSocket Secure (\u0430\u043d\u0430\u043b\u043e\u0433 HTTPS \u0434\u043b\u044f WS), \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u043c \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u0430\u043d\u0430\u043b\u0430 \u0441\u0432\u044f\u0437\u0438 \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c \u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442 Binance \u0434\u043b\u044f WebSocket-\u0441\u0442\u0440\u0438\u043c\u043e\u0432 \u2014 <em>stream.binance.com:9443<\/em><\/p>\n<p>\u0412\u0430\u0436\u043d\u043e: Binance \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u0440\u0442 9443 \u0434\u043b\u044f \u0437\u0430\u0449\u0438\u0449\u0451\u043d\u043d\u043e\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p><strong>\/ws<\/strong> \u2014 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043f\u0443\u0442\u044c \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0432\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f \u0441 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u043e\u0439 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0438\u0437 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0433\u0438\u043e\u043d\u043e\u0432 \u0438\u043b\u0438 \u043f\u0440\u0438 \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f. \u0414\u043b\u044f \u043e\u0431\u0445\u043e\u0434\u0430 \u044d\u0442\u043e\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 URI:<\/p>\n<pre><code>URI uri = new URI(\"wss:\/\/stream.binance.us:9443\/ws\"); \/\/ \u0434\u043b\u044f \u0421\u0428\u0410 URI uri = new URI(\"wss:\/\/stream.binance.me:9443\/ws\"); \/\/ \u0434\u043b\u044f \u0415\u0432\u0440\u043e\u043f\u044b<\/code><\/pre>\n<p><strong>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e WebSocketClient<\/strong><\/p>\n<pre><code>WebSocketClient ws = new WebSocketClient(uri){   } <\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 WebSocketClient. \u0412 \u043d\u0451\u043c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c 4 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u0430 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f:<\/p>\n<p><strong>\u041c\u0435\u0442\u043e\u0434<\/strong><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-472021","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/472021","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=472021"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/472021\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=472021"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=472021"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=472021"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}