forked from tiagosiebler/bybit-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rest-spot-tpsl.ts
42 lines (35 loc) · 876 Bytes
/
rest-spot-tpsl.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { SpotClientV3 } from '../src/index';
// or
// import { SpotClientV3 } from 'bybit-api';
const symbol = 'BTCUSDT';
const key = process.env.API_KEY_COM;
const secret = process.env.API_SECRET_COM;
const client = new SpotClientV3({
key,
secret,
strict_param_validation: true,
});
(async () => {
try {
const orderId = undefined;
const ordersPerPage = undefined;
const orders = await client.getOpenOrders(symbol);
console.log('orders 1:', orders);
const normalOrders = await client.getOpenOrders(
symbol,
orderId,
ordersPerPage,
0
);
console.log('normal orders:', normalOrders);
const tpSlOrders = await client.getOpenOrders(
symbol,
orderId,
ordersPerPage,
1
);
console.log('tpSlOrders:', tpSlOrders);
} catch (e) {
console.error('request failed: ', e);
}
})();