feat(#187, v3.1.2): add support for new orderCategory param for spotv3
This commit is contained in:
12
README.md
12
README.md
@@ -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:
|
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 |
|
| 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/) |
|
| [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) |
|
| [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) |
|
| [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) |
|
| [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) |
|
| [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) |
|
| [ **Other** ] | Other standalone API groups |
|
||||||
| [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) |
|
|
||||||
| [AccountAssetClient](src/account-asset-client.ts) | [Account Asset APIs](https://bybit-exchange.github.io/docs/account_asset/#t-introduction) |
|
| [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) |
|
| [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) |
|
| [WebsocketClient](src/websocket-client.ts) | All WebSocket Events (Public & Private for all API categories) |
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import { WebsocketClient, WS_KEY_MAP, DefaultLogger } from '../src';
|
|||||||
const market = 'linear';
|
const market = 'linear';
|
||||||
// Inverse Perp
|
// Inverse Perp
|
||||||
// const market = 'inverse';
|
// const market = 'inverse';
|
||||||
// const market = 'spot';
|
// const market = 'spotv3';
|
||||||
|
|
||||||
// Note: the WebsocketClient defaults to testnet. Set `livenet: true` to use live markets.
|
// Note: the WebsocketClient defaults to testnet. Set `livenet: true` to use live markets.
|
||||||
const wsClient = new WebsocketClient(
|
const wsClient = new WebsocketClient(
|
||||||
@@ -50,5 +50,6 @@ import { WebsocketClient, WS_KEY_MAP, DefaultLogger } from '../src';
|
|||||||
});
|
});
|
||||||
|
|
||||||
// subscribe to private endpoints
|
// subscribe to private endpoints
|
||||||
|
// check the api docs in your api category to see the available topics
|
||||||
wsClient.subscribe(['position', 'execution', 'order', 'wallet']);
|
wsClient.subscribe(['position', 'execution', 'order', 'wallet']);
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "bybit-api",
|
"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.",
|
"description": "Complete & robust node.js SDK for Bybit's REST APIs and WebSockets, with TypeScript & integration tests.",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"types": "lib/index.d.ts",
|
"types": "lib/index.d.ts",
|
||||||
|
|||||||
@@ -145,12 +145,14 @@ export class SpotClientV3 extends BaseRestClient {
|
|||||||
getOpenOrders(
|
getOpenOrders(
|
||||||
symbol?: string,
|
symbol?: string,
|
||||||
orderId?: string,
|
orderId?: string,
|
||||||
limit?: number
|
limit?: number,
|
||||||
|
orderCategory?: 0 | 1
|
||||||
): Promise<APIResponseV3<any>> {
|
): Promise<APIResponseV3<any>> {
|
||||||
return this.getPrivate('/spot/v3/private/open-orders', {
|
return this.getPrivate('/spot/v3/private/open-orders', {
|
||||||
symbol,
|
symbol,
|
||||||
orderId,
|
orderId,
|
||||||
limit,
|
limit,
|
||||||
|
orderCategory,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,7 +160,8 @@ export class SpotClientV3 extends BaseRestClient {
|
|||||||
getPastOrders(
|
getPastOrders(
|
||||||
symbol?: string,
|
symbol?: string,
|
||||||
orderId?: string,
|
orderId?: string,
|
||||||
limit?: number
|
limit?: number,
|
||||||
|
orderCategory?: 0 | 1
|
||||||
): Promise<APIResponseV3<any>> {
|
): Promise<APIResponseV3<any>> {
|
||||||
return this.getPrivate('/spot/v3/private/history-orders', {
|
return this.getPrivate('/spot/v3/private/history-orders', {
|
||||||
symbol,
|
symbol,
|
||||||
|
|||||||
@@ -29,11 +29,13 @@ export interface SpotCancelOrderBatchRequest {
|
|||||||
symbol: string;
|
symbol: string;
|
||||||
side?: OrderSide;
|
side?: OrderSide;
|
||||||
orderTypes: OrderTypeSpot[];
|
orderTypes: OrderTypeSpot[];
|
||||||
|
orderCategory?: 0 | 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SpotOrderQueryById {
|
export interface SpotOrderQueryById {
|
||||||
orderId?: string;
|
orderId?: string;
|
||||||
orderLinkId?: string;
|
orderLinkId?: string;
|
||||||
|
orderCategory?: 0 | 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SpotSymbolInfo {
|
export interface SpotSymbolInfo {
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ export interface UMOrderRequest {
|
|||||||
category: UMCategory;
|
category: UMCategory;
|
||||||
symbol: string;
|
symbol: string;
|
||||||
side: OrderSide;
|
side: OrderSide;
|
||||||
positionIdx?: '0';
|
positionIdx?: '0' | '1' | '2';
|
||||||
orderType: UMOrderType;
|
orderType: UMOrderType;
|
||||||
qty: string;
|
qty: string;
|
||||||
price?: string;
|
price?: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user