bybit-api
Version:
Complete & robust Node.js SDK for Bybit's REST APIs and WebSockets, with TypeScript & strong end to end tests.
2,289 lines (2,257 loc) • 412 kB
Plain Text
This file is a merged representation of a subset of the codebase, containing files not matching ignore patterns, combined into a single document by Repomix.
The content has been processed where content has been compressed (code blocks are separated by ⋮---- delimiter).
================================================================
File Summary
================================================================
Purpose:
--------
This file contains a packed representation of a subset of the repository's contents that is considered the most important context.
It is designed to be easily consumable by AI systems for analysis, code review,
or other automated processes.
File Format:
------------
The content is organized as follows:
1. This summary section
2. Repository information
3. Directory structure
4. Repository files (if enabled)
5. Multiple file entries, each consisting of:
a. A separator line (================)
b. The file path (File: path/to/file)
c. Another separator line
d. The full contents of the file
e. A blank line
Usage Guidelines:
-----------------
- This file should be treated as read-only. Any changes should be made to the
original repository files, not this packed version.
- When processing this file, use the file path to distinguish
between different files in the repository.
- Be aware that this file may contain sensitive information. Handle it with
the same level of security as you would the original repository.
Notes:
------
- Some files may have been excluded based on .gitignore rules and Repomix's configuration
- Binary files are not included in this packed representation. Please refer to the Repository Structure section for a complete list of file paths, including binary files
- Files matching these patterns are excluded: .github/, examples/apidoc/, docs/images/, docs/endpointFunctionList.md, test/, src/util/, dist/, lib/
- Files matching patterns in .gitignore are excluded
- Files matching default ignore patterns are excluded
- Content has been compressed - code blocks are separated by ⋮---- delimiter
- Files are sorted by Git change count (files with more changes are at the bottom)
================================================================
Directory Structure
================================================================
examples/
Auth/
fasterHmacSign.ts
RSA-sign.md
RSA-sign.ts
deprecated/
README.md
Rest/
demo-trading.ts
rest-v5-all.ts
rest-v5-custom-url.ts
rest-v5-next-cursor.ts
rest-v5-p2p.ts
rest-v5-private.ts
rest-v5-proxies.ts
rest-v5-proxies2.ts
rest-v5-public.ts
Websocket/
Private/
ws-private-v5.ts
Public/
ws-public-allLiquidations.ts
ws-public-v5.ts
WS-API/
ws-api-client.ts
ws-api-raw-events.ts
ws-api-raw-promises.ts
README.md
src/
constants/
enum.ts
types/
request/
account-asset.ts
contract.ts
copy-trading.ts
index.ts
inverse.ts
linear.ts
unified-margin.ts
usdc-options.ts
usdc-perp.ts
usdc-shared.ts
v5-account.ts
v5-asset.ts
v5-broker.ts
v5-crypto-loan.ts
v5-earn.ts
v5-market.ts
v5-p2p-trading.ts
v5-position.ts
v5-pre-upgrade.ts
v5-rfq.ts
v5-spot-leverage-token.ts
v5-spreadtrading.ts
v5-trade.ts
v5-user.ts
response/
account-asset.ts
contract.ts
index.ts
shared.ts
spot.ts
unified-margin.ts
usdt-perp.ts
v5-account.ts
v5-asset.ts
v5-broker.ts
v5-crypto-loan.ts
v5-earn.ts
v5-market.ts
v5-p2p-trading.ts
v5-position.ts
v5-preupgrade.ts
v5-rfq.ts
v5-spot-leverage-token.ts
v5-spreadtrading.ts
v5-trade.ts
v5-user.ts
websockets/
index.ts
ws-api.ts
ws-confirmations.ts
ws-events.ts
ws-general.ts
index.ts
shared-v5.ts
shared.ts
index.ts
rest-client-v5.ts
spot-client-v3.ts
websocket-api-client.ts
websocket-client.ts
webpack/
webpack.config.js
.eslintrc.cjs
.gitignore
.jshintrc
.nvmrc
.prettierrc
index.js
jest.config.ts
jsconfig.json
LICENSE.md
package.json
README.md
tea.yaml
tsconfig.build.json
tsconfig.examples.json
tsconfig.json
tsconfig.linting.json
tsconfig.test.json
================================================================
Files
================================================================
================
File: examples/deprecated/README.md
================
# Deprecated Examples
The examples in this folder use old/deprecated/obsolete APIs. They should all have a modern alternative.
As of December 2023, use the V5 APIs & WebSockets.
================
File: examples/README.md
================
# Examples
These samples can be executed using `ts-node`:
```
ts-node ./examples/rest-spot-public.ts
```
================
File: src/constants/enum.ts
================
/** Full take profit/stop loss mode (a single TP order and a single SL order can be placed, covering the entire position) */
⋮----
/** Partial take profit/stop loss mode (multiple TP and SL orders can be placed, covering portions of the position) */
⋮----
/** This could mean bad request, incorrect value types or even incorrect/missing values */
⋮----
/** API key requires specific whitelisted IPs, and this IP was not in the list */
⋮----
/** Account not unified margin, update required */
⋮----
/** Seen when placing an order */
⋮----
/** Seen if a conditional order is too large */
⋮----
/** E.g. trying to change position margin while on cross */
⋮----
/** E.g. USDC Options trading, trying to access a symbol that is no longer active */
⋮----
/** E.g. USDC Options trading when the account hasn't been opened for USDC Options yet */
⋮----
/**
* Position idx, used to identify positions in different position modes.
* Required if you are under One-Way Mode:
*/
export enum LinearPositionIdx {
OneWayMode = 0,
BuySide = 1,
SellSide = 2,
}
================
File: src/types/request/account-asset.ts
================
export type TransferAccountType =
| 'CONTRACT'
| 'SPOT'
| 'INVESTMENT'
| 'OPTION'
| 'UNIFIED';
⋮----
export type TransferType = 'IN' | 'OUT';
⋮----
export type TransferStatus = 'SUCCESS' | 'PENDING' | 'FAILED';
⋮----
export type PageDirection = 'Prev' | 'Next';
⋮----
export interface InternalTransferRequest {
transfer_id: string;
coin: string;
amount: string;
from_account_type: TransferAccountType;
to_account_type: TransferAccountType;
}
⋮----
export interface InternalTransferRequestV3 {
transferId: string;
coin: string;
amount: string;
fromAccountType: string;
toAccountType: string;
}
⋮----
export interface QueryInternalTransfersRequestV3 {
transferId?: string;
coin: string;
status?: string;
startTime?: number;
endTime?: number;
limit?: number;
cursor?: string;
}
⋮----
export interface SubAccountTransferRequest {
transfer_id: string;
coin: string;
amount: string;
sub_user_id: string;
type: TransferType;
}
⋮----
export interface SubAccountTransferRequestV3 {
transferId?: string;
coin?: string;
status?: string;
startTime?: number;
endTime?: number;
limit?: number;
cursor?: string;
}
⋮----
export interface TransferQueryRequest {
transfer_id?: string;
coin?: string;
status?: TransferStatus;
start_time?: number;
end_time?: number;
direction?: PageDirection;
limit?: number;
cursor?: string;
}
⋮----
export interface EnableUniversalTransferRequest {
/** A comma-separated list of subaccount UIDs, for example "123,45,14,26,46" */
transferable_sub_ids?: string;
}
⋮----
/** A comma-separated list of subaccount UIDs, for example "123,45,14,26,46" */
⋮----
export interface UniversalTransferRequest {
transfer_id: string;
coin: string;
amount: string;
from_member_id: string;
to_member_id: string;
from_account_type: TransferAccountType;
to_account_type: TransferAccountType;
}
export interface SupportedDepositListRequest {
coin?: string;
chain?: string;
page_index?: number;
page_size?: number;
}
⋮----
export interface DepositRecordsRequest {
start_time?: number;
end_time?: number;
coin?: string;
cursor?: string;
direction?: PageDirection;
limit?: number;
}
⋮----
export interface WithdrawalRecordsRequest {
withdraw_id?: number;
start_time?: number;
end_time?: number;
coin?: string;
cursor?: string;
direction?: PageDirection;
limit?: number;
}
⋮----
export interface AccountAssetInformationRequest {
/** Account type. Default value: ACCOUNT_TYPE_SPOT */
account_type?: string;
coin?: string;
}
⋮----
/** Account type. Default value: ACCOUNT_TYPE_SPOT */
⋮----
export interface WithdrawalRequest {
address: string;
amount: string;
coin: string;
chain: string;
tag?: string;
}
⋮----
export interface UniversalTransferRequestV3 {
transferId: string;
coin: string;
amount: string;
fromMemberId: string;
toMemberId: string;
fromAccountType: TransferAccountType;
toAccountType: TransferAccountType;
}
⋮----
export interface UniversalTransferListRequestV3 {
transferId?: string;
coin: string;
status?: string;
startTime?: number;
endTime?: number;
limit?: number;
cursor?: string;
}
⋮----
export interface TransferCoinListRequestV3 {
fromAccountType: TransferAccountType;
toAccountType: TransferAccountType;
}
⋮----
export interface SingleAccountCoinBalanceRequestV3 {
memberId?: string;
accountType: TransferAccountType;
coin: string;
withBonus?: '0' | '1';
}
⋮----
export interface AccountCoinBalancesRequestV3 {
memberId?: string;
accountType: TransferAccountType;
coin?: string;
withBonus?: '0' | '1';
}
⋮----
export interface AssetInfoRequestV3 {
accountType?: TransferAccountType;
coin?: string;
}
⋮----
export interface SupportedDepositListRequestV3 {
coin?: string;
chain?: string;
cursor?: string;
limit?: number;
}
⋮----
export interface DepositRecordQueryRequestV3 {
startTime?: number;
endTime?: number;
coin?: string;
cursor?: string;
limit?: number;
}
⋮----
export interface SubDepositRecordQueryRequestV3 {
subMemberId: number;
startTime?: number;
endTime?: number;
coin?: string;
cursor?: string;
limit?: number;
}
⋮----
export interface WithdrawRecordQueryRequestV3 {
withdrawID?: number;
startTime?: number;
endTime?: number;
coin?: string;
withdrawType?: string;
cursor?: string;
limit?: number;
}
⋮----
export interface WithdrawCreateRequestV3 {
coin: string;
chain: string;
address: string;
tag?: string;
amount: string;
timestamp: number;
forceChain?: 0 | 1;
}
⋮----
export interface QueryDepositAddressRequestV3 {
coin?: string;
chainType?: string;
}
⋮----
export interface QuerySubAccountDepositAddressRequestV3 {
coin?: string;
chainType?: string;
subMemberId: string;
}
⋮----
export interface CreateSubMemberRequestV3 {
username: string;
memberType: 1 | 6;
switch?: 0 | 1;
note?: string;
}
⋮----
export interface CreateSubAPIKeyRequestV3 {
subuid: string;
note?: string;
readOnly: 0 | 1;
ips?: string[];
permissions: {
ContractTrade?: string[];
Spot?: string[];
Wallet?: string[];
Options?: string[];
Derivatives?: string[];
Exchange?: string[];
};
}
⋮----
export interface ModifyAPIKeyRequestV3 {
readOnly: number;
ips?: string[];
permissions: {
ContractTrade?: string[];
Spot?: string[];
Wallet?: string[];
Options?: string[];
Derivatives?: string[];
CopyTrading?: string[];
BlockTrade?: string[];
Exchange?: string[];
NFT?: string[];
};
}
================
File: src/types/request/contract.ts
================
import { OrderSide } from '../shared';
import { UMOrderType } from './unified-margin';
import { USDCOrderFilter, USDCTimeInForce } from './usdc-shared';
⋮----
export interface ContractOrderRequest {
symbol: string;
side: OrderSide;
orderType: UMOrderType;
qty: string;
timeInForce: USDCTimeInForce;
price?: string;
triggerDirection?: '1' | '2';
triggerPrice?: string;
triggerBy?: string;
positionIdx?: '0' | '1' | '2';
orderLinkId?: string;
takeProfit?: string;
stopLoss?: string;
tpTriggerBy?: string;
slTriggerBy?: string;
reduceOnly?: boolean;
closeOnTrigger?: boolean;
tpslMode?: 'Partial' | 'Full';
tpOrderType?: UMOrderType;
slOrderType?: UMOrderType;
}
⋮----
export interface ContractHistoricOrdersRequest {
orderId?: string;
orderLinkId?: string;
symbol: string;
orderStatus?: string;
orderFilter?: USDCOrderFilter;
limit?: number;
cursor?: string;
}
⋮----
export interface ContractCancelOrderRequest {
symbol: string;
orderId?: string;
orderLinkId?: string;
}
⋮----
export interface ContractModifyOrderRequest {
symbol: string;
orderId?: string;
orderLinkId?: string;
price?: string;
qty?: string;
triggerPrice?: string;
takeProfit?: string;
stopLoss?: string;
tpTriggerBy?: string;
slTriggerBy?: string;
triggerBy?: string;
tpLimitPrice?: string;
slLimitPrice?: string;
}
⋮----
export interface ContractActiveOrdersRequest {
symbol?: string;
orderId?: string;
orderLinkId?: string;
settleCoin?: string;
orderFilter?: USDCOrderFilter;
limit?: number;
}
⋮----
export interface ContractPositionsRequest {
symbol?: string;
settleCoin?: string;
dataFilter?: string;
}
⋮----
export interface ContractSetAutoAddMarginRequest {
symbol: string;
side: 'Buy' | 'Sell';
autoAddMargin: 1 | 0;
positionIdx?: 0 | 1 | 2;
}
⋮----
export interface ContractSetMarginSwitchRequest {
symbol: string;
tradeMode: 0 | 1;
buyLeverage: string;
sellLeverage: string;
}
⋮----
export interface ContractSetPositionModeRequest {
symbol?: string;
coin?: string;
mode: 0 | 3;
}
⋮----
export interface ContractSetTPSLRequest {
symbol: string;
takeProfit?: string;
stopLoss?: string;
tpslMode?: 'Full' | 'Partial';
tpSize?: string;
slSize?: string;
tpTriggerBy?: string;
slTriggerBy?: string;
trailingStop?: string;
activePrice?: string;
tpLimitPrice?: string;
slLimitPrice?: string;
tpOrderType?: UMOrderType;
slOrderType?: UMOrderType;
/** 0-one-way, 1-buy side, 2-sell side */
positionIdx?: 0 | 1 | 2;
}
⋮----
/** 0-one-way, 1-buy side, 2-sell side */
⋮----
export interface ContractUserExecutionHistoryRequest {
symbol: string;
orderId?: string;
startTime?: number;
endTime?: number;
execType?: 'Trade' | 'AdlTrade' | 'Funding' | 'BustTrade';
limit?: number;
cursor?: string;
}
⋮----
export interface ContractClosedPNLRequest {
symbol: string;
startTime?: number;
endTime?: number;
limit?: number;
cursor?: string;
}
⋮----
export interface ContractWalletFundRecordRequest {
startTime?: string;
endTime?: string;
coin?: string;
walletFundType?: string;
limit?: string;
cursor?: string;
}
================
File: src/types/request/copy-trading.ts
================
import { OrderSide } from '../shared';
import { USDCOrderType } from './usdc-shared';
⋮----
export interface CopyTradingOrderRequest {
side: OrderSide;
symbol: string;
orderType: USDCOrderType;
price: string;
qty: string;
takeProfit?: string;
stopLoss?: string;
tpTriggerBy?: string;
slTriggerBy?: string;
orderLinkId?: string;
}
⋮----
export interface CopyTradingTradingStopRequest {
symbol: string;
parentOrderId: string;
takeProfit?: string;
stopLoss?: string;
tpTriggerBy?: string;
slTriggerBy?: string;
parentOrderLinkId?: string;
}
⋮----
export interface CopyTradingOrderListRequest {
symbol?: string;
orderId?: string;
orderLinkId?: string;
copyTradeOrderType?: string;
}
⋮----
export interface CopyTradingCancelOrderRequest {
symbol: string;
orderId?: string;
orderLinkId?: string;
}
⋮----
export interface CopyTradingCloseOrderRequest {
symbol: string;
orderLinkId?: string;
parentOrderId?: string;
parentOrderLinkId?: string;
}
⋮----
export interface CopyTradingTransferRequest {
transferId: string;
coin: string;
amount: string;
fromAccountType: string;
toAccountType: string;
}
================
File: src/types/request/inverse.ts
================
export interface InverseOrderRequest {
side: string;
symbol: string;
order_type: string;
qty: number;
price?: number;
time_in_force: string;
take_profit?: number;
stop_loss?: number;
reduce_only?: boolean;
tp_trigger_by?: 'LastPrice' | 'MarkPrice' | 'IndexPrice';
sl_trigger_by?: 'LastPrice' | 'MarkPrice' | 'IndexPrice';
close_on_trigger?: boolean;
order_link_id?: string;
}
⋮----
export interface InverseActiveOrdersRequest {
symbol: string;
order_status?: string;
direction?: string;
limit?: number;
cursor?: string;
}
⋮----
export interface InverseCancelOrderRequest {
symbol: string;
order_id?: string;
order_link_id?: string;
}
⋮----
export interface InverseReplaceOrderRequest {
order_id?: string;
order_link_id?: string;
symbol: string;
p_r_qty?: number;
p_r_price?: string;
take_profit?: number;
stop_loss?: number;
tp_trigger_by?: string;
sl_trigger_by?: string;
}
⋮----
export interface InverseGetOrderRequest {
order_id?: string;
order_link_id?: string;
symbol: string;
}
⋮----
export interface InverseConditionalOrderRequest {
side: string;
symbol: string;
order_type: string;
qty: string;
price?: string;
base_price: string;
stop_px: string;
time_in_force: string;
trigger_by?: string;
close_on_trigger?: boolean;
order_link_id?: string;
}
⋮----
export interface InverseActiveConditionalOrderRequest {
symbol: string;
stop_order_status?: string;
direction?: string;
limit?: number;
cursor?: string;
}
⋮----
export interface InverseCancelConditionalOrderRequest {
symbol: string;
stop_order_id?: string;
order_link_id?: string;
}
⋮----
export interface InverseReplaceConditionalOrderRequest {
stop_order_id?: string;
order_link_id?: string;
symbol: string;
p_r_qty?: number;
p_r_price?: string;
p_r_trigger_price?: string;
}
⋮----
export interface InverseChangePositionMarginRequest {
symbol: string;
margin: string;
}
⋮----
export interface InverseSetTradingStopRequest {
symbol: string;
take_profit?: number;
stop_loss?: number;
trailing_stop?: number;
tp_trigger_by?: string;
sl_trigger_by?: string;
new_trailing_active?: number;
}
⋮----
export interface InverseSetLeverageRequest {
symbol: string;
leverage: number;
leverage_only?: boolean;
}
⋮----
export interface InverseGetTradeRecordsRequest {
order_id?: string;
symbol: string;
start_time?: number;
page?: number;
limit?: number;
order?: string;
}
⋮----
export interface InverseGetClosedPnlRequest {
symbol: string;
start_time?: number;
end_time?: number;
exec_type?: string;
page?: number;
limit?: number;
}
⋮----
export interface InverseSetSlTpPositionModeRequest {
symbol: string;
tp_sl_mode: 'Full' | 'Partial';
}
⋮----
export interface InverseSetMarginTypeRequest {
symbol: string;
is_isolated: boolean;
buy_leverage: number;
sell_leverage: number;
}
================
File: src/types/request/linear.ts
================
import {
LinearPositionIdx,
linearPositionModeEnum,
positionTpSlModeEnum,
} from '../../constants/enum';
import { OrderSide } from '../shared';
⋮----
export interface LinearGetOrdersRequest {
order_id?: string;
order_link_id?: string;
symbol: string;
order?: string;
page?: number;
limit?: number;
order_status?: string;
}
⋮----
export interface LinearCancelOrderRequest {
symbol: string;
order_id?: string;
order_link_id?: string;
}
⋮----
export interface LinearReplaceOrderRequest {
order_id?: string;
order_link_id?: string;
symbol: string;
p_r_qty?: number;
p_r_price?: number;
take_profit?: number;
stop_loss?: number;
tp_trigger_by?: string;
sl_trigger_by?: string;
}
⋮----
export interface LinearGetOrderRequest {
order_id?: string;
order_link_id?: string;
symbol: string;
}
⋮----
export type LinearOrderType = 'Limit' | 'Market';
⋮----
export type LinearTimeInForce =
| 'GoodTillCancel'
| 'ImmediateOrCancel'
| 'FillOrKill'
| 'PostOnly';
⋮----
export interface NewLinearOrder {
side: OrderSide;
symbol: string;
order_type: LinearOrderType;
qty: number;
price?: number;
time_in_force: LinearTimeInForce;
take_profit?: number;
stop_loss?: number;
tp_trigger_by?: string;
sl_trigger_by?: string;
reduce_only: boolean;
close_on_trigger: boolean;
order_link_id?: string;
position_idx?: LinearPositionIdx;
}
⋮----
export interface LinearConditionalOrderRequest {
side: string;
symbol: string;
order_type: string;
qty: number;
price?: number;
base_price: number;
stop_px: number;
time_in_force: string;
trigger_by?: string;
close_on_trigger?: boolean;
order_link_id?: string;
reduce_only: boolean;
take_profit?: number;
stop_loss?: number;
tp_trigger_by?: string;
sl_trigger_by?: string;
}
⋮----
export interface LinearGetConditionalOrderRequest {
stop_order_id?: string;
order_link_id?: string;
symbol: string;
stop_order_status?: string;
order?: string;
page?: number;
limit?: number;
}
⋮----
export interface LinearCancelConditionalOrderRequest {
symbol: string;
stop_order_id?: string;
order_link_id?: string;
}
⋮----
export interface LinearReplaceConditionalOrderRequest {
stop_order_id?: string;
order_link_id?: string;
symbol: string;
p_r_qty?: number;
p_r_price?: number;
p_r_trigger_price?: number;
take_profit?: number;
stop_loss?: number;
tp_trigger_by?: string;
sl_trigger_by?: string;
}
⋮----
export interface LinearQueryConditionalOrderRequest {
symbol: string;
stop_order_id?: string;
order_link_id?: string;
}
⋮----
export interface LinearSetAutoAddMarginRequest {
symbol: string;
side: string;
auto_add_margin: boolean;
}
⋮----
export interface LinearSetMarginSwitchRequest {
symbol: string;
is_isolated: boolean;
buy_leverage: number;
sell_leverage: number;
}
⋮----
export interface LinearSetPositionModeRequest {
symbol: string;
mode: (typeof linearPositionModeEnum)[keyof typeof linearPositionModeEnum];
}
⋮----
export interface LinearSetPositionTpSlModeRequest {
symbol: string;
tp_sl_mode: (typeof positionTpSlModeEnum)[keyof typeof positionTpSlModeEnum];
}
⋮----
export interface LinearSetAddReduceMarginRequest {
symbol: string;
side: string;
margin: number;
}
⋮----
export interface LinearSetUserLeverageRequest {
symbol: string;
buy_leverage: number;
sell_leverage: number;
}
⋮----
export interface LinearSetTradingStopRequest {
symbol: string;
side: string;
take_profit?: number;
stop_loss?: number;
trailing_stop?: number;
tp_trigger_by?: string;
sl_trigger_by?: string;
sl_size?: number;
tp_size?: number;
position_idx?: 0 | 1 | 2;
}
⋮----
export interface LinearGetTradeRecordsRequest {
symbol: string;
start_time?: number;
end_time?: number;
exec_type?: string;
page?: number;
limit?: number;
}
⋮----
export interface LinearGetHistoryTradeRecordsRequest {
symbol: string;
start_time?: number;
end_time?: number;
exec_type?: string;
page?: number;
limit?: number;
page_token?: string;
}
⋮----
export interface LinearGetClosedPnlRequest {
symbol: string;
start_time?: number;
end_time?: number;
exec_type?: string;
page?: number;
limit?: number;
}
⋮----
export interface LinearSetRiskLimitRequest {
symbol: string;
side: string;
risk_id: number;
}
================
File: src/types/request/unified-margin.ts
================
import { KlineIntervalV3, OrderSide } from '../shared';
import { USDCOrderFilter, USDCTimeInForce } from './usdc-shared';
⋮----
export type UMCategory = 'linear' | 'inverse' | 'option';
export type UMOrderType = 'Limit' | 'Market';
export type UMDirection = 'prev' | 'next';
⋮----
export interface UMCandlesRequest {
category: UMCategory;
symbol: string;
interval: KlineIntervalV3;
start: number;
end: number;
limit?: number;
}
⋮----
export interface UMInstrumentInfoRequest {
category: UMCategory;
symbol?: string;
baseCoin?: string;
limit?: string;
cursor?: string;
}
⋮----
export interface UMFundingRateHistoryRequest {
category: UMCategory;
symbol: string;
startTime?: number;
endTime?: number;
limit?: number;
}
⋮----
export interface UMOptionDeliveryPriceRequest {
category: UMCategory;
symbol?: string;
baseCoin?: string;
direction?: UMDirection;
limit?: string;
cursor?: string;
}
⋮----
export interface UMPublicTradesRequest {
category: UMCategory;
symbol: string;
baseCoin?: string;
optionType?: 'Call' | 'Put';
limit?: string;
}
⋮----
export interface UMOpenInterestRequest {
category: UMCategory;
symbol: string;
interval: '5min' | '15min' | '30min' | '1h' | '4h' | '1d';
startTime?: number;
endTime?: number;
limit?: number;
}
⋮----
export interface UMOrderRequest {
category: UMCategory;
symbol: string;
side: OrderSide;
positionIdx?: '0' | '1' | '2';
orderType: UMOrderType;
qty: string;
price?: string;
basePrice?: string;
triggerPrice?: string;
triggerBy?: string;
iv?: string;
timeInForce: USDCTimeInForce;
orderLinkId?: string;
takeProfit?: number;
stopLoss?: number;
tpTriggerBy?: string;
slTriggerBy?: string;
reduceOnly?: boolean;
closeOnTrigger?: boolean;
mmp?: boolean;
}
⋮----
export interface UMModifyOrderRequest {
category: UMCategory;
symbol: string;
orderId?: string;
orderLinkId?: string;
iv?: string;
triggerPrice?: string;
qty?: string;
price?: string;
takeProfit?: number;
stopLoss?: number;
tpTriggerBy?: string;
slTriggerBy?: string;
triggerBy?: string;
}
⋮----
export interface UMCancelOrderRequest {
category: UMCategory;
symbol: string;
orderId?: string;
orderLinkId?: string;
orderFilter?: USDCOrderFilter;
}
⋮----
export interface UMActiveOrdersRequest {
category: UMCategory;
symbol?: string;
baseCoin?: string;
orderId?: string;
orderLinkId?: string;
orderFilter?: USDCOrderFilter;
direction?: UMDirection;
limit?: number;
cursor?: string;
}
⋮----
export interface UMHistoricOrdersRequest {
category: UMCategory;
symbol?: string;
baseCoin?: string;
orderId?: string;
orderLinkId?: string;
orderStatus?: string;
orderFilter?: USDCOrderFilter;
direction?: UMDirection;
limit?: number;
cursor?: string;
}
⋮----
export interface UMBatchOrder {
symbol: string;
side: OrderSide;
positionIdx?: '0';
orderType: UMOrderType;
qty: string;
price?: string;
iv?: string;
timeInForce: USDCTimeInForce;
orderLinkId?: string;
reduceOnly?: boolean;
closeOnTrigger?: boolean;
mmp?: boolean;
}
⋮----
export interface UMBatchOrderReplace {
symbol: string;
orderId?: string;
orderLinkId?: string;
iv?: string;
qty?: string;
price?: string;
}
⋮----
export interface UMBatchOrderCancel {
symbol: string;
orderId?: string;
orderLinkId?: string;
}
⋮----
export interface UMCancelAllOrdersRequest {
category: UMCategory;
baseCoin?: string;
settleCoin?: string;
symbol?: string;
orderFilter?: USDCOrderFilter;
}
⋮----
export interface UMPositionsRequest {
category: UMCategory;
symbol?: string;
baseCoin?: string;
direction?: UMDirection;
limit?: number;
cursor?: string;
}
⋮----
export interface UMSetTPSLRequest {
category: UMCategory;
symbol: string;
takeProfit?: string;
stopLoss?: string;
trailingStop?: string;
tpTriggerBy?: string;
slTriggerBy?: string;
activePrice?: string;
slSize?: string;
tpSize?: string;
positionIdx?: '0';
}
⋮----
export interface UM7DayTradingHistoryRequest {
category: UMCategory;
symbol: string;
baseCoin?: string;
orderId?: string;
orderLinkId?: string;
startTime?: number;
endTime?: number;
direction?: UMDirection;
limit?: number;
cursor?: string;
execType?: string;
}
⋮----
export interface UMOptionsSettlementHistoryRequest {
category: UMCategory;
symbol?: string;
expDate?: string;
direction?: UMDirection;
limit?: number;
cursor?: string;
}
⋮----
export interface UMPerpSettlementHistoryRequest {
category: UMCategory;
symbol?: string;
direction?: UMDirection;
limit?: number;
cursor?: string;
}
⋮----
export interface UMTransactionLogRequest {
category: UMCategory;
currency: string;
baseCoin?: string;
type?: string;
startTime?: number;
endTime?: number;
direction?: UMDirection;
limit?: number;
cursor?: string;
}
⋮----
export interface UMExchangeCoinsRequest {
fromCoin?: string;
toCoin?: string;
}
⋮----
export interface UMBorrowHistoryRequest {
currency: string;
startTime?: number;
endTime?: number;
direction?: UMDirection;
limit?: number;
cursor?: string;
}
================
File: src/types/request/usdc-options.ts
================
import { OrderSide } from '../shared';
import { USDCAPICategory, USDCOrderType, USDCTimeInForce } from './usdc-shared';
⋮----
export interface USDCOptionsContractInfoRequest {
symbol?: string;
status?: 'WAITING_ONLINE' | 'ONLINE' | 'DELIVERING' | 'OFFLINE';
baseCoin?: string;
direction?: string;
limit?: string;
cursor?: string;
}
⋮----
export interface USDCOptionsDeliveryPriceRequest {
symbol?: string;
baseCoin?: string;
direction?: string;
limit?: string;
cursor?: string;
}
⋮----
export interface USDCOptionsRecentTradesRequest {
category: USDCAPICategory;
symbol?: string;
baseCoin?: string;
optionType?: 'Call' | 'Put';
limit?: string;
}
⋮----
export interface USDCOptionsHistoricalVolatilityRequest {
baseCoin?: string;
period?: string;
startTime?: string;
endTime?: string;
}
⋮----
export interface USDCOptionsOrderRequest {
symbol: string;
orderType: USDCOrderType;
side: OrderSide;
orderPrice?: string;
orderQty: string;
iv?: string;
timeInForce?: USDCTimeInForce;
orderLinkId?: string;
reduceOnly?: boolean;
}
⋮----
export interface USDCOptionsModifyOrderRequest {
symbol: string;
orderId?: string;
orderLinkId?: string;
orderPrice?: string;
orderQty?: string;
iv?: string;
}
⋮----
export interface USDCOptionsCancelOrderRequest {
symbol: string;
orderId?: string;
orderLinkId?: string;
}
⋮----
export interface USDCOptionsCancelAllOrdersRequest {
symbol?: string;
baseCoin?: string;
}
⋮----
export interface USDCOptionsActiveOrdersRealtimeRequest {
orderId?: string;
orderLinkId?: string;
symbol?: string;
baseCoin?: string;
direction?: string;
limit?: number;
cursor?: string;
}
⋮----
export interface USDCOptionsActiveOrdersRequest {
category: 'OPTION';
symbol?: string;
baseCoin?: string;
orderId?: string;
orderLinkId?: string;
direction?: string;
limit?: number;
cursor?: string;
}
⋮----
export interface USDCOptionsHistoricOrdersRequest {
category: 'OPTION';
symbol?: string;
baseCoin?: string;
orderId?: string;
orderLinkId?: string;
orderStatus?: string;
direction?: string;
limit?: number;
cursor?: string;
}
⋮----
export interface USDCOptionsOrderExecutionRequest {
category: 'OPTION';
symbol?: string;
baseCoin?: string;
orderId?: string;
orderLinkId?: string;
startTime?: string;
direction?: string;
limit?: number;
cursor?: string;
}
⋮----
export interface USDCOptionsDeliveryHistoryRequest {
symbol: string;
expDate?: string;
direction?: string;
limit?: string;
cursor?: string;
}
⋮----
export interface USDCOptionsPositionsInfoExpiryRequest {
expDate?: string;
direction?: string;
limit?: string;
cursor?: string;
}
⋮----
export interface USDCOptionsModifyMMPRequest {
currency: string;
windowMs: number;
frozenPeriodMs: number;
qtyLimit: string;
deltaLimit: string;
}
================
File: src/types/request/usdc-perp.ts
================
import { OrderSide } from '../shared';
import {
USDCAPICategory,
USDCOrderFilter,
USDCOrderType,
USDCTimeInForce,
} from './usdc-shared';
⋮----
export interface USDCOpenInterestRequest {
symbol: string;
period: string;
limit?: number;
}
⋮----
export interface USDCLast500TradesRequest {
category: USDCAPICategory;
symbol?: string;
baseCoin?: string;
limit?: string;
}
⋮----
export interface USDCSymbolDirectionLimit {
symbol?: string;
direction?: string;
limit?: string;
}
⋮----
export interface USDCSymbolDirectionLimitCursor {
symbol?: string;
direction?: string;
limit?: string;
cursor?: string;
}
⋮----
export interface USDCPerpOrderRequest {
symbol: string;
orderType: USDCOrderType;
orderFilter: USDCOrderFilter;
side: OrderSide;
orderPrice?: string;
orderQty: string;
timeInForce?: USDCTimeInForce;
orderLinkId?: string;
reduceOnly?: boolean;
closeOnTrigger?: boolean;
takeProfit?: string;
stopLoss?: string;
tptriggerby?: string;
slTriggerBy?: string;
basePrice?: string;
triggerPrice?: string;
triggerBy?: string;
mmp?: boolean;
}
⋮----
export interface USDCPerpModifyOrderRequest {
symbol: string;
orderFilter: USDCOrderFilter;
orderId?: string;
orderLinkId?: string;
orderPrice?: string;
orderQty?: string;
takeProfit?: string;
stopLoss?: string;
tptriggerby?: string;
slTriggerBy?: string;
triggerPrice?: string;
}
⋮----
export interface USDCPerpCancelOrderRequest {
symbol: string;
orderFilter: USDCOrderFilter;
orderId?: string;
orderLinkId?: string;
}
⋮----
export interface USDCPerpActiveOrdersRequest {
category: 'PERPETUAL';
symbol?: string;
baseCoin?: string;
orderId?: string;
orderLinkId?: string;
orderFilter?: USDCOrderFilter;
direction?: string;
limit?: number;
cursor?: string;
}
⋮----
export interface USDCPerpHistoricOrdersRequest {
category: 'PERPETUAL';
symbol?: string;
baseCoin?: string;
orderId?: string;
orderLinkId?: string;
orderStatus?: string;
orderFilter?: USDCOrderFilter;
direction?: string;
limit?: number;
cursor?: string;
}
================
File: src/types/request/usdc-shared.ts
================
export type USDCAPICategory = 'PERPETUAL' | 'OPTION';
⋮----
export type USDCOrderType = 'Limit' | 'Market';
⋮----
export type USDCTimeInForce =
| 'GoodTillCancel'
| 'ImmediateOrCancel'
| 'FillOrKill'
| 'PostOnly';
⋮----
export type USDCOrderFilter = 'Order' | 'StopOrder';
⋮----
export interface USDCKlineRequest {
symbol: string;
period: string;
startTime: number;
limit?: string;
}
⋮----
export interface USDCTransactionLogRequest {
type: string;
baseCoin?: string;
startTime?: string;
endTime?: string;
direction?: string;
limit?: string;
cursor?: string;
category?: USDCAPICategory;
}
⋮----
export interface USDCPositionsRequest {
category: USDCAPICategory;
symbol?: string;
baseCoin?: string;
expDate?: string;
direction?: string;
limit?: string;
cursor?: string;
}
================
File: src/types/request/v5-broker.ts
================
export interface GetExchangeBrokerEarningsParamsV5 {
bizType?: 'SPOT' | 'DERIVATIVES' | 'OPTIONS' | 'CONVERT';
begin?: string;
end?: string;
uid?: string;
limit?: number;
cursor?: string;
}
⋮----
export interface GetBrokerSubAccountDepositsV5 {
id?: string;
txID?: string;
subMemberId?: string;
coin?: string;
startTime?: number;
endTime?: number;
limit?: number;
cursor?: string;
}
⋮----
export interface IssueVoucherParamsV5 {
accountId: string;
awardId: string;
specCode: string;
amount: string;
brokerId: string;
}
⋮----
export interface GetBrokerIssuedVoucherParamsV5 {
accountId: string;
awardId: string;
specCode: string;
withUsedAmount?: boolean;
}
================
File: src/types/request/v5-p2p-trading.ts
================
export interface GetP2PAccountCoinsBalanceParamsV5 {
memberId?: string;
accountType: string;
coin?: string;
withBonus?: 0 | 1;
}
⋮----
export interface GetP2POnlineAdsParamsV5 {
tokenId: string;
currencyId: string;
side: '0' | '1'; // 0: buy; 1: sell
page?: string;
size?: string;
}
⋮----
side: '0' | '1'; // 0: buy; 1: sell
⋮----
export interface P2PTradingPreferenceSetV5 {
hasUnPostAd?: 0 | 1;
isKyc?: 0 | 1;
isEmail?: 0 | 1;
isMobile?: 0 | 1;
hasRegisterTime?: 0 | 1;
registerTimeThreshold?: number;
orderFinishNumberDay30?: number;
completeRateDay30?: string;
nationalLimit?: string;
hasOrderFinishNumberDay30?: 0 | 1;
hasCompleteRateDay30?: 0 | 1;
hasNationalLimit?: 0 | 1;
}
⋮----
export interface CreateP2PAdParamsV5 {
tokenId: string;
currencyId: string;
side: '0' | '1'; // 0: buy; 1: sell
priceType: '0' | '1'; // 0: fixed rate; 1: floating rate
premium: string;
price: string;
minAmount: string;
maxAmount: string;
remark: string;
tradingPreferenceSet: P2PTradingPreferenceSetV5;
paymentIds: string[];
quantity: string;
paymentPeriod: string;
itemType: 'ORIGIN' | 'BULK';
}
⋮----
side: '0' | '1'; // 0: buy; 1: sell
priceType: '0' | '1'; // 0: fixed rate; 1: floating rate
⋮----
export interface UpdateP2PAdParamsV5 {
id: string;
priceType: '0' | '1'; // 0: fixed rate; 1: floating rate
premium: string;
price: string;
minAmount: string;
maxAmount: string;
remark: string;
tradingPreferenceSet: P2PTradingPreferenceSetV5;
paymentIds: string[];
actionType: 'MODIFY' | 'ACTIVE'; // MODIFY: modify adv; ACTIVE: reonline adv
quantity: string;
paymentPeriod: string;
itemType?: 'ORIGIN' | 'BULK';
subsidyAd?: boolean;
securityRiskToken?: string;
}
⋮----
priceType: '0' | '1'; // 0: fixed rate; 1: floating rate
⋮----
actionType: 'MODIFY' | 'ACTIVE'; // MODIFY: modify adv; ACTIVE: reonline adv
⋮----
export interface GetP2PPersonalAdsParamsV5 {
itemId?: string;
status?: '1' | '2'; // 1: Sold Out; 2: Available
side?: '0' | '1'; // 0: buy; 1: sell
tokenId?: string;
page?: string;
size?: string;
currencyId?: string;
}
⋮----
status?: '1' | '2'; // 1: Sold Out; 2: Available
side?: '0' | '1'; // 0: buy; 1: sell
⋮----
export interface GetP2POrdersParamsV5 {
status?: number;
beginTime?: string;
endTime?: string;
tokenId?: string;
side?: number[];
page: number;
size: number;
}
⋮----
export interface GetP2PPendingOrdersParamsV5 {
status?: number;
beginTime?: string;
endTime?: string;
tokenId?: string;
side?: number[];
page: number;
size: number;
}
⋮----
export interface MarkP2POrderAsPaidParamsV5 {
orderId: string;
paymentType: string;
paymentId: string;
}
⋮----
export interface SendP2POrderMessageParamsV5 {
message: string;
contentType: string;
orderId: string;
msgUuid?: string;
fileName?: string;
}
⋮----
export interface GetP2POrderMessagesParamsV5 {
orderId: string;
currentPage?: string;
size: string;
}
⋮----
export interface GetP2PCounterpartyUserInfoParamsV5 {
originalUid: string;
orderId: string;
}
================
File: src/types/request/v5-pre-upgrade.ts
================
import { ExecTypeV5 } from '../shared-v5';
⋮----
export interface GetPreUpgradeOrderHistoryParamsV5 {
category: 'linear' | 'inverse';
symbol?: string;
baseCoin?: string;
orderId?: string;
orderLinkId?: string;
orderFilter?: 'Order' | 'StopOrder';
orderStatus?: string;
startTime?: number;
endTime?: number;
limit?: number;
cursor?: string;
}
⋮----
export interface GetPreUpgradeTradeHistoryParamsV5 {
category: 'linear' | 'inverse';
symbol?: string;
orderId?: string;
orderLinkId?: string;
baseCoin?: string;
startTime?: number;
endTime?: number;
execType?: ExecTypeV5;
limit?: number;
cursor?: string;
}
⋮----
export interface GetPreUpgradeClosedPnlParamsV5 {
category: 'linear' | 'inverse';
symbol: string;
startTime?: number;
endTime?: number;
limit?: number;
cursor?: string;
}
⋮----
export interface GetPreUpgradeTransactionLogParamsV5 {
category: 'linear' | 'option';
baseCoin?: string;
type?: string;
startTime?: number;
endTime?: number;
limit?: number;
cursor?: string;
}
⋮----
export interface GetPreUpgradeOptionDeliveryRecordParamsV5 {
category: 'option';
symbol?: string;
expDate?: string;
limit?: number;
cursor?: string;
}
⋮----
export interface GetPreUpgradeUSDCSessionParamsV5 {
category: 'linear';
symbol?: string;
limit?: number;
cursor?: string;
}
================
File: src/types/request/v5-spreadtrading.ts
================
export interface GetSpreadInstrumentsInfoParamsV5 {
symbol?: string;
baseCoin?: string;
limit?: number;
cursor?: string;
}
⋮----
export interface SubmitSpreadOrderParamsV5 {
symbol: string;
side: 'Buy' | 'Sell';
orderType: 'Limit' | 'Market';
qty: string;
price: string;
orderLinkId: string;
timeInForce: 'IOC' | 'FOK' | 'GTC' | 'PostOnly';
}
⋮----
export interface AmendSpreadOrderParamsV5 {
symbol: string;
orderId?: string;
orderLinkId?: string;
qty?: string;
price?: string;
}
⋮----
export interface GetSpreadOpenOrdersParamsV5 {
symbol?: string;
baseCoin?: string;
orderId?: string;
orderLinkId?: string;
limit?: number;
cursor?: string;
}
export interface GetSpreadOrderHistoryParamsV5 {
symbol?: string;
baseCoin?: string;
orderId?: string;
orderLinkId?: string;
startTime?: number;
endTime?: number;
limit?: number;
cursor?: string;
}
⋮----
export interface GetSpreadTradeHistoryParamsV5 {
symbol?: string;
orderId?: string;
orderLinkId?: string;
startTime?: number;
endTime?: number;
limit?: number;
cursor?: string;
}
================
File: src/types/response/account-asset.ts
================
export interface UniversalTransferCreateResponse {
transferId: string;
}
⋮----
export interface UniversalTransferListResponseV3 {
list: {
transferId: string;
coin: string;
amount: string;
timestamp: string;
status: string;
fromAccountType: string;
toAccountType: string;
fromMemberId: string;
toMemberId: string;
}[];
nextPageCursor: string;
}
⋮----
export interface QueryInternalTransferSResponseV3 {
list: {
transferId: string;
coin: string;
amount: string;
fromAccountType: string;
toAccountType: string;
timestamp: string;
status: string;
}[];
nextPageCursor: string;
}
⋮----
export interface SubAccountTransferResponseV3 {
list: {
transferId: string;
coin: string;
amount: string;
memberId: number;
subMemberId: number;
timestamp: string;
status: string;
type: 'IN' | 'OUT';
}[];
nextPageCursor: string;
}
⋮----
export interface AccountCoinBalanceResponseV3 {
accountType: string;
bizType: number;
accountId: string;
memberId: string;
balance: {
coin: string;
walletBalance: string;
transferBalance: string;
bonus: string;
};
}
⋮----
export interface AccountCoinBalancesResponseV3 {
accountType: string;
memberId: string;
balance: {
coin: string;
walletBalance: string;
transferBalance: string;
bonus: string;
}[];
}
⋮----
export interface AssetInfoResponseV3 {
spot: {
status: 'ACCOUNT_STATUS_NORMAL' | 'ACCOUNT_STATUS_UNSPECIFIED';
assets: {
coin: string;
frozen: string;
free: string;
withdraw: string;
}[];
};
}
⋮----
interface SupportedDepositV3 {
coin: string;
chain: string;
coinShowName: string;
chainType: string;
blockConfirmNumber: number;
minDepositAmount: string;
}
⋮----
export interface SupportedDepositListResponseV3 {
configList: SupportedDepositV3[];
nextPageCursor: string;
}
⋮----
interface DepositRecordV3 {
coin: string;
chain: string;
amount: string;
txID: string;
status: number;
toAddress: string;
tag: string;
depositFee: string;
successAt: string;
confirmations: string;
txIndex: string;
blockHash: string;
}
⋮----
export interface DepositRecordQueryResponseV3 {
rows: DepositRecordV3[];
nextPageCursor: string;
}
⋮----
export interface WithdrawRecordsQueryResponseV3 {
rows: {
coin: string;
chain: string;
amount: string;
txID: string;
status: number;
toAddress: string;
tag: string;
withdrawFee: string;
createTime: string;
updateTime: string;
withdrawId: string;
withdrawType: number;
}[];
nextPageCursor: string;
}
⋮----
export interface CoinInfoV3 {
name: string;
coin: string;
remainAmount: string;
chains: {
chainType: string;
confirmation: string;
withdrawFee: string;
depositMin: string;
withdrawMin: string;
chain: string;
chainDeposit: string;
chainWithdraw: string;
minAccuracy: string;
}[];
}
⋮----
export interface CoinInfoQueryResponseV3 {
rows: CoinInfoV3[];
}
⋮----
export interface DepositAddressChainV3 {
chainType: string;
addressDeposit: string;
tagDeposit: string;
chain: string;
}
⋮----
export interface DepositAddressResponseV3 {
coin: string;
chains: DepositAddressChainV3[];
}
⋮----
export interface CreateSubMemberResponseV3 {
uid: number;
username: string;
memberType: 1 | 6;
switch: 0 | 1;
note: string;
}
⋮----
export interface CreateSubAPIKeyResponseV3 {
id: string;
note: string;
apiKey: string;
readOnly: string;
secret: string;
permissions: {
ContractTrade: string[];
Spot: string[];
Wallet: string[];
Options: string[];
Derivatives: string[];
CopyTrading: string[];
BlockTrade: string[];
Exchange: string[];
NFT: string[];
};
}
⋮----
export interface SubMemberV3 {
uid: string;
username: string;
memberType: 1 | 6;
status: 1 | 2 | 4;
remark: string;
}
⋮----
export interface SubMemberResponseV3 {
subMembers: SubMemberV3[];
}
⋮----
export interface APIKeyInfoV3 {
id: string;
note: string;
apiKey: string;
readOnly: string;
secret: string;
permissions: {
ContractTrade: string[];
Spot: string[];
Wallet: string[];
Options: string[];
Derivatives: string[];
CopyTrading: string[];
BlockTrade: string[];
Exchange: string[];
NFT: string[];
};
ips: string[];
type: number;
deadlineDay: number;
expiredAt: string;
createdAt: string;
unified: number;
uta: number;
userID: number;
inviterID: number;
vipLevel: string;
mktMakerLevel: string;
affiliateID: number;
}
================
File: src/types/response/contract.ts
================
/* eslint-disable @typescript-eslint/no-explicit-any */
export interface PaginatedResult<TList = any> {
nextPageCursor: string;
list: TList[];
}
export interface ContractListResult<TList = any> {
category: string;
list: TList[];
}
⋮----
export interface ContractHistoricOrder {
symbol: string;
orderId: string;
orderLinkId: string;
side: string;
orderType: string;
price: string;
iv: string;
qty: string;
timeInForce: string;
orderStatus: string;
positionIdx: number;
lastPriceOnCreated: string;
createdTime: string;
updatedTime: string;
cancelType: string;
rejectReason: string;
stopOrderType: string;
triggerDirection: number;
triggerBy: string;
triggerPrice: string;
cumExecValue: string;
cumExecFee: string;
cumExecQty: string;
leavesValue: string;
leavesQty: string;
takeProfit: string;
stopLoss: string;
tpslMode: string;
tpLimitPrice: string;
slLimitPrice: string;
tpTriggerBy: string;
slTriggerBy: string;
reduceOnly: boolean;
closeOnTrigger: boolean;
blockTradeId: string;
smpType: string;
smpGroup: number;
smpOrderId: string;
}
⋮----
export interface ContractSymbolTicker {
symbol: string;
bidPrice: string;
askPrice: string;
lastPrice: string;
lastTickDirection: string;
prevPrice24h: string;
price24hPcnt: string;
highPrice24h: string;
lowPrice24h: string;
prevPrice1h: string;
markPrice: string;
indexPrice: string;
openInterest: string;
turnover24h: string;
volume24h: string;
fundingRate: string;
nextFundingTime: string;
predictedDeliveryPrice: string;
basisRate: string;
deliveryFeeRate: string;
deliveryTime: string;
}
================
File: src/types/response/shared.ts
================
export interface SymbolWalletBalance {
equity: number;
available_balance: number;
used_margin: number;
order_margin: number;
position_margin: number;
occ_closing_fee: number;
occ_funding_fee: number;
wallet_balance: number;
realised_pnl: number;
unrealised_pnl: number;
cum_realised_pnl: number;
given_cash: number;
service_cash: number;
}
⋮----
export interface WalletBalances {
[symbol: string]: SymbolWalletBalance | undefined;
}
================
File: src/types/response/spot.ts
================
export interface SpotBalance {
coin: string;
coinId: string;
coinName: string;
total: string;
free: string;
locked: string;
}
⋮----
export interface SpotBalances {
balances: SpotBalance[];
}
⋮----
export interface SpotLastPrice {
symbol: string;
price: string;
}
================
File: src/types/response/unified-margin.ts
================
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export interface UMPaginatedResult<List = any> {
nextPageCursor: string;
category: string;
list: List[];
}
⋮----
export interface UMLeverageFilter {
minLeverage: string;
maxLeverage: string;
leverageStep: string;
}
⋮----
export interface UMPriceFilter {
minPrice: string;
maxPrice: string;
tickSize: string;
}
⋮----
export interface UMLotSizeFilter {
maxTradingQty: string;
minTradingQty: string;
qtyStep: string;
}
⋮----
export interface UMInstrumentInfo {
symbol: string;
contractType: string;
status: string;
baseCoin: string;
quoteCoin: string;
launchTime: string;
deliveryTime: string;
deliveryFeeRate: string;
priceScale: string;
leverageFilter: UMLeverageFilter;
priceFilter: UMPriceFilter;
lotSizeFilter: UMLotSizeFilter;
}
⋮----
export interface UMHistoricOrder {
symbol: string;
orderType: string;
orderLinkId: string;
orderId: string;
stopOrderType: string;
orderStatus: string;
takeProfit: string;
cumExecValue: string;
blockTradeId: string;
rejectReason: string;
price: string;
createdTime: number;
tpTriggerBy: string;
timeInForce: string;
basePrice: string;
leavesValue: string;
updatedTime: number;
side: string;
triggerPrice: string;
c