From 19f785b6249349b689980457d79b18596427cb98 Mon Sep 17 00:00:00 2001 From: tiagosiebler Date: Fri, 17 Feb 2023 12:18:56 +0000 Subject: [PATCH] more tidying on v5 example and request type --- .../{rest-rawv3auth.ts => rest-raw-v3sign.ts} | 0 examples/rest-v5-private.ts | 27 +++++++++++++++++++ src/types/request/v5-asset.ts | 2 +- 3 files changed, 28 insertions(+), 1 deletion(-) rename examples/{rest-rawv3auth.ts => rest-raw-v3sign.ts} (100%) create mode 100644 examples/rest-v5-private.ts diff --git a/examples/rest-rawv3auth.ts b/examples/rest-raw-v3sign.ts similarity index 100% rename from examples/rest-rawv3auth.ts rename to examples/rest-raw-v3sign.ts diff --git a/examples/rest-v5-private.ts b/examples/rest-v5-private.ts new file mode 100644 index 0000000..bc66ec1 --- /dev/null +++ b/examples/rest-v5-private.ts @@ -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); + } +})(); diff --git a/src/types/request/v5-asset.ts b/src/types/request/v5-asset.ts index a1af232..8867c03 100644 --- a/src/types/request/v5-asset.ts +++ b/src/types/request/v5-asset.ts @@ -125,7 +125,7 @@ export interface WithdrawParamsV5 { amount: string; timestamp: number; forceChain?: number; - accountType?: string; + accountType?: 'SPOT' | 'FUND'; } export interface CreateSubMemberParamsV5 {