v3.5.0: release v5 rest client for bybit APIs

This commit is contained in:
tiagosiebler
2023-02-23 12:15:47 +00:00
parent a786da23e3
commit caf205fe33
3 changed files with 19 additions and 17 deletions

View File

@@ -12,12 +12,12 @@ import {
ApiKeyInfoV5, ApiKeyInfoV5,
AssetInfoV5, AssetInfoV5,
BatchAmendOrderParamsV5, BatchAmendOrderParamsV5,
BatchAmendOrderResult, BatchAmendOrderResultV5,
BatchCancelOrderParamsV5, BatchCancelOrderParamsV5,
BatchCancelOrderResult, BatchCancelOrderResultV5,
BatchCreateOrderResultV5,
BatchOrderParamsV5, BatchOrderParamsV5,
BatchOrderResult, BatchOrdersResponseV5,
BatchOrdersResult,
BorrowHistoryRecordV5, BorrowHistoryRecordV5,
CancelAllOrdersParamsV5, CancelAllOrdersParamsV5,
CancelOrderParamsV5, CancelOrderParamsV5,
@@ -63,7 +63,7 @@ import {
GetOpenInterestParamsV5, GetOpenInterestParamsV5,
GetOptionDeliveryPriceParamsV5, GetOptionDeliveryPriceParamsV5,
GetOrderbookParamsV5, GetOrderbookParamsV5,
GetPremiumIndexPriceKlineParams, GetPremiumIndexPriceKlineParamsV5,
GetPublicTradingHistoryParamsV5, GetPublicTradingHistoryParamsV5,
GetRiskLimitParamsV5, GetRiskLimitParamsV5,
GetSettlementRecordParamsV5, GetSettlementRecordParamsV5,
@@ -105,7 +105,7 @@ import {
SetTPSLModeParamsV5, SetTPSLModeParamsV5,
SetTradingStopParamsV5, SetTradingStopParamsV5,
SettlementRecordV5, SettlementRecordV5,
SpotBorrowCheckResult, SpotBorrowCheckResultV5,
SpotLeveragedTokenOrderHistoryV5, SpotLeveragedTokenOrderHistoryV5,
SubMemberV5, SubMemberV5,
SwitchIsolatedMarginParamsV5, SwitchIsolatedMarginParamsV5,
@@ -205,7 +205,7 @@ export class RestClientV5 extends BaseRestClient {
* Covers: Linear contract * Covers: Linear contract
*/ */
getPremiumIndexPriceKline( getPremiumIndexPriceKline(
params: GetPremiumIndexPriceKlineParams params: GetPremiumIndexPriceKlineParamsV5
): Promise< ): Promise<
APIResponseV3WithTime<CategorySymbolListV5<OHLCKlineV5[], 'linear'>> APIResponseV3WithTime<CategorySymbolListV5<OHLCKlineV5[], 'linear'>>
> { > {
@@ -403,7 +403,9 @@ export class RestClientV5 extends BaseRestClient {
batchSubmitOrders( batchSubmitOrders(
category: 'option', category: 'option',
orders: BatchOrderParamsV5[] orders: BatchOrderParamsV5[]
): Promise<APIResponseV3WithTime<BatchOrdersResult<BatchOrderResult[]>>> { ): Promise<
APIResponseV3WithTime<BatchOrdersResponseV5<BatchCreateOrderResultV5[]>>
> {
return this.postPrivate('/v5/order/create-batch', { return this.postPrivate('/v5/order/create-batch', {
category, category,
request: orders, request: orders,
@@ -421,7 +423,7 @@ export class RestClientV5 extends BaseRestClient {
category: 'option', category: 'option',
orders: BatchAmendOrderParamsV5[] orders: BatchAmendOrderParamsV5[]
): Promise< ): Promise<
APIResponseV3WithTime<BatchOrdersResult<BatchAmendOrderResult[]>> APIResponseV3WithTime<BatchOrdersResponseV5<BatchAmendOrderResultV5[]>>
> { > {
return this.postPrivate('/v5/order/amend-batch', { return this.postPrivate('/v5/order/amend-batch', {
category, category,
@@ -440,7 +442,7 @@ export class RestClientV5 extends BaseRestClient {
category: 'option', category: 'option',
orders: BatchCancelOrderParamsV5[] orders: BatchCancelOrderParamsV5[]
): Promise< ): Promise<
APIResponseV3WithTime<BatchOrdersResult<BatchCancelOrderResult[]>> APIResponseV3WithTime<BatchOrdersResponseV5<BatchCancelOrderResultV5[]>>
> { > {
return this.postPrivate('/v5/order/cancel-batch', { return this.postPrivate('/v5/order/cancel-batch', {
category, category,
@@ -456,7 +458,7 @@ export class RestClientV5 extends BaseRestClient {
getSpotBorrowCheck( getSpotBorrowCheck(
symbol: string, symbol: string,
side: OrderSideV5 side: OrderSideV5
): Promise<APIResponseV3WithTime<SpotBorrowCheckResult>> { ): Promise<APIResponseV3WithTime<SpotBorrowCheckResultV5>> {
return this.getPrivate('/v5/order/spot-borrow-check', { return this.getPrivate('/v5/order/spot-borrow-check', {
category: 'spot', category: 'spot',
symbol, symbol,

View File

@@ -28,7 +28,7 @@ export interface GetIndexPriceKlineParamsV5 {
limit?: number; limit?: number;
} }
export interface GetPremiumIndexPriceKlineParams { export interface GetPremiumIndexPriceKlineParamsV5 {
category: 'linear'; category: 'linear';
symbol: string; symbol: string;
interval: KlineIntervalV3; interval: KlineIntervalV3;

View File

@@ -53,7 +53,7 @@ export interface AccountOrderV5 {
updatedTime: string; updatedTime: string;
} }
export interface BatchOrderResult { export interface BatchCreateOrderResultV5 {
category: CategoryV5; category: CategoryV5;
symbol: string; symbol: string;
orderId: string; orderId: string;
@@ -61,7 +61,7 @@ export interface BatchOrderResult {
createAt: string; createAt: string;
} }
export interface BatchOrdersResult<T extends unknown[]> { export interface BatchOrdersResponseV5<T extends unknown[]> {
result: { result: {
list: T; list: T;
}; };
@@ -73,21 +73,21 @@ export interface BatchOrdersResult<T extends unknown[]> {
}; };
} }
export interface BatchAmendOrderResult { export interface BatchAmendOrderResultV5 {
category: CategoryV5; category: CategoryV5;
symbol: string; symbol: string;
orderId: string; orderId: string;
orderLinkId: string; orderLinkId: string;
} }
export interface BatchCancelOrderResult { export interface BatchCancelOrderResultV5 {
category: CategoryV5; category: CategoryV5;
symbol: string; symbol: string;
orderId: string; orderId: string;
orderLinkId: string; orderLinkId: string;
} }
export interface SpotBorrowCheckResult { export interface SpotBorrowCheckResultV5 {
symbol: string; symbol: string;
side: OrderSideV5; side: OrderSideV5;
maxTradeQty: string; maxTradeQty: string;