forked from tiagosiebler/bybit-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rest-unified-margin-private-cursor.ts
44 lines (38 loc) · 1.03 KB
/
rest-unified-margin-private-cursor.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
43
44
import { UnifiedMarginClient } from '../src/index';
// or
// import { UnifiedMarginClient } from 'bybit-api';
const key = process.env.API_KEY_COM;
const secret = process.env.API_SECRET_COM;
const client = new UnifiedMarginClient({
key,
secret,
strict_param_validation: true,
});
(async () => {
try {
// page 1
const historicOrders1 = await client.getHistoricOrders({
category: 'linear',
limit: 1,
// cursor,
});
console.log('page 1:', JSON.stringify(historicOrders1, null, 2));
// page 2
const historicOrders2 = await client.getHistoricOrders({
category: 'linear',
limit: 1,
cursor: historicOrders1.result.nextPageCursor,
});
console.log('page 2:', JSON.stringify(historicOrders2, null, 2));
const historicOrdersBoth = await client.getHistoricOrders({
category: 'linear',
limit: 2,
});
console.log(
'both to compare:',
JSON.stringify(historicOrdersBoth, null, 2)
);
} catch (e) {
console.error('request failed: ', e);
}
})();