All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.binance.connector.client.impl.websocketapi.WebSocketApiGeneral Maven / Gradle / Ivy

There is a newer version: 3.2.0
Show newest version
package com.binance.connector.client.impl.websocketapi;

import org.json.JSONObject;

import com.binance.connector.client.utils.ParameterChecker;
import com.binance.connector.client.utils.websocketapi.WebSocketApiRequestHandler;

/**
 * 

General Requests

* All requests under the * General requests * section of the WebSocket API documentation will be implemented in this class. *
* Response will be returned as callback. */ public class WebSocketApiGeneral implements WebSocketApiModule { private WebSocketApiRequestHandler handler; public WebSocketApiGeneral(WebSocketApiRequestHandler handler) { this.handler = handler; } /** * Test connectivity to the WebSocket API.
* Note:
* You can use regular WebSocket ping frames to test connectivity as well, WebSocket API will respond with pong frames as soon as possible.
* ping request along with time is a safe way to test request-response handling in your application.
* * @param parameters JSONObject composed by key-value pairs: *

* requestId -- optional/String or int
* * @see * https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api#test-connectivity */ public void ping(JSONObject parameters) { this.handler.publicRequest("ping", parameters); } /** * Test connectivity to the WebSocket API and get the current server time. * * @param parameters JSONObject composed by key-value pairs: *

* requestId -- optional/String or int
* * @see * https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api#check-server-time */ public void serverTime(JSONObject parameters) { this.handler.publicRequest("time", parameters); } /** * Query current exchange trading rules, rate limits, and symbol information.
* * Notes:
* Without parameters, exchangeInfo displays all symbols with ["SPOT, "MARGIN", "LEVERAGED"] permissions.
* In order to list all active symbols on the exchange, you need to explicitly request all permissions.
* Available Permissions * * @param parameters JSONObject composed by key-value pairs: *

* symbol -- optional/String
* symbols -- optional/Array of String
* permissions -- optional/Array of String
* requestId -- optional/String or int
* * @see * https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api#exchange-information */ public void exchangeInfo(JSONObject parameters) { ParameterChecker.checkOnlyOneOfParameters(parameters, "symbol", "symbols", "permissions"); this.handler.publicRequest("exchangeInfo", parameters); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy