Bybit TypeScript SDK example: rest-v5-next-cursor.ts
Bybit REST REST V5 next cursor example for the Siebly Bybit SDK, with TypeScript source for exchange REST API and WebSocket integration, setup, and production SDK docs.
What This Example Covers
- Bybit REST API example in TypeScript.
- Uses the Siebly Bybit SDK package
bybit-apiinstead of hand-written HTTP request plumbing. - Source path:
Bybit/Rest/rest-v5-next-cursor.ts. - Example category: REST.
- Imports SDK symbols including
RestClientV5. - Calls SDK methods such as
getUniversalTransferRecords().
How To Use This Example
- Start here for the specific request or stream pattern, then check the matching SDK guide for install, credentials, and operational notes.
- Open the repository source when you need the latest committed version: GitHub source file.
Example Path
Bybit/Rest/rest-v5-next-cursor.ts
Source Link
Repository source: https://github.com/sieblyio/crypto-api-examples/blob/master/examples/Bybit/Rest/rest-v5-next-cursor.ts
Related SDK Docs
Example Source
import { RestClientV5, UniversalTransferRecordV5 } from 'bybit-api';
const client = new RestClientV5({
testnet: false,
key: 'insert_api_key',
secret: 'insert_api_secret',
});
async function getAllUniversalTransfers() {
const allTransfers: UniversalTransferRecordV5[] = [];
let nextCursor = '';
let pages = 0;
do {
pages++;
console.log(`Fetching data from page ${pages}`);
const response = await client.getUniversalTransferRecords({
limit: 50, // Maximum page size per request
cursor: nextCursor || undefined, // Only send cursor if we have one
});
if (response.result.list && response.result.list.length > 0) {
allTransfers.push(...response.result.list);
}
nextCursor = response.result.nextPageCursor;
// Optional: Add a small delay to avoid rate limits
await new Promise((resolve) => setTimeout(resolve, 100));
} while (nextCursor);
console.log('Total transfers fetched:', allTransfers.length);
console.log('All transfers:', allTransfers);
}
getAllUniversalTransfers().catch(console.error);