Bybit TypeScript SDK example: rest-v5-all.ts
Bybit REST REST V5 all 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-all.ts. - Example category: REST.
- Imports SDK symbols including
RestClientV5. - Calls SDK methods such as
getKline(),getMarkPriceKline(),getIndexPriceKline().
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-all.ts
Source Link
Repository source: https://github.com/sieblyio/crypto-api-examples/blob/master/examples/Bybit/Rest/rest-v5-all.ts
Related SDK Docs
Example Source
import { RestClientV5 } from 'bybit-api';
const key = process.env.API_KEY_COM;
const secret = process.env.API_SECRET_COM;
const client = new RestClientV5({
key: key,
secret: secret,
});
/**
* If you don't plan on making any private api calls,
* you can instance the REST client without any parameters:
*
* const client = new RestClientV5();
*/
(async () => {
try {
const klineResult = await client.getKline({
category: 'linear',
interval: '15',
symbol: 'BTCUSDT',
});
console.log('klineResult: ', klineResult);
const markPriceKlineResult = await client.getMarkPriceKline({
category: 'linear',
interval: '15',
symbol: 'BTCUSDT',
});
console.log('markPriceKlineResult: ', markPriceKlineResult);
const indexPriceKline = await client.getIndexPriceKline({
category: 'linear',
interval: '15',
symbol: 'BTCUSDT',
});
console.log('indexPriceKline: ', indexPriceKline);
} catch (e) {
console.error('request failed: ', e);
}
})();