Position
Documentation on interacting with ByBit's Position API functions through the PENDAX Javascript SDK.
All parameters of type INTEGER listed in the Bybit API docs need to be passed in as a string.
Get Position Info
Function name:
getPositionInfo(options)Usage:
import { createExchange } from "./exchanges/exchange.js";
let myByBitAccount = createExchange({
exchange: "bybit",
authenticate: "true",
key: "myKeys",
secret: "mySecret",
label: "bybit",
testnet: "false"
});
async function getPositionInfo(exchange, options) {
try {
let result = await exchange.getPositionInfo(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
const result = await getPositionInfo(myByBitAccount,
{
category: 'linear',
symbol: 'BTCUSDT'
});Set Leverage
Function name:
Usage:
Switch Cross/Isolated Margin
Function name:
Usage:
Set TP/SL Mode
Function name:
Usage:
Switch Position Mode
Function name:
Usage:
Set Risk Limit
Function name:
Usage:
Set Trading Stop
Function name:
Usage:
Set Auto Add Margin
Function name:
Usage:
Get Execution
Function name:
Usage:
Get Closed PnL
Function name:
Usage:
Last updated