more tidying on v5 example and request type

This commit is contained in:
tiagosiebler
2023-02-17 12:18:56 +00:00
parent 6a4e7c09ed
commit 19f785b624
3 changed files with 28 additions and 1 deletions

View File

@@ -0,0 +1,27 @@
import { RestClientV5 } from '../src/index';
// or
// import { RestClientV5 } from 'bybit-api';
const key = process.env.API_KEY_COM;
const secret = process.env.API_SECRET_COM;
const client = new RestClientV5({
key,
secret,
strict_param_validation: true,
});
(async () => {
try {
/** Simple example for a private REST API call with bybit's V5 REST APIs */
const response = await client.getPositionInfo({
category: 'option',
symbol: 'BTCUSDT',
});
console.log('response:', response);
} catch (e) {
console.error('request failed: ', e);
}
})();