All URIs are relative to https://api-testnet.bybit.com
Method | HTTP request | Description |
---|---|---|
positionsChangeMargin | POST /position/change-position-margin | Update margin. |
positionsMyPosition | GET /position/list | Get my position list. |
positionsSaveLeverage | POST /user/leverage/save | Change user leverage. |
positionsTradingStop | POST /open-api/position/trading-stop | Set Trading-Stop Condition. |
positionsUserLeverage | GET /user/leverage | Get user leverage setting. |
Object positionsChangeMargin(symbol, margin)
Update margin.
// Import classes:
//import io.swagger.client.ApiClient;
//import io.swagger.client.ApiException;
//import io.swagger.client.Configuration;
//import io.swagger.client.auth.*;
//import io.swagger.client.api.PositionsApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: apiKey
ApiKeyAuth apiKey = (ApiKeyAuth) defaultClient.getAuthentication("apiKey");
apiKey.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.setApiKeyPrefix("Token");
// Configure API key authorization: apiSignature
ApiKeyAuth apiSignature = (ApiKeyAuth) defaultClient.getAuthentication("apiSignature");
apiSignature.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiSignature.setApiKeyPrefix("Token");
// Configure API key authorization: timestamp
ApiKeyAuth timestamp = (ApiKeyAuth) defaultClient.getAuthentication("timestamp");
timestamp.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//timestamp.setApiKeyPrefix("Token");
PositionsApi apiInstance = new PositionsApi();
String symbol = "symbol_example"; // String | Contract type which you want update its margin
String margin = "margin_example"; // String | New margin you want set
try {
Object result = apiInstance.positionsChangeMargin(symbol, margin);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling PositionsApi#positionsChangeMargin");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
symbol | String | Contract type which you want update its margin | |
margin | String | New margin you want set |
Object
apiKey, apiSignature, timestamp
- Content-Type: application/json, application/x-www-form-urlencoded
- Accept: application/json
Object positionsMyPosition()
Get my position list.
// Import classes:
//import io.swagger.client.ApiClient;
//import io.swagger.client.ApiException;
//import io.swagger.client.Configuration;
//import io.swagger.client.auth.*;
//import io.swagger.client.api.PositionsApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: apiKey
ApiKeyAuth apiKey = (ApiKeyAuth) defaultClient.getAuthentication("apiKey");
apiKey.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.setApiKeyPrefix("Token");
// Configure API key authorization: apiSignature
ApiKeyAuth apiSignature = (ApiKeyAuth) defaultClient.getAuthentication("apiSignature");
apiSignature.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiSignature.setApiKeyPrefix("Token");
// Configure API key authorization: timestamp
ApiKeyAuth timestamp = (ApiKeyAuth) defaultClient.getAuthentication("timestamp");
timestamp.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//timestamp.setApiKeyPrefix("Token");
PositionsApi apiInstance = new PositionsApi();
try {
Object result = apiInstance.positionsMyPosition();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling PositionsApi#positionsMyPosition");
e.printStackTrace();
}
This endpoint does not need any parameter.
Object
apiKey, apiSignature, timestamp
- Content-Type: application/json, application/x-www-form-urlencoded
- Accept: application/json
Object positionsSaveLeverage(symbol, leverage)
Change user leverage.
// Import classes:
//import io.swagger.client.ApiClient;
//import io.swagger.client.ApiException;
//import io.swagger.client.Configuration;
//import io.swagger.client.auth.*;
//import io.swagger.client.api.PositionsApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: apiKey
ApiKeyAuth apiKey = (ApiKeyAuth) defaultClient.getAuthentication("apiKey");
apiKey.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.setApiKeyPrefix("Token");
// Configure API key authorization: apiSignature
ApiKeyAuth apiSignature = (ApiKeyAuth) defaultClient.getAuthentication("apiSignature");
apiSignature.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiSignature.setApiKeyPrefix("Token");
// Configure API key authorization: timestamp
ApiKeyAuth timestamp = (ApiKeyAuth) defaultClient.getAuthentication("timestamp");
timestamp.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//timestamp.setApiKeyPrefix("Token");
PositionsApi apiInstance = new PositionsApi();
String symbol = "symbol_example"; // String | A symbol which you want change its leverage
String leverage = "leverage_example"; // String | New leverage you want set
try {
Object result = apiInstance.positionsSaveLeverage(symbol, leverage);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling PositionsApi#positionsSaveLeverage");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
symbol | String | A symbol which you want change its leverage | |
leverage | String | New leverage you want set |
Object
apiKey, apiSignature, timestamp
- Content-Type: application/json, application/x-www-form-urlencoded
- Accept: application/json
Object positionsTradingStop(symbol, takeProfit, stopLoss, trailingStop)
Set Trading-Stop Condition.
// Import classes:
//import io.swagger.client.ApiClient;
//import io.swagger.client.ApiException;
//import io.swagger.client.Configuration;
//import io.swagger.client.auth.*;
//import io.swagger.client.api.PositionsApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: apiKey
ApiKeyAuth apiKey = (ApiKeyAuth) defaultClient.getAuthentication("apiKey");
apiKey.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.setApiKeyPrefix("Token");
// Configure API key authorization: apiSignature
ApiKeyAuth apiSignature = (ApiKeyAuth) defaultClient.getAuthentication("apiSignature");
apiSignature.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiSignature.setApiKeyPrefix("Token");
// Configure API key authorization: timestamp
ApiKeyAuth timestamp = (ApiKeyAuth) defaultClient.getAuthentication("timestamp");
timestamp.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//timestamp.setApiKeyPrefix("Token");
PositionsApi apiInstance = new PositionsApi();
String symbol = "symbol_example"; // String | Contract type
String takeProfit = "takeProfit_example"; // String | Not less than 0, 0 means cancel TP
String stopLoss = "stopLoss_example"; // String | Not less than 0, 0 means cancel SL
String trailingStop = "trailingStop_example"; // String | Not less than 0, 0 means cancel TS
try {
Object result = apiInstance.positionsTradingStop(symbol, takeProfit, stopLoss, trailingStop);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling PositionsApi#positionsTradingStop");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
symbol | String | Contract type | |
takeProfit | String | Not less than 0, 0 means cancel TP | [optional] |
stopLoss | String | Not less than 0, 0 means cancel SL | [optional] |
trailingStop | String | Not less than 0, 0 means cancel TS | [optional] |
Object
apiKey, apiSignature, timestamp
- Content-Type: application/json, application/x-www-form-urlencoded
- Accept: application/json
Object positionsUserLeverage()
Get user leverage setting.
// Import classes:
//import io.swagger.client.ApiClient;
//import io.swagger.client.ApiException;
//import io.swagger.client.Configuration;
//import io.swagger.client.auth.*;
//import io.swagger.client.api.PositionsApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: apiKey
ApiKeyAuth apiKey = (ApiKeyAuth) defaultClient.getAuthentication("apiKey");
apiKey.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.setApiKeyPrefix("Token");
// Configure API key authorization: apiSignature
ApiKeyAuth apiSignature = (ApiKeyAuth) defaultClient.getAuthentication("apiSignature");
apiSignature.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiSignature.setApiKeyPrefix("Token");
// Configure API key authorization: timestamp
ApiKeyAuth timestamp = (ApiKeyAuth) defaultClient.getAuthentication("timestamp");
timestamp.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//timestamp.setApiKeyPrefix("Token");
PositionsApi apiInstance = new PositionsApi();
try {
Object result = apiInstance.positionsUserLeverage();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling PositionsApi#positionsUserLeverage");
e.printStackTrace();
}
This endpoint does not need any parameter.
Object
apiKey, apiSignature, timestamp
- Content-Type: application/json, application/x-www-form-urlencoded
- Accept: application/json