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

com.bybit.api.client.websocket.api.WebSocketApiTrade Maven / Gradle / Ivy

Go to download

The Official Java API connector for Bybit's HTTP and WebSocket APIs. Dive into a plethora of functionalities: - Market Data Retrieval - Trade Execution - Position Management - Account and Asset Info Retrieval - User and Upgrade Management — Public Websocket Streaming - Private Websocket Streaming - Lending Institution and Client - Broker Earning Data

The newest version!
package com.bybit.api.client.websocket.api;

import com.bybit.api.client.util.ParameterChecker;
import com.bybit.api.client.util.JSONParser;
import org.json.JSONObject;
import com.bybit.api.client.websocket.api.WebSocketApiModule;
import com.bybit.api.client.websocket.callback.WebSocketApiRequestHandler;

/**
 * 

Trading Requests

* All requests under the * Trading requests * section of the WebSocket API documentation will be implemented in this class. *
* Response will be returned as callback. */ public class WebSocketApiTrade implements WebSocketApiModule { private final WebSocketApiRequestHandler handler; public WebSocketApiTrade(WebSocketApiRequestHandler handler) { this.handler = handler; } public void newOrder(String category, String symbol, String side, String type, String qty, JSONObject parameters) { ParameterChecker.checkParameterType(category, String.class, "category"); ParameterChecker.checkParameterType(symbol, String.class, "symbol"); ParameterChecker.checkParameterType(side, String.class, "side"); ParameterChecker.checkParameterType(type, String.class, "type"); ParameterChecker.checkParameterType(qty, String.class, "qty"); parameters = JSONParser.addKeyValue(parameters, "category", category); parameters = JSONParser.addKeyValue(parameters, "symbol", symbol); parameters = JSONParser.addKeyValue(parameters, "side", side); parameters = JSONParser.addKeyValue(parameters, "type", type); parameters = JSONParser.addKeyValue(parameters, "qty", qty); this.handler.signedRequest("order.create", parameters); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy