feat(#261): add tpsl params missing from position endpoints. add new endpoint for add/reduce margin. add doc examples

This commit is contained in:
tiagosiebler
2023-06-07 16:56:36 +01:00
parent 4f563a65a5
commit 05d63839da
15 changed files with 289 additions and 1 deletions

View File

@@ -0,0 +1,31 @@
const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
key: 'apikey',
secret: 'apisecret',
});
client
.setTradingStop({
category: 'linear',
symbol: 'XRPUSDT',
takeProfit: '0.5',
stopLoss: '0.2',
tpTriggerBy: 'MarkPrice',
slTriggerBy: 'IndexPrice',
tpslMode: 'Partial',
tpOrderType: 'Limit',
slOrderType: 'Limit',
tpSize: '50',
slSize: '50',
tpLimitPrice: '0.49',
slLimitPrice: '0.21',
positionIdx: 0,
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});