Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
858 changes: 432 additions & 426 deletions docs/endpointFunctionList.md

Large diffs are not rendered by default.

20,468 changes: 10,213 additions & 10,255 deletions llms.txt

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bybit-api",
"version": "4.8.4",
"version": "4.8.5",
"description": "Complete & robust Node.js SDK for Bybit's REST APIs and WebSockets, with TypeScript & strong end to end tests.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
92 changes: 91 additions & 1 deletion src/rest-client-v5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,13 @@ import {
BrokerRateLimitCapItemV5,
BrokerRateLimitSetResultItemV5,
BrokerVoucherSpecV5,
CancelAllEventQuotesParamsV5,
CancelAllEventQuotesResultV5,
CancelAllOrdersParamsV5,
CancelAllRFQResultV5,
CancelBorrowOrderFixedParamsV5,
CancelEventQuoteParamsV5,
CancelFixedRateBorrowOrderParamsV5,
CancelOrderParamsV5,
CancelRFQParamsV5,
CancelRFQQuoteItemV5,
Expand Down Expand Up @@ -126,6 +129,7 @@ import {
ConvertHistoryRecordV5,
ConvertQuoteV5,
ConvertStatusV5,
CorporateActionV5,
CreateBorrowOrderFixedParamsV5,
CreateBorrowOrderFixedV5,
CreateP2PAdParamsV5,
Expand Down Expand Up @@ -202,6 +206,7 @@ import {
FixedLoanAvailableInventoryV5,
FixedRateAvailableInventoryV5,
FixedRateBorrowContractInfoV5,
FixedRateBorrowInterestAccruedV5,
FixedRateBorrowOrderInfoV5,
FixedRateBorrowParamsV5,
FixedRateBorrowQuoteV5,
Expand Down Expand Up @@ -279,6 +284,7 @@ import {
GetCollateralCoinsParamsV5,
GetCompletedLoanOrderHistoryParamsV5,
GetConvertHistoryParamsV5,
GetCorporateActionsParamsV5,
GetDeliveryPriceParamsV5,
GetDeliveryRecordParamsV5,
GetDepositRecordParamsV5,
Expand Down Expand Up @@ -309,6 +315,7 @@ import {
GetFixedLoanAvailableInventoryParamsV5,
GetFixedRateAvailableInventoryParamsV5,
GetFixedRateBorrowContractInfoParamsV5,
GetFixedRateBorrowInterestAccruedParamsV5,
GetFixedRateBorrowOrderInfoParamsV5,
GetFixedRateBorrowOrderQuoteParamsV5,
GetFixedTermEarnOrderListParamsV5,
Expand Down Expand Up @@ -586,6 +593,7 @@ import {
SettlePwmFundProfitParamsV5,
SettlePwmFundProfitResultV5,
SetTPSLModeParamsV5,
SetTradeAutoRepayParamsV5,
SetTradingStopParamsV5,
SignAgreementParamsV5,
SmallBalanceListV5,
Expand Down Expand Up @@ -630,6 +638,7 @@ import {
TokenSplashUserActivityResultV5,
TotalMembersAssetsResultV5,
TPSLModeV5,
TradeAutoRepayResultV5,
TradeInfoForAnalysisResultV5,
TransactionLogV5,
UnifiedAccountUpgradeResultV5,
Expand Down Expand Up @@ -914,6 +923,11 @@ export class RestClientV5 extends BaseRestClient {
* - orderId & orderLinkId has a higher priority than startTime & endTime
* - Fully canceled orders are stored for up to 24 hours
* - Single leg orders can also be found with "createType"=CreateByFutureSpread via Get Order History
* - From 2026-12-03 (postponed from 2026-11-12), omitting orderStatus excludes Cancelled, Rejected and Deactivated orders from the last 24 hours.
* Pass orderStatus explicitly to retrieve matching orders from that period.
* Undocumented in the endpoint parameter table; confirmed by Bybit's API announcement.
* @see https://t.me/Bybit_API_Announcements/464
* @see https://t.me/Bybit_API_Announcements/468
*/
getSpreadOrderHistory(params?: GetSpreadOrderHistoryParamsV5): Promise<
APIResponseV3WithTime<{
Expand Down Expand Up @@ -1281,6 +1295,15 @@ export class RestClientV5 extends BaseRestClient {
return this.get('/v5/market/option-base-coins', params);
}

getCorporateActions(params?: GetCorporateActionsParamsV5): Promise<
APIResponseV3WithTime<{
list: CorporateActionV5[];
nextPageCursor: string;
}>
> {
return this.get('/v5/market/corporate-action', params);
}

/**
*
****** Trade APIs
Expand Down Expand Up @@ -1326,6 +1349,11 @@ export class RestClientV5 extends BaseRestClient {
* Query order history. As order creation/cancellation is asynchronous, the data returned from this endpoint may delay.
*
* If you want to get real-time order information, you could query this endpoint or rely on the websocket stream (recommended).
*
* From 2026-12-03 (postponed from 2026-11-12), omitting orderStatus excludes Cancelled, Rejected and Deactivated orders from the last 24 hours.
* Pass orderStatus explicitly to retrieve matching orders from that period.
* @see https://t.me/Bybit_API_Announcements/464
* @see https://t.me/Bybit_API_Announcements/468
*/
getHistoricOrders(
params: GetAccountHistoricOrdersParamsV5,
Expand Down Expand Up @@ -3663,7 +3691,9 @@ export class RestClientV5 extends BaseRestClient {
* Set spot automatic repayment mode.
*
* INFO:
* - If currency is not passed, spot automatic repayment will be enabled for all currencies
* - If currency is not passed, autoRepayMode sets the global automatic repayment switch.
* When enabled, it also applies to currencies that become borrowable later.
* - If currency is passed, only that currency is updated; single-currency behavior is unchanged.
* - If autoRepayMode of a currency is set to 1, the system will automatically make repayments
* without asset conversion to that currency at 0 and 30 minutes every hour
* - The amount of repayments is the minimum of available spot balance and liability
Expand All @@ -3677,6 +3707,32 @@ export class RestClientV5 extends BaseRestClient {
);
}

/**
* Get the Unified account's trade auto repayment switch.
*
* Applies only in Cross and Portfolio margin modes; has no effect in Isolated mode.
* Separate from scheduled automatic repayment configured through setAutoRepayMode.
*/
getTradeAutoRepay(): Promise<APIResponseV3WithTime<TradeAutoRepayResultV5>> {
return this.getPrivate('/v5/spot-margin-trade/get-trade-auto-repay');
}

/**
* Set the Unified account's trade auto repayment switch. Disabled by default.
* Repays a credited coin's own flexible-rate liability after an eligible spot trade, without asset conversion.
*
* Runs only in Cross and Portfolio margin modes. Isolated mode can save the setting, but repayment does not run.
* Separate from scheduled automatic repayment configured through setAutoRepayMode.
*/
setTradeAutoRepay(
params: SetTradeAutoRepayParamsV5,
): Promise<APIResponseV3WithTime<TradeAutoRepayResultV5>> {
return this.postPrivate(
'/v5/spot-margin-trade/set-trade-auto-repay',
params,
);
}

/**
* Get Liability Info (spot margin UTA): fixed vs floating, spot vs derivatives borrow split.
*/
Expand Down Expand Up @@ -3750,6 +3806,29 @@ export class RestClientV5 extends BaseRestClient {
return this.postPrivate('/v5/spot-margin-trade/fixedborrow-renew', params);
}

getFixedRateBorrowInterestAccrued(
params?: GetFixedRateBorrowInterestAccruedParamsV5,
): Promise<
APIResponseV3WithTime<{
list: FixedRateBorrowInterestAccruedV5[];
nextPageCursor: string;
}>
> {
return this.getPrivate(
'/v5/spot-margin-trade/fixedborrow-interest-accrued',
params,
);
}

cancelFixedRateBorrowOrder(
params: CancelFixedRateBorrowOrderParamsV5,
): Promise<APIResponseV3WithTime<{}>> {
return this.postPrivate(
'/v5/spot-margin-trade/fixedborrow-order-cancel',
params,
);
}

getFlexibleAvailableInventory(
params: GetFlexibleAvailableInventoryParamsV5,
): Promise<APIResponseV3WithTime<FlexibleAvailableInventoryV5>> {
Expand Down Expand Up @@ -6310,4 +6389,15 @@ export class RestClientV5 extends BaseRestClient {
): Promise<APIResponseV3WithTime<EventQuoteResultV5>> {
return this.postPrivate('/v5/event/cancel', params);
}

/**
* Cancel all active Event Contract quotes for a symbol.
*
* INFO: Event Contract maker accounts only.
*/
cancelAllEventQuotes(
params: CancelAllEventQuotesParamsV5,
): Promise<APIResponseV3WithTime<CancelAllEventQuotesResultV5>> {
return this.postPrivate('/v5/event/cancel-all', params);
}
}
6 changes: 6 additions & 0 deletions src/types/request/v5-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,15 @@ export interface SubmitEventQuoteParamsV5 {
orderLinkId: string;
grossPayoutRatio: string;
amount: string;
/** Automatically cancel after this many milliseconds. 0 uses quoteMaxValidMs; non-zero values must not exceed quoteMaxValidMs */
cancelAfterMs?: number;
}

export interface CancelEventQuoteParamsV5 {
orderLinkId?: string;
orderId?: string;
}

export interface CancelAllEventQuotesParamsV5 {
symbol: string;
}
8 changes: 8 additions & 0 deletions src/types/request/v5-market.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,11 @@ export interface GetOptionBaseCoinsParamsV5 {
*/
underlyingType?: string;
}

export interface GetCorporateActionsParamsV5 {
category?: 'option';
baseCoin?: string;
actionType?: 'ForwardSplit' | 'ReverseSplit' | 'Dividend';
limit?: number;
cursor?: string;
}
19 changes: 18 additions & 1 deletion src/types/request/v5-spot-leverage-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,16 @@ export interface GetAutoRepayModeParamsV5 {
}

export interface SetAutoRepayModeParamsV5 {
currency?: string; // Coin name, uppercase only. If not passed, enables for all currencies
/** Coin name, uppercase only. If omitted, sets the global switch; when enabled, includes currencies that become borrowable later */
currency?: string;
autoRepayMode: '0' | '1'; // 0: Off, 1: On
}

export interface SetTradeAutoRepayParamsV5 {
/** 1: enable trade auto repayment; 0: disable */
autoRepay: '0' | '1';
}

export interface GetSpotMarginLiabilityInfoParamsV5 {
currency: string;
}
Expand Down Expand Up @@ -121,6 +127,17 @@ export interface RenewFixedRateBorrowParamsV5 {
qty?: string;
}

export interface GetFixedRateBorrowInterestAccruedParamsV5 {
orderId?: string;
orderCurrency?: string;
limit?: string;
cursor?: string;
}

export interface CancelFixedRateBorrowOrderParamsV5 {
orderId: string;
}

export interface GetFlexibleAvailableInventoryParamsV5 {
currency: string;
}
Expand Down
5 changes: 5 additions & 0 deletions src/types/request/v5-spreadtrading.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ export interface GetSpreadOrderHistoryParamsV5 {
baseCoin?: string;
orderId?: string;
orderLinkId?: string;
/**
* Filter by order status. Undocumented in the endpoint parameter table; confirmed by Bybit's API announcement.
* @see https://t.me/Bybit_API_Announcements/464
*/
orderStatus?: 'Rejected' | 'Cancelled' | 'Filled';
startTime?: number;
endTime?: number;
limit?: number;
Expand Down
10 changes: 8 additions & 2 deletions src/types/request/v5-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ export interface CreateStrategyOrderParamsV5 {
depthReference?: string;
}

/** GET /v5/strategy/list */
/**
* GET /v5/strategy/list
* The range between beginTimeE0 and endTimeE0 (Unix timestamps in seconds) cannot exceed one year.
*/
export interface GetStrategyListParamsV5 {
strategyId?: string;
symbol?: string;
Expand All @@ -72,7 +75,10 @@ export interface GetStrategyListParamsV5 {
cursor?: string;
}

/** GET /v5/strategy/order-list */
/**
* GET /v5/strategy/order-list
* The range between beginTimeE0 and endTimeE0 (Unix timestamps in seconds) cannot exceed one year.
*/
export interface GetStrategyOrderListParamsV5 {
strategyId: string;
/** 2: created, 3: create failed, 4: partially filled, 5: fully filled, 6: rejected, 7: canceled */
Expand Down
1 change: 1 addition & 0 deletions src/types/response/v5-asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export interface AllowedDepositCoinInfoV5 {

export interface DepositRecordV5 {
id: string;
requestId?: string;
coin: string;
chain: string;
amount: string;
Expand Down
6 changes: 6 additions & 0 deletions src/types/response/v5-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,9 @@ export interface EventQuoteResultV5 {
orderLinkId: string;
orderId: string;
}

export interface CancelAllEventQuotesResultV5 {
list: EventQuoteResultV5[];
/** 1: success; 0: failed */
success: '1' | '0';
}
24 changes: 24 additions & 0 deletions src/types/response/v5-market.ts
Original file line number Diff line number Diff line change
Expand Up @@ -538,3 +538,27 @@ export interface OptionBaseCoinV5 {
export interface OptionBaseCoinsResultV5 {
list: OptionBaseCoinV5[];
}

export interface CorporateActionV5 {
category?: 'option';
symbol: string;
baseCoin: string;
actionType: 'ForwardSplit' | 'ReverseSplit' | 'Dividend';
status: string;
effectiveTime: number;
details: {
splitFactor?: string;
splitType?: 'FORWARD' | 'REVERSE';
dividendAmountPerShare?: string;
dividendCurrency?: string;
installmentCount?: number;
installmentAmountPerShare?: string;
installmentCoin?: string;
firstSettlementTimeUtc?: number;
installments?: {
installmentNo: number;
settlementTimeUtc: number;
status: string;
}[];
};
}
15 changes: 15 additions & 0 deletions src/types/response/v5-spot-leverage-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ export interface AutoRepayModeResultV5 {
data: AutoRepayModeItemV5[];
}

export interface TradeAutoRepayResultV5 {
/** Saved switch state. 1: enabled; 0: disabled */
autoRepay: '0' | '1';
}

export interface SpotMarginLiabilityInfoV5 {
currency: string;
totalBorrowAmount: string;
Expand Down Expand Up @@ -213,6 +218,16 @@ export interface FixedRateBorrowQuoteV5 {
qty: string;
}

export interface FixedRateBorrowInterestAccruedV5 {
refId: string;
currency: string;
orderId: string;
loanAmt: string;
interest: string;
interestRate: string;
ts: string;
}

export interface FlexibleAvailableInventoryV5 {
currency: string;
availableInventory: string;
Expand Down
2 changes: 2 additions & 0 deletions src/types/response/v5-user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ export interface ApiKeyPermissionsV5 {
FiatGlobalPay?: string[];
BitCard?: string[];
ByXPost?: string[];
/** ComplianceAppeal: TM Onchain appeals. Bybit global master read-write API keys only; [] when not granted */
Compliance?: string[];
}

export interface ApiKeyInfoV5 {
Expand Down
Loading
Loading