All URIs are relative to https://localhost/api/v1
| Method | HTTP request | Description |
|---|---|---|
| positionGet | GET /position | Get your positions. |
| positionIsolateMargin | POST /position/isolate | Enable isolated margin or cross margin per-position. |
| positionTransferIsolatedMargin | POST /position/transferMargin | Transfer equity in or out of a position. |
| positionUpdateLeverage | POST /position/leverage | Choose leverage for a position. |
| positionUpdateRiskLimit | POST /position/riskLimit | Update your risk limit. |
[Position] positionGet(opts)
Get your positions.
See <a href="http://www.onixs.biz/fix-dictionary/5.0.SP2/msgType_AP_6580.html\">the FIX Spec</a> for explanations of these fields.
import BitMexApi from 'bit_mex_api';
let defaultClient = BitMexApi.ApiClient.instance;
// Configure API key authorization: apiKey
let apiKey = defaultClient.authentications['apiKey'];
apiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.apiKeyPrefix = 'Token';
// Configure API key authorization: apiNonce
let apiNonce = defaultClient.authentications['apiNonce'];
apiNonce.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiNonce.apiKeyPrefix = 'Token';
// Configure API key authorization: apiSignature
let apiSignature = defaultClient.authentications['apiSignature'];
apiSignature.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiSignature.apiKeyPrefix = 'Token';
let apiInstance = new BitMexApi.PositionApi();
let opts = {
'filter': "filter_example", // String | Table filter. For example, send {\"symbol\": \"XBTUSD\"}.
'columns': "columns_example", // String | Which columns to fetch. For example, send [\"columnName\"].
'count': 3.4 // Number | Number of rows to fetch.
};
apiInstance.positionGet(opts, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});| Name | Type | Description | Notes |
|---|---|---|---|
| filter | String | Table filter. For example, send {"symbol": "XBTUSD"}. | [optional] |
| columns | String | Which columns to fetch. For example, send ["columnName"]. | [optional] |
| count | Number | Number of rows to fetch. | [optional] |
apiKey, apiNonce, apiSignature
- Content-Type: application/json, application/x-www-form-urlencoded
- Accept: application/json, application/xml, text/xml, application/javascript, text/javascript
Position positionIsolateMargin(symbol, opts)
Enable isolated margin or cross margin per-position.
Users can switch isolate margin per-position. This function allows switching margin isolation (aka fixed margin) on and off.
import BitMexApi from 'bit_mex_api';
let defaultClient = BitMexApi.ApiClient.instance;
// Configure API key authorization: apiKey
let apiKey = defaultClient.authentications['apiKey'];
apiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.apiKeyPrefix = 'Token';
// Configure API key authorization: apiNonce
let apiNonce = defaultClient.authentications['apiNonce'];
apiNonce.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiNonce.apiKeyPrefix = 'Token';
// Configure API key authorization: apiSignature
let apiSignature = defaultClient.authentications['apiSignature'];
apiSignature.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiSignature.apiKeyPrefix = 'Token';
let apiInstance = new BitMexApi.PositionApi();
let symbol = "symbol_example"; // String | Position symbol to isolate.
let opts = {
'enabled': true // Boolean | True for isolated margin, false for cross margin.
};
apiInstance.positionIsolateMargin(symbol, opts, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});| Name | Type | Description | Notes |
|---|---|---|---|
| symbol | String | Position symbol to isolate. | |
| enabled | Boolean | True for isolated margin, false for cross margin. | [optional] [default to true] |
apiKey, apiNonce, apiSignature
- Content-Type: application/json, application/x-www-form-urlencoded
- Accept: application/json, application/xml, text/xml, application/javascript, text/javascript
Position positionTransferIsolatedMargin(symbol, amount)
Transfer equity in or out of a position.
When margin is isolated on a position, use this function to add or remove margin from the position. Note that you cannot remove margin below the initial margin threshold.
import BitMexApi from 'bit_mex_api';
let defaultClient = BitMexApi.ApiClient.instance;
// Configure API key authorization: apiKey
let apiKey = defaultClient.authentications['apiKey'];
apiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.apiKeyPrefix = 'Token';
// Configure API key authorization: apiNonce
let apiNonce = defaultClient.authentications['apiNonce'];
apiNonce.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiNonce.apiKeyPrefix = 'Token';
// Configure API key authorization: apiSignature
let apiSignature = defaultClient.authentications['apiSignature'];
apiSignature.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiSignature.apiKeyPrefix = 'Token';
let apiInstance = new BitMexApi.PositionApi();
let symbol = "symbol_example"; // String | Symbol of position to isolate.
let amount = 3.4; // Number | Amount to transfer, in Satoshis. May be negative.
apiInstance.positionTransferIsolatedMargin(symbol, amount, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});| Name | Type | Description | Notes |
|---|---|---|---|
| symbol | String | Symbol of position to isolate. | |
| amount | Number | Amount to transfer, in Satoshis. May be negative. |
apiKey, apiNonce, apiSignature
- Content-Type: application/json, application/x-www-form-urlencoded
- Accept: application/json, application/xml, text/xml, application/javascript, text/javascript
Position positionUpdateLeverage(symbol, leverage)
Choose leverage for a position.
Users can choose an isolated leverage. This will automatically enable isolated margin.
import BitMexApi from 'bit_mex_api';
let defaultClient = BitMexApi.ApiClient.instance;
// Configure API key authorization: apiKey
let apiKey = defaultClient.authentications['apiKey'];
apiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.apiKeyPrefix = 'Token';
// Configure API key authorization: apiNonce
let apiNonce = defaultClient.authentications['apiNonce'];
apiNonce.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiNonce.apiKeyPrefix = 'Token';
// Configure API key authorization: apiSignature
let apiSignature = defaultClient.authentications['apiSignature'];
apiSignature.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiSignature.apiKeyPrefix = 'Token';
let apiInstance = new BitMexApi.PositionApi();
let symbol = "symbol_example"; // String | Symbol of position to adjust.
let leverage = 1.2; // Number | Leverage value. Send a number between 0.01 and 100 to enable isolated margin with a fixed leverage. Send 0 to enable cross margin.
apiInstance.positionUpdateLeverage(symbol, leverage, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});| Name | Type | Description | Notes |
|---|---|---|---|
| symbol | String | Symbol of position to adjust. | |
| leverage | Number | Leverage value. Send a number between 0.01 and 100 to enable isolated margin with a fixed leverage. Send 0 to enable cross margin. |
apiKey, apiNonce, apiSignature
- Content-Type: application/json, application/x-www-form-urlencoded
- Accept: application/json, application/xml, text/xml, application/javascript, text/javascript
Position positionUpdateRiskLimit(symbol, riskLimit)
Update your risk limit.
Risk Limits limit the size of positions you can trade at various margin levels. Larger positions require more margin. Please see the Risk Limit documentation for more details.
import BitMexApi from 'bit_mex_api';
let defaultClient = BitMexApi.ApiClient.instance;
// Configure API key authorization: apiKey
let apiKey = defaultClient.authentications['apiKey'];
apiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.apiKeyPrefix = 'Token';
// Configure API key authorization: apiNonce
let apiNonce = defaultClient.authentications['apiNonce'];
apiNonce.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiNonce.apiKeyPrefix = 'Token';
// Configure API key authorization: apiSignature
let apiSignature = defaultClient.authentications['apiSignature'];
apiSignature.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiSignature.apiKeyPrefix = 'Token';
let apiInstance = new BitMexApi.PositionApi();
let symbol = "symbol_example"; // String | Symbol of position to isolate.
let riskLimit = 3.4; // Number | New Risk Limit, in Satoshis.
apiInstance.positionUpdateRiskLimit(symbol, riskLimit, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});| Name | Type | Description | Notes |
|---|---|---|---|
| symbol | String | Symbol of position to isolate. | |
| riskLimit | Number | New Risk Limit, in Satoshis. |
apiKey, apiNonce, apiSignature
- Content-Type: application/json, application/x-www-form-urlencoded
- Accept: application/json, application/xml, text/xml, application/javascript, text/javascript