feat(#187, v3.1.2): add support for new orderCategory param for spotv3

This commit is contained in:
tiagosiebler
2022-10-23 10:59:37 +01:00
parent fce9bde6e5
commit a7d4f630b3
6 changed files with 20 additions and 8 deletions

View File

@@ -53,14 +53,20 @@ The version on npm is the output from the `build` command and can be used in pro
Each REST API group has a dedicated REST client. To avoid confusion, here are the available REST clients and the corresponding API groups:
| Class | Description |
|:------------------------------------------------------------------: |:----------------------------------------------------------------------------------------------------------------------------: |
| [ **Derivatives v3** ] | The Derivatves v3 APIs (successor to the Futures V2 APIs) |
| [UnifiedMarginClient](src/unified-margin-client.ts) | [Derivatives (v3) Unified Margin APIs](https://bybit-exchange.github.io/docs/derivativesV3/unified_margin/#t-introduction) |
| [ContractClient](src/contract-client.ts) | [Derivatives (v3) Contract APIs](https://bybit-exchange.github.io/docs/derivativesV3/contract). |
| [ **Futures v2** ] | The Futures v2 APIs |
| [InverseClient](src/inverse-client.ts) | [Inverse Perpetual Futures (v2) APIs](https://bybit-exchange.github.io/docs/futuresV2/inverse/) |
| [LinearClient](src/linear-client.ts) | [USDT Perpetual Futures (v2) APIs](https://bybit-exchange.github.io/docs/futuresV2/linear/#t-introduction) |
| [InverseFuturesClient](src/inverse-futures-client.ts) | [Inverse Futures (v2) APIs](https://bybit-exchange.github.io/docs/futuresV2/inverse_futures/#t-introduction) |
| [ **Spot** ] | The spot APIs |
| [SpotClientV3](src/spot-client-v3.ts) | [Spot Market (v3) APIs](https://bybit-exchange.github.io/docs/spot/v3/#t-introduction) |
| [~SpotClient~](src/spot-client.ts) (deprecated, SpotClientV3 recommended)| [Spot Market (v1) APIs](https://bybit-exchange.github.io/docs/spot/v1/#t-introduction) |
| [ **USDC Contract** ] | The USDC Contract APIs |
| [USDCPerpetualClient](src/usdc-perpetual-client.ts) | [USDC Perpetual APIs](https://bybit-exchange.github.io/docs/usdc/option/?console#t-querydeliverylog) |
| [USDCOptionClient](src/usdc-option-client.ts) | [USDC Option APIs](https://bybit-exchange.github.io/docs/usdc/option/#t-introduction) |
| [UnifiedMarginClient](src/unified-margin-client.ts) | [Derivatives (v3) unified margin APIs](https://bybit-exchange.github.io/docs/derivativesV3/unified_margin/#t-introduction) |
| [SpotClientV3](src/spot-client-v3.ts) | [Spot Market (v3) APIs](https://bybit-exchange.github.io/docs/spot/v3/#t-introduction) |
| [~SpotClient~](src/spot-client.ts) (deprecated, v3 client recommended)| [Spot Market (v1) APIs](https://bybit-exchange.github.io/docs/spot/v1/#t-introduction) |
| [ **Other** ] | Other standalone API groups |
| [AccountAssetClient](src/account-asset-client.ts) | [Account Asset APIs](https://bybit-exchange.github.io/docs/account_asset/#t-introduction) |
| [CopyTradingClient](src/copy-trading-client.ts) | [Copy Trading APIs](https://bybit-exchange.github.io/docs/copy_trading/#t-introduction) |
| [WebsocketClient](src/websocket-client.ts) | All WebSocket Events (Public & Private for all API categories) |

View File

@@ -16,7 +16,7 @@ import { WebsocketClient, WS_KEY_MAP, DefaultLogger } from '../src';
const market = 'linear';
// Inverse Perp
// const market = 'inverse';
// const market = 'spot';
// const market = 'spotv3';
// Note: the WebsocketClient defaults to testnet. Set `livenet: true` to use live markets.
const wsClient = new WebsocketClient(
@@ -50,5 +50,6 @@ import { WebsocketClient, WS_KEY_MAP, DefaultLogger } from '../src';
});
// subscribe to private endpoints
// check the api docs in your api category to see the available topics
wsClient.subscribe(['position', 'execution', 'order', 'wallet']);
})();

View File

@@ -1,6 +1,6 @@
{
"name": "bybit-api",
"version": "3.1.1",
"version": "3.1.2",
"description": "Complete & robust node.js SDK for Bybit's REST APIs and WebSockets, with TypeScript & integration tests.",
"main": "lib/index.js",
"types": "lib/index.d.ts",

View File

@@ -145,12 +145,14 @@ export class SpotClientV3 extends BaseRestClient {
getOpenOrders(
symbol?: string,
orderId?: string,
limit?: number
limit?: number,
orderCategory?: 0 | 1
): Promise<APIResponseV3<any>> {
return this.getPrivate('/spot/v3/private/open-orders', {
symbol,
orderId,
limit,
orderCategory,
});
}
@@ -158,7 +160,8 @@ export class SpotClientV3 extends BaseRestClient {
getPastOrders(
symbol?: string,
orderId?: string,
limit?: number
limit?: number,
orderCategory?: 0 | 1
): Promise<APIResponseV3<any>> {
return this.getPrivate('/spot/v3/private/history-orders', {
symbol,

View File

@@ -29,11 +29,13 @@ export interface SpotCancelOrderBatchRequest {
symbol: string;
side?: OrderSide;
orderTypes: OrderTypeSpot[];
orderCategory?: 0 | 1;
}
export interface SpotOrderQueryById {
orderId?: string;
orderLinkId?: string;
orderCategory?: 0 | 1;
}
export interface SpotSymbolInfo {

View File

@@ -60,7 +60,7 @@ export interface UMOrderRequest {
category: UMCategory;
symbol: string;
side: OrderSide;
positionIdx?: '0';
positionIdx?: '0' | '1' | '2';
orderType: UMOrderType;
qty: string;
price?: string;