kucoin-api
Version:
Complete & robust Node.js SDK for Kucoin's REST APIs and WebSockets, with TypeScript & strong end to end tests.
1,949 lines (1,909 loc) • 482 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/
authorizationHeader.ts
fasterHmacSign.ts
Rest/
rest-futures-orders-guide.ts
rest-futures-private-trade.ts
rest-futures-public.ts
rest-spot-private-trade.ts
rest-spot-public.ts
WebSockets/
WS-API/
ws-api-client.ts
ws-api-raw-promises.ts
README.md
ws-private-futures-v1.ts
ws-private-pro-v2.ts
ws-private-spot-v1.ts
ws-public-futures-pro-v2.ts
ws-public-futures-v1.ts
ws-public-spot-pro-v2.ts
ws-public-spot-v1.ts
kucoin-FUTURES-examples-nodejs.md
kucoin-SPOT-examples-nodejs.md
kucoin-UNIFIED-examples-nodejs.md
tsconfig.examples.json
src/
lib/
websocket/
logger.ts
websocket-util.ts
WsStore.ts
WsStore.types.ts
BaseRestClient.ts
BaseWSClient.ts
misc-util.ts
requestUtils.ts
webCryptoAPI.ts
types/
request/
broker.types.ts
futures.types.ts
spot-account.ts
spot-affiliate.ts
spot-convert.ts
spot-earn.ts
spot-funding.ts
spot-margin-trading.ts
spot-misc.ts
spot-trading.ts
uta-types.ts
response/
broker.types.ts
futures.types.ts
shared.types.ts
spot-account.ts
spot-affiliate.ts
spot-convert.ts
spot-earn.ts
spot-funding.ts
spot-margin-trading.ts
spot-misc.ts
spot-trading.ts
spot-vip.ts
uta-types.ts
ws.ts
websockets/
ws-api.ts
ws-events.ts
ws-general.ts
BrokerClient.ts
FuturesClient.ts
index.ts
SpotClient.ts
UnifiedAPIClient.ts
WebsocketAPIClient.ts
WebsocketClient.ts
webpack/
webpack.config.cjs
.gitignore
.nvmrc
.prettierrc
eslint.config.cjs
jest.config.ts
LICENSE.md
package.json
postBuild.sh
README.md
RELEASE_NOTES.md
tsconfig.cjs.json
tsconfig.esm.json
tsconfig.json
tsconfig.linting.json
================================================================
Files
================================================================
================
File: examples/auth/authorizationHeader.ts
================
import { SpotClient } from '../../src/index.js';
⋮----
// or
// import { SpotClient } from 'kucoin-api';
⋮----
async function start()
⋮----
/**
* All REST clients support passing the access token. If available, sign will be skipped for the request and the access token will instead be used via an authorization header.
*
* More details: https://github.com/tiagosiebler/kucoin-api/issues/2
*/
⋮----
// If you later need to set a new access token (e.g. it expired):
================
File: examples/tsconfig.examples.json
================
{
"extends": "../tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"outDir": "dist/cjs",
"target": "esnext",
"rootDir": "../"
},
"include": ["../src/**/*.*", "../examples/**/*.*"]
}
================
File: src/lib/websocket/WsStore.types.ts
================
import WebSocket from 'isomorphic-ws';
⋮----
export enum WsConnectionStateEnum {
INITIAL = 0,
CONNECTING = 1,
CONNECTED = 2,
CLOSING = 3,
RECONNECTING = 4,
// ERROR_RECONNECTING = 5,
ERROR = 5,
}
⋮----
// ERROR_RECONNECTING = 5,
⋮----
export interface DeferredPromise<TSuccess = any, TError = any> {
resolve?: (value: TSuccess) => TSuccess;
reject?: (value: TError) => TError;
promise?: Promise<TSuccess>;
}
⋮----
export interface WSConnectedResult {
wsKey: string;
ws: WebSocket;
}
⋮----
export interface WsStoredState<TWSTopicSubscribeEvent extends string | object> {
/** The currently active websocket connection */
ws?: WebSocket;
/** The current lifecycle state of the connection (enum) */
connectionState?: WsConnectionStateEnum;
connectionStateChangedAt?: Date;
/** A timer that will send an upstream heartbeat (ping) when it expires */
activePingTimer?: ReturnType<typeof setTimeout> | undefined;
/** A timer tracking that an upstream heartbeat was sent, expecting a reply before it expires */
activePongTimer?: ReturnType<typeof setTimeout> | undefined;
/** If a reconnection is in progress, this will have the timer for the delayed reconnect */
activeReconnectTimer?: ReturnType<typeof setTimeout> | undefined;
/**
* When a connection attempt is in progress (even for reconnect), a promise is stored here.
*
* This promise will resolve once connected (and will then get removed);
*/
deferredPromiseStore: Record<string, DeferredPromise>;
/**
* All the topics we are expected to be subscribed to on this connection (and we automatically resubscribe to if the connection drops)
*
* A "Set" and a deep-object-match are used to ensure we only subscribe to a topic once (tracking a list of unique topics we're expected to be connected to)
*/
subscribedTopics: Set<TWSTopicSubscribeEvent>;
/** Whether this connection has completed authentication (only applies to private connections) */
isAuthenticated?: boolean;
/**
* Whether this connection has completed authentication before for the Websocket API, so it knows to automatically reauth if reconnected
*/
didAuthWSAPI?: boolean;
/** To reauthenticate on the WS API, which channel do we send to? */
WSAPIAuthChannel?: string;
}
⋮----
/** The currently active websocket connection */
⋮----
/** The current lifecycle state of the connection (enum) */
⋮----
/** A timer that will send an upstream heartbeat (ping) when it expires */
⋮----
/** A timer tracking that an upstream heartbeat was sent, expecting a reply before it expires */
⋮----
/** If a reconnection is in progress, this will have the timer for the delayed reconnect */
⋮----
/**
* When a connection attempt is in progress (even for reconnect), a promise is stored here.
*
* This promise will resolve once connected (and will then get removed);
*/
⋮----
/**
* All the topics we are expected to be subscribed to on this connection (and we automatically resubscribe to if the connection drops)
*
* A "Set" and a deep-object-match are used to ensure we only subscribe to a topic once (tracking a list of unique topics we're expected to be connected to)
*/
⋮----
/** Whether this connection has completed authentication (only applies to private connections) */
⋮----
/**
* Whether this connection has completed authentication before for the Websocket API, so it knows to automatically reauth if reconnected
*/
⋮----
/** To reauthenticate on the WS API, which channel do we send to? */
================
File: src/lib/misc-util.ts
================
export function neverGuard(x: never, msg: string): Error
================
File: src/lib/webCryptoAPI.ts
================
import { neverGuard } from './misc-util.js';
⋮----
function bufferToB64(buffer: ArrayBuffer): string
⋮----
export type SignEncodeMethod = 'hex' | 'base64';
export type SignAlgorithm = 'SHA-256' | 'SHA-512';
⋮----
/**
* Similar to node crypto's `createHash()` function
*/
export async function hashMessage(
message: string,
method: SignEncodeMethod,
algorithm: SignAlgorithm,
): Promise<string>
⋮----
/**
* Sign a message, with a secret, using the Web Crypto API
*/
export async function signMessage(
message: string,
secret: string,
method: SignEncodeMethod,
algorithm: SignAlgorithm,
): Promise<string>
⋮----
export function checkWebCryptoAPISupported()
================
File: src/types/request/spot-account.ts
================
export interface GetBalancesRequest {
currency?: string;
type?: 'main' | 'trade';
}
⋮----
export interface GetSpotTransactionsRequest {
currency?: string;
direction?: 'in' | 'out';
bizType?:
| 'DEPOSIT'
| 'WITHDRAW'
| 'TRANSFER'
| 'SUB_TRANSFER'
| 'TRADE_EXCHANGE'
| 'MARGIN_EXCHANGE'
| 'KUCOIN_BONUS'
| 'BROKER_TRANSFER'
| 'REBATE';
startAt?: number;
endAt?: number;
currentPage?: number;
pageSize?: number;
}
⋮----
export interface AccountHFTransactionsRequest {
currency?: string;
direction?: 'in' | 'out';
bizType?:
| 'TRANSFER'
| 'TRADE_EXCHANGE'
| 'RETURNED_FEES'
| 'DEDUCTION_FEES'
| 'OTHER';
lastId?: number;
limit?: number;
startAt?: number;
endAt?: number;
}
⋮----
export interface AccountHFMarginTransactionsRequest {
currency?: string;
direction?: 'in' | 'out';
bizType?:
| 'TRANSFER'
| 'MARGIN_EXCHANGE'
| 'ISOLATED_EXCHANGE'
| 'LIQUIDATION'
| 'ASSERT_RETURN';
lastId?: number;
limit?: number;
startAt?: number;
endAt?: number;
}
⋮----
export interface CreateSubAccountRequest {
password: string;
remarks?: string;
subName: string;
access: string;
}
⋮----
export interface CreateSubAccountAPIRequest {
subName: string;
passphrase: string;
remark: string;
permission?: string;
ipWhitelist?: string;
expire?: string;
}
⋮----
export interface UpdateSubAccountAPIRequest {
subName: string;
apiKey: string;
passphrase: string;
permission?: string;
ipWhitelist?: string;
expire?: string;
}
⋮----
export interface DeleteSubAccountAPIRequest {
apiKey: string;
passphrase: string;
subName: string;
}
================
File: src/types/request/spot-convert.ts
================
/**
*
***********
* Spot Convert
***********
*
*/
⋮----
/**
* Get Convert Symbol
*/
export interface GetConvertSymbolRequest {
fromCurrency: string;
toCurrency: string;
orderType?: 'MARKET' | 'LIMIT';
}
⋮----
/**
* Add Convert Order
*/
export interface AddConvertOrderRequest {
clientOrderId: string;
quoteId: string;
accountType?: 'BOTH' | 'FUNDING' | 'TRADING';
}
⋮----
/**
* Get Convert Quote
*/
export interface GetConvertQuoteRequest {
fromCurrency: string;
toCurrency: string;
fromCurrencySize?: number;
toCurrencySize?: number;
}
⋮----
/**
* Get Convert Order Detail
*/
export interface GetConvertOrderDetailRequest {
clientOrderId?: string;
orderId?: string;
}
⋮----
/**
* Get Convert Order History
*/
export interface GetConvertOrderHistoryRequest {
startAt?: number;
endAt?: number;
page?: number;
pageSize?: number;
status?: 'OPEN' | 'SUCCESS' | 'FAIL';
}
⋮----
/**
* Add Convert Limit Order
*/
export interface AddConvertLimitOrderRequest {
clientOrderId: string;
fromCurrency: string;
toCurrency: string;
fromCurrencySize: number;
toCurrencySize: number;
accountType?: 'BOTH' | 'FUNDING' | 'TRADING';
}
⋮----
/**
* Get Convert Limit Quote
*/
export interface GetConvertLimitQuoteRequest {
fromCurrency: string;
toCurrency: string;
fromCurrencySize?: number;
toCurrencySize?: number;
}
⋮----
/**
* Get Convert Limit Order Detail
*/
export interface GetConvertLimitOrderDetailRequest {
clientOrderId?: string;
orderId?: string;
}
⋮----
/**
* Get Convert Limit Orders
*/
export interface GetConvertLimitOrdersRequest {
startAt?: number;
endAt?: number;
page?: number;
pageSize?: number;
status?: 'OPEN' | 'SUCCESS' | 'FAIL' | 'CANCELLED';
}
⋮----
/**
* Cancel Convert Limit Order
*/
export interface CancelConvertLimitOrderRequest {
clientOrderId?: string;
orderId?: string;
}
================
File: src/types/request/spot-earn.ts
================
/**
*
* EARN
*
*/
⋮----
export interface SubscribeEarnFixedIncomeRequest {
productId: string;
amount: string;
accountType: 'MAIN' | 'TRADE';
}
⋮----
export interface InitiateRedemptionRequest {
orderId: string;
amount: string;
fromAccountType?: 'MAIN' | 'TRADE';
confirmPunishRedeem?: '1';
}
⋮----
export interface GetEarnRedeemPreviewRequest {
orderId: string;
fromAccountType?: 'MAIN' | 'TRADE';
}
⋮----
export interface GetEarnFixedIncomeHoldAssetsRequest {
currentPage?: number;
pageSize?: number;
productId?: string;
productCategory?: string;
currency?: string;
}
⋮----
/**
*
* STRUCTURED EARN - DUAL
*
*/
⋮----
export interface StructuredProductPurchaseRequest {
productId: string; // required - Product ID
investCurrency: string; // required - Investment currency
investAmount: string; // required - Subscription amount
accountType: 'MAIN' | 'TRADE'; // required - MAIN (funding account), TRADE (spot trading account)
}
⋮----
productId: string; // required - Product ID
investCurrency: string; // required - Investment currency
investAmount: string; // required - Subscription amount
accountType: 'MAIN' | 'TRADE'; // required - MAIN (funding account), TRADE (spot trading account)
⋮----
export interface GetDualInvestmentProductsRequest {
category: 'DUAL_CLASSIC' | 'DUAL_BOOSTER' | 'DUAL_EXTRA'; // required - Product category
strikeCurrency?: string; // optional - Strike Currency
investCurrency?: string; // optional - Investment Currency
side?: 'CALL' | 'PUT'; // optional - Direction
}
⋮----
category: 'DUAL_CLASSIC' | 'DUAL_BOOSTER' | 'DUAL_EXTRA'; // required - Product category
strikeCurrency?: string; // optional - Strike Currency
investCurrency?: string; // optional - Investment Currency
side?: 'CALL' | 'PUT'; // optional - Direction
⋮----
export interface GetStructuredProductOrdersRequest {
categories: string; // required - Product categories, multiple categories are supported, e.g. DUAL_CLASSIC, DUAL_BOOSTER, DUAL_EXTRA
orderId?: string; // optional - Order Id
investCurrency?: string; // optional - Investment Currency
currentPage?: number; // optional - Current Page, default: 1
pageSize?: number; // optional - Page Size >= 10, <= 500, default: 15
}
⋮----
categories: string; // required - Product categories, multiple categories are supported, e.g. DUAL_CLASSIC, DUAL_BOOSTER, DUAL_EXTRA
orderId?: string; // optional - Order Id
investCurrency?: string; // optional - Investment Currency
currentPage?: number; // optional - Current Page, default: 1
pageSize?: number; // optional - Page Size >= 10, <= 500, default: 15
================
File: src/types/request/spot-misc.ts
================
export interface GetAnnouncementsRequest {
currentPage?: number;
pageSize?: number;
annType?: string;
lang?: string;
startTime?: number;
endTime?: number;
}
================
File: src/types/request/spot-trading.ts
================
/**
*
***********
* Spot Trading
***********
*
*/
⋮----
/**
*
* Market data
*
*/
⋮----
export interface GetSpotKlinesRequest {
symbol: string;
startAt?: number;
endAt?: number;
type:
| '1min'
| '3min'
| '5min'
| '15min'
| '30min'
| '1hour'
| '2hour'
| '4hour'
| '6hour'
| '8hour'
| '12hour'
| '1day'
| '1week'
| '1month';
}
⋮----
/**
*
* Spot HF trade
*
*/
⋮----
export interface SubmitHFOrderRequest {
// Required fields
type: 'limit' | 'market';
symbol: string;
side: 'buy' | 'sell';
// Optional base fields
clientOid?: string;
stp?: 'DC' | 'CO' | 'CN' | 'CB';
tags?: string;
remark?: string;
// Limit order fields
price?: string;
size?: string;
timeInForce?: 'GTC' | 'GTT' | 'IOC' | 'FOK';
cancelAfter?: number;
postOnly?: boolean;
hidden?: boolean;
iceberg?: boolean;
visibleSize?: string;
// Market order fields
funds?: string; // Required for market orders if size is not provided
allowMaxTimeWindow?: number; // Order failed after timeout of specified milliseconds, If clientTimestamp + allowMaxTimeWindow < the server reaches time, this order will fail.
clientTimestamp?: number; // Equal to KC-API-TIMESTAMP, Need to be defined if iceberg is specified.
}
⋮----
// Required fields
⋮----
// Optional base fields
⋮----
// Limit order fields
⋮----
// Market order fields
funds?: string; // Required for market orders if size is not provided
⋮----
allowMaxTimeWindow?: number; // Order failed after timeout of specified milliseconds, If clientTimestamp + allowMaxTimeWindow < the server reaches time, this order will fail.
clientTimestamp?: number; // Equal to KC-API-TIMESTAMP, Need to be defined if iceberg is specified.
⋮----
export interface ModifyHFOrderRequest {
symbol: string;
clientOid?: string;
orderId?: string;
newPrice?: string;
newSize?: string;
}
⋮----
export interface CancelSpecifiedNumberHFOrdersRequest {
orderId: string;
symbol: string;
cancelSize: string;
}
⋮----
export interface GetHFCompletedOrdersRequest {
symbol: string;
side?: 'buy' | 'sell';
type?: 'limit' | 'market';
startAt?: number;
endAt?: number;
lastId?: number;
limit?: number;
}
⋮----
export interface GetHFFilledListRequest {
orderId?: string;
symbol: string;
side?: 'buy' | 'sell';
type?: 'limit' | 'market';
startAt?: number;
endAt?: number;
lastId?: number;
limit?: number;
}
⋮----
/**
*
* Orders
*
*/
⋮----
export interface SubmitOrderRequest {
clientOid: string;
side: 'buy' | 'sell';
symbol: string;
type?: 'limit' | 'market';
remark?: string;
stp?: 'CN' | 'CO' | 'CB' | 'DC';
tradeType?: 'TRADE' | 'MARGIN_TRADE';
price?: string;
size?: string;
timeInForce?: 'GTC' | 'GTT' | 'IOC' | 'FOK';
cancelAfter?: number;
postOnly?: boolean;
hidden?: boolean;
iceberg?: boolean;
visibleSize?: string;
funds?: string;
}
⋮----
export interface SubmitMultipleOrdersRequest {
clientOid: string;
side: 'buy' | 'sell';
type?: 'limit';
remark?: string;
stop?: 'loss' | 'entry';
stopPrice?: string;
stp?: 'CN' | 'CO' | 'CB' | 'DC';
tradeType?: 'TRADE';
price: string;
size: string;
timeInForce?: 'GTC' | 'GTT' | 'IOC' | 'FOK';
cancelAfter?: number;
postOnly?: boolean;
hidden?: boolean;
iceberg?: boolean;
visibleSize?: string;
}
⋮----
export interface CancelAllOrdersRequest {
symbol?: string;
tradeType?: 'TRADE' | 'MARGIN_TRADE' | 'MARGIN_ISOLATED_TRADE';
}
⋮----
export interface GetOrderListRequest {
status?: 'active' | 'done';
symbol?: string;
side?: 'buy' | 'sell';
type?: 'limit' | 'market' | 'limit_stop' | 'market_stop';
tradeType?: 'TRADE' | 'MARGIN_TRADE' | 'MARGIN_ISOLATED_TRADE';
startAt?: number;
endAt?: number;
currentPage?: number;
pageSize?: number;
}
⋮----
/**
*
* Fills
*
*/
⋮----
export interface GetFillsRequest {
orderId?: string;
symbol?: string;
side?: 'buy' | 'sell';
type?: 'limit' | 'market' | 'limit_stop' | 'market_stop';
startAt?: number;
endAt?: number;
tradeType: 'TRADE' | 'MARGIN_TRADE' | 'MARGIN_ISOLATED_TRADE';
}
⋮----
/**
*
* Stop order
*
*/
⋮----
export interface SubmitStopOrderRequest {
// Required fields
symbol: string;
side: 'buy' | 'sell';
stopPrice: string;
type: 'limit' | 'market';
// Optional base fields
clientOid?: string;
stp?: 'DC' | 'CO' | 'CN' | 'CB';
remark?: string;
tradeType?: 'TRADE' | 'MARGIN_TRADE' | 'MARGIN_ISOLATED_TRADE';
// Limit order required fields (when type is 'limit')
price?: string;
size?: string;
timeInForce?: 'GTC' | 'GTT' | 'IOC' | 'FOK';
// Optional limit order fields
cancelAfter?: number;
postOnly?: boolean;
hidden?: boolean;
iceberg?: boolean;
visibleSize?: string;
// Market order fields (when type is 'market')
funds?: string; // Required for market orders if size is not provided
}
⋮----
// Required fields
⋮----
// Optional base fields
⋮----
// Limit order required fields (when type is 'limit')
⋮----
// Optional limit order fields
⋮----
// Market order fields (when type is 'market')
funds?: string; // Required for market orders if size is not provided
⋮----
export interface CancelStopOrdersRequest {
symbol?: string;
tradeType?: 'TRADE' | 'MARGIN_TRADE' | 'MARGIN_ISOLATED_TRADE';
orderIds?: string;
}
⋮----
export interface GetStopOrdersListRequest {
symbol?: string;
side?: 'buy' | 'sell';
type?: 'limit' | 'market' | 'limit_stop' | 'market_stop';
tradeType?: 'TRADE' | 'MARGIN_TRADE' | 'MARGIN_ISOLATED_TRADE';
startAt?: number;
endAt?: number;
currentPage?: number;
orderIds?: string;
pageSize?: number;
stop?: 'stop' | 'oco';
}
⋮----
/**
*
* OCO order
*
*/
⋮----
export interface SubmitOCOOrderRequest {
symbol: string;
side: 'buy' | 'sell';
price: string;
size: string;
stopPrice: string;
limitPrice: string;
tradeType?: 'TRADE'; // Currently only supports TRADE
clientOid: string;
remark?: string;
}
⋮----
tradeType?: 'TRADE'; // Currently only supports TRADE
⋮----
export interface GetOCOOrdersRequest {
pageSize: string;
currentPage: string;
symbol?: string;
startAt?: number;
endAt?: number;
orderIds?: string;
}
================
File: src/types/response/shared.types.ts
================
export interface APISuccessResponse<TData> {
code: '200000';
data: TData;
}
⋮----
export interface APIErrorResponse {
msg: string;
code: string;
}
⋮----
export type APIResponse<TData> = APISuccessResponse<TData> | APIErrorResponse;
⋮----
export interface ServiceStatus {
msg: string;
status: 'cancelonly' | 'close' | 'open';
}
================
File: src/types/response/spot-convert.ts
================
/**
*
***********
* Spot Convert
***********
*
*/
⋮----
/**
* Get Convert Symbol Response
*/
export interface ConvertSymbol {
fromCurrency: string;
toCurrency: string;
fromCurrencyMaxSize: string;
fromCurrencyMinSize: string;
fromCurrencyStep: string;
toCurrencyMaxSize: string;
toCurrencyMinSize: string;
toCurrencyStep: string;
}
⋮----
/**
* Convert Currency Info
*/
export interface ConvertCurrency {
currency: string;
maxSize: string;
minSize: string;
step: string;
tradeDirection: string;
}
⋮----
/**
* USDT Currency Limit Info
*/
export interface UsdtCurrencyLimit {
currency: string;
maxSize: string;
minSize: string;
step: string;
}
⋮----
/**
* Get Convert Currencies Response
*/
export interface ConvertCurrencies {
currencies: ConvertCurrency[];
usdtCurrencyLimit: UsdtCurrencyLimit[];
}
⋮----
/**
* Add Convert Order Response
*/
export interface SubmitConvertOrderResponse {
orderId: string;
clientOrderId: string;
}
⋮----
/**
* Get Convert Quote Response
*/
export interface ConvertQuote {
quoteId: string;
price: string;
fromCurrencySize: string;
toCurrencySize: string;
validUntill: number;
}
⋮----
/**
* Convert Order Detail
*/
export interface ConvertOrder {
orderId: number;
clientOrderId: string;
status: 'OPEN' | 'SUCCESS' | 'FAIL';
fromCurrency: string;
toCurrency: string;
fromCurrencySize: string;
toCurrencySize: string;
accountType: 'BOTH' | 'FUNDING' | 'TRADING';
price: string;
orderTime: number;
}
⋮----
/**
* Get Convert Order History Response
*/
export interface ConvertOrderHistory {
currentPage: number;
pageSize: number;
totalNum: number;
totalPage: number;
items: ConvertOrder[];
}
⋮----
/**
* Add Convert Limit Order Response
*/
export interface SumbitConvertLimitResp {
orderId: string;
clientOrderId: string;
}
⋮----
/**
* Get Convert Limit Quote Response
*/
export interface ConvertLimitQuote {
price: string;
validUntill: number;
}
⋮----
/**
* Convert Limit Order Detail
*/
export interface ConvertLimitOrder {
orderId: string;
clientOrderId: string;
status: 'OPEN' | 'SUCCESS' | 'FAIL' | 'CANCELLED';
fromCurrency: string;
toCurrency: string;
fromCurrencySize: string;
toCurrencySize: string;
accountType: string;
price: string;
orderTime: number;
expiryTime: number;
cancelTime?: number;
filledTime?: number;
cancelType?: number;
}
⋮----
/**
* Get Convert Limit Orders Response
*/
export interface ConvertLimitOrdersList {
currentPage: number;
pageSize: number;
totalNum: number;
totalPage: number;
items: ConvertLimitOrder[];
}
================
File: src/types/response/spot-earn.ts
================
/**
*
* EARN
*
*/
⋮----
export interface SubscribeEarnFixedIncomeResponse {
orderId: string;
orderTxId: string;
}
⋮----
export interface InitiateRedemptionResponse {
orderTxId: string;
deliverTime: number;
status: 'SUCCESS' | 'PENDING';
amount: string;
}
⋮----
export interface GetEarnRedeemPreviewResponse {
currency: string;
redeemAmount: string;
penaltyInterestAmount: string;
redeemPeriod: number;
deliverTime: number;
manualRedeemable: boolean;
redeemAll: boolean;
}
⋮----
export interface EarnFixedIncomeHoldAsset {
orderId: string;
productId: string;
productCategory: string;
productType: string;
currency: string;
incomeCurrency: string;
returnRate: string;
holdAmount: string;
redeemedAmount: string;
redeemingAmount: string;
lockStartTime: number;
lockEndTime: number | null;
purchaseTime: number;
redeemPeriod: number;
status: 'LOCKED' | 'REDEEMING';
earlyRedeemSupported: 0 | 1;
}
⋮----
export interface EarnFixedIncomeHoldAssets {
totalNum: number;
items: EarnFixedIncomeHoldAsset[];
currentPage: number;
pageSize: number;
totalPage: number;
}
⋮----
export interface EarnProduct {
id: string;
currency: string;
category: 'DEMAND' | 'ACTIVITY' | 'KCS_STAKING' | 'STAKING' | 'ETH2';
type: 'TIME' | 'DEMAND';
precision: number;
productUpperLimit: string;
userUpperLimit: string;
userLowerLimit: string;
redeemPeriod: number;
lockStartTime: number;
lockEndTime: number | null;
applyStartTime: number;
applyEndTime: number | null;
returnRate: string;
incomeCurrency: string;
earlyRedeemSupported: 0 | 1;
productRemainAmount: string;
status: 'ONGOING' | 'PENDING' | 'FULL' | 'INTERESTING';
redeemType: 'MANUAL' | 'TRANS_DEMAND' | 'AUTO';
incomeReleaseType: 'DAILY' | 'AFTER';
interestDate: number;
duration: number;
newUserOnly: 0 | 1;
}
⋮----
/**
*
* STRUCTURED EARN - DUAL
*
*/
⋮----
export interface StructuredProductPurchaseResponse {
orderId: string; // Holding ID
}
⋮----
orderId: string; // Holding ID
⋮----
export interface DualInvestmentProduct {
category: 'DUAL_CLASSIC' | 'DUAL_BOOSTER' | 'DUAL_EXTRA'; // Product category
productId: string; // Product ID
targetCurrency: string; // Underlying currency of the product
quoteCurrency: string; // Currency used for pricing/quoting the product
investCurrency: string; // Currency used for investment
strikeCurrency: string; // Currency used for settlement if strike price is met
strikePrice: string; // Linked price (strike price) for settlement determination
protectPrice?: string; // Protection price for risk management (if applicable)
annualRate: string; // Annualized rate of return (e.g., 0.05 equals 5%)
expirationTime: number; // Product maturity time, in milliseconds
side: 'CALL' | 'PUT'; // Direction of the product: CALL (bullish), PUT (bearish)
expectSettleTime: number; // Expected settlement time, in milliseconds
duration: string; // Product duration (days)
lowerLimit: string; // Minimum investment amount per order
upperLimit: string; // Maximum investment amount per order
availableScale: string; // Total available subscription amount for the product
soldStatus: 'SOLD_OUT' | 'AVAILABLE'; // Product availability status
increment: string; // Investment step size (amount must be a multiple of this value, within lowerLimit and upperLimit)
}
⋮----
category: 'DUAL_CLASSIC' | 'DUAL_BOOSTER' | 'DUAL_EXTRA'; // Product category
productId: string; // Product ID
targetCurrency: string; // Underlying currency of the product
quoteCurrency: string; // Currency used for pricing/quoting the product
investCurrency: string; // Currency used for investment
strikeCurrency: string; // Currency used for settlement if strike price is met
strikePrice: string; // Linked price (strike price) for settlement determination
protectPrice?: string; // Protection price for risk management (if applicable)
annualRate: string; // Annualized rate of return (e.g., 0.05 equals 5%)
expirationTime: number; // Product maturity time, in milliseconds
side: 'CALL' | 'PUT'; // Direction of the product: CALL (bullish), PUT (bearish)
expectSettleTime: number; // Expected settlement time, in milliseconds
duration: string; // Product duration (days)
lowerLimit: string; // Minimum investment amount per order
upperLimit: string; // Maximum investment amount per order
availableScale: string; // Total available subscription amount for the product
soldStatus: 'SOLD_OUT' | 'AVAILABLE'; // Product availability status
increment: string; // Investment step size (amount must be a multiple of this value, within lowerLimit and upperLimit)
⋮----
export interface StructuredProductOrder {
category: string; // Product category
side: string; // Direction
duration: string; // Duration
apr: string; // Annual percentage rate
investCurrency: string; // Investment currency
strikeCurrency: string; // Strike currency
investAmount: string; // Investment amount
settleAmount: string; // Settlement amount
settleCurrency: string | null; // Settlement currency
targetPrice: string; // Target price
settlePrice: string; // Settlement price
expirationTime: number; // Expiration time in milliseconds
orderId: string; // Order ID
status: string; // Order status
}
⋮----
category: string; // Product category
side: string; // Direction
duration: string; // Duration
apr: string; // Annual percentage rate
investCurrency: string; // Investment currency
strikeCurrency: string; // Strike currency
investAmount: string; // Investment amount
settleAmount: string; // Settlement amount
settleCurrency: string | null; // Settlement currency
targetPrice: string; // Target price
settlePrice: string; // Settlement price
expirationTime: number; // Expiration time in milliseconds
orderId: string; // Order ID
status: string; // Order status
⋮----
export interface StructuredProductOrders {
currentPage: number; // Current page number
pageSize: number; // Number of records per page
totalNum: number; // Total number of records
totalPage: number; // Total number of pages
items: StructuredProductOrder[]; // List of structured product holdings
}
⋮----
currentPage: number; // Current page number
pageSize: number; // Number of records per page
totalNum: number; // Total number of records
totalPage: number; // Total number of pages
items: StructuredProductOrder[]; // List of structured product holdings
================
File: src/types/response/spot-funding.ts
================
/**
*
***********
* Funding
***********
*
*/
⋮----
export interface MarginAccountBalance {
currency: string;
totalBalance: string;
availableBalance: string;
holdBalance: string;
liability: string;
maxBorrowSize: string;
}
⋮----
export interface MarginAccountDetail {
currency: string;
total: string;
available: string;
hold: string;
liability: string;
liabilityPrincipal: string;
liabilityInterest: string;
maxBorrowSize: string;
borrowEnabled: boolean;
transferInEnabled: boolean;
}
⋮----
export interface MarginBalance {
totalAssetOfQuoteCurrency: string;
totalLiabilityOfQuoteCurrency: string;
debtRatio: string;
status: 'EFFECTIVE' | 'BANKRUPTCY' | 'LIQUIDATION' | 'REPAY' | 'BORROW';
accounts: MarginAccountDetail[];
}
export interface IsolatedMarginAssetDetail {
symbol: string;
debtRatio: string;
status: 'EFFECTIVE' | 'BANKRUPTCY' | 'LIQUIDATION' | 'REPAY' | 'BORROW';
baseAsset: MarginAccountDetail;
quoteAsset: MarginAccountDetail;
}
⋮----
export interface IsolatedMarginBalance {
totalAssetOfQuoteCurrency: string;
totalLiabilityOfQuoteCurrency: string;
timestamp: number;
assets: IsolatedMarginAssetDetail[];
}
⋮----
/**
*
* Deposit
*
*/
⋮----
export interface DepositAddress {
address: string;
memo: string;
chain: string;
}
⋮----
export type DepositAddressV2 = DepositAddress & {
contractAddress: string;
};
⋮----
export interface DepositAddressV3 {
address: string;
memo: string;
chainId: string;
to: 'MAIN' | 'TRADE'; // main (funding account), trade (spot trading account)
expirationDate: number;
currency: string;
contractAddress: string;
chainName: string;
}
⋮----
to: 'MAIN' | 'TRADE'; // main (funding account), trade (spot trading account)
⋮----
export interface HistoricalDepositItem {
currency: string;
createAt: number;
amount: string;
walletTxId: string;
isInner: boolean;
status: 'PROCESSING' | 'SUCCESS' | 'FAILURE';
}
export interface DepositItem {
currency?: string;
chain?: string;
status?: 'PROCESSING' | 'SUCCESS' | 'FAILURE';
address?: string;
memo?: string;
isInner?: boolean;
amount?: string;
fee?: string;
walletTxId?: string | null;
createdAt?: number;
updatedAt?: number;
remark?: string;
arrears?: boolean;
}
⋮----
export interface Deposits {
currentPage: number;
pageSize: number;
totalNum: number;
totalPage: number;
items: DepositItem[];
}
⋮----
export interface V1HistoricalDeposits {
currentPage: number;
pageSize: number;
totalNum: number;
totalPage: number;
items: HistoricalDepositItem[];
}
⋮----
export interface CreateDepositAddressV3Response {
address: string;
memo: string | null;
chainName: string;
chainId: string;
to: string;
currency: string;
expirationDate?: string;
}
⋮----
/**
*
* Withdrawals
*
*/
⋮----
interface DetailedWithdrawal {
id: string;
address: string;
memo: string;
currency: string;
chain: string;
amount: string;
fee: string;
walletTxId: string;
isInner: boolean;
status: 'PROCESSING' | 'WALLET_PROCESSING' | 'SUCCESS' | 'FAILURE';
remark: string;
createdAt: number;
updatedAt: number;
}
⋮----
interface HistoricalWithdrawal {
currency: string;
createAt: number;
amount: string;
address: string;
walletTxId: string;
isInner: boolean;
status: 'PROCESSING' | 'SUCCESS' | 'FAILURE';
}
⋮----
export interface Withdrawals {
currentPage: number;
pageSize: number;
totalNum: number;
totalPage: number;
items: DetailedWithdrawal[];
}
⋮----
export interface HistoricalWithdrawalsV1 {
currentPage: number;
pageSize: number;
totalNum: number;
totalPage: number;
items: HistoricalWithdrawal[];
}
⋮----
export interface WithdrawalQuotas {
currency: string;
limitBTCAmount: string;
usedBTCAmount: string;
quotaCurrency: string;
limitQuotaCurrencyAmount: string;
usedQuotaCurrencyAmount: string;
remainAmount: string;
availableAmount: string;
withdrawMinFee: string;
innerWithdrawMinFee: string;
withdrawMinSize: string;
isWithdrawEnabled: boolean;
precision: number;
chain: string;
reason: string | null;
lockedAmount: string;
}
⋮----
export interface WithdrawalById {
id: string;
uid: number;
currency: string;
chainId: string;
chainName: string;
currencyName: string;
status: string;
failureReason: string;
failureReasonMsg: string | null;
address: string;
memo: string;
isInner: boolean;
amount: string;
fee: string;
walletTxId: string | null;
addressRemark: string | null;
remark: string;
createdAt: number;
cancelType: string;
taxes: string | null;
taxDescription: string | null;
returnStatus: string;
returnAmount: string | null;
returnCurrency: string;
}
⋮----
/**
*
* Transfer
*
*/
⋮----
export interface TransferableFunds {
currency: string; // Currency
balance: string; // Total funds in an account.
available: string; // Funds available to withdraw or trade.
holds: string; // Funds on hold (not available for use).
transferable: string; // Funds available to transfer.
}
⋮----
currency: string; // Currency
balance: string; // Total funds in an account.
available: string; // Funds available to withdraw or trade.
holds: string; // Funds on hold (not available for use).
transferable: string; // Funds available to transfer.
================
File: src/types/response/spot-misc.ts
================
export interface Announcement {
annId: number;
annTitle: string;
annType: string[];
annDesc: string;
cTime: number;
language: string;
annUrl: string;
}
⋮----
export interface Announcements {
totalNum: number;
currentPage: number;
pageSize: number;
totalPage: number;
items: Announcement[];
}
================
File: src/types/response/spot-trading.ts
================
/**
*
***********
* Spot Trading
***********
*
*/
⋮----
/**
*
* Market data
*
*/
⋮----
interface Chain {
chainName: string;
withdrawalMinSize: string;
depositMinSize: string | null;
withdrawFeeRate: string;
withdrawalMinFee: string;
isWithdrawEnabled: boolean;
isDepositEnabled: boolean;
confirms: number;
preConfirms: number;
contractAddress: string;
withdrawPrecision: number;
maxWithdraw: string | null;
maxDeposit: string | null;
needTag: boolean;
chainId: string;
}
⋮----
export interface CurrencyInfo {
currency: string;
name: string;
fullName: string;
precision: number;
confirms: number | null;
contractAddress: string | null;
isMarginEnabled: boolean;
isDebitEnabled: boolean;
chains: Chain[];
}
⋮----
export interface SymbolInfo {
symbol: string;
name: string;
baseCurrency: string;
quoteCurrency: string;
feeCurrency: string;
market: 'USDS' | 'BTC' | 'ALTS';
baseMinSize: string;
quoteMinSize: string;
baseMaxSize: string;
quoteMaxSize: string;
baseIncrement: string;
quoteIncrement: string;
priceIncrement: string;
priceLimitRate: string;
minFunds: string;
isMarginEnabled: boolean;
enableTrading: boolean;
feeCategory: 1 | 2 | 3;
makerFeeCoefficient: string;
takerFeeCoefficient: string;
st: boolean;
callauctionIsEnabled: boolean;
callauctionPriceFloor: string | null;
callauctionPriceCeiling: string | null;
callauctionFirstStageStartTime: number | null;
callauctionSecondStageStartTime: number | null;
callauctionThirdStageStartTime: number | null;
tradingStartTime: number | null;
}
⋮----
export interface Ticker {
sequence: string;
price: string;
size: string;
bestAsk: string;
bestAskSize: string;
bestBid: string;
bestBidSize: string;
time: number;
}
⋮----
export interface AllTickers {
time: number;
ticker: Ticker[];
}
⋮----
// AllTickers returns different data than asking for one ticker
export interface AllTickersItem {
symbol: string;
symbolName: string;
buy: string;
bestBidSize: string;
sell: string;
bestAskSize: string;
changeRate: string;
changePrice: string;
high: string;
low: string;
vol: string;
volValue: string;
last: string;
averagePrice: string;
takerFeeRate: string;
makerFeeRate: string;
takerCoefficient: string;
makerCoefficient: string;
}
⋮----
export interface Symbol24hrStats {
time: number;
symbol: string;
buy: string;
sell: string;
changeRate: string;
changePrice: string;
high: string;
low: string;
vol: string;
volValue: string;
last: string;
averagePrice: string;
takerFeeRate: string;
makerFeeRate: string;
takerCoefficient: string;
makerCoefficient: string;
}
⋮----
export interface OrderBookLevel {
sequence: string;
time: number;
bids: [string, string][];
asks: [string, string][];
}
⋮----
export interface CallAuctionInfo {
symbol: string; // Symbol (e.g. "BTC-USDT")
estimatedPrice: string; // Estimated price
estimatedSize: string; // Estimated size
sellOrderRangeLowPrice: string; // Sell order minimum price
sellOrderRangeHighPrice: string; // Sell order maximum price
buyOrderRangeLowPrice: string; // Buy order minimum price
buyOrderRangeHighPrice: string; // Buy order maximum price
time: number; // Timestamp (ms)
}
⋮----
symbol: string; // Symbol (e.g. "BTC-USDT")
estimatedPrice: string; // Estimated price
estimatedSize: string; // Estimated size
sellOrderRangeLowPrice: string; // Sell order minimum price
sellOrderRangeHighPrice: string; // Sell order maximum price
buyOrderRangeLowPrice: string; // Buy order minimum price
buyOrderRangeHighPrice: string; // Buy order maximum price
time: number; // Timestamp (ms)
⋮----
export interface TradeHistory {
sequence: string;
time: number;
price: string;
size: string;
side: string;
}
⋮----
export type Kline = [string, string, string, string, string, string, string];
⋮----
/**
*
* Spot HF trade
*
*/
⋮----
export interface SubmitHFOrderSyncResponse {
orderId: string; // An order Id is returned once an order is successfully Submitd.
orderTime: number; // order time
originSize: string; // original order size
dealSize: string; // deal size
remainSize: string; // remain size
canceledSize: string; // Cumulative number of cancellations
status: string; // Order Status. open: the order is active; done: the order has been completed
matchTime: number; // matching time
clientOid: string;
}
⋮----
orderId: string; // An order Id is returned once an order is successfully Submitd.
orderTime: number; // order time
originSize: string; // original order size
dealSize: string; // deal size
remainSize: string; // remain size
canceledSize: string; // Cumulative number of cancellations
status: string; // Order Status. open: the order is active; done: the order has been completed
matchTime: number; // matching time
⋮----
export interface SubmitMultipleHFOrdersResponse {
orderId: string;
success?: boolean;
failMsg?: string; // Reason of failure, optional based on success status
clientOid: string;
}
⋮----
failMsg?: string; // Reason of failure, optional based on success status
⋮----
export interface SubmitMultipleHFOrdersSyncResponse {
orderId: string; // An order Id is returned once an order is successfully Submitd.
orderTime: number; // order time
originSize: string; // original order size
dealSize: string; // deal size
remainSize: string; // remain size
canceledSize: string; // Cumulative number of cancellations
status: string; // Order Status. open: the order is active; done: the order has been completed
matchTime: number; // matching time
success: boolean; // Whether the order was submitted successfully.
clientOid: string;
}
⋮----
orderId: string; // An order Id is returned once an order is successfully Submitd.
orderTime: number; // order time
originSize: string; // original order size
dealSize: string; // deal size
remainSize: string; // remain size
canceledSize: string; // Cumulative number of cancellations
status: string; // Order Status. open: the order is active; done: the order has been completed
matchTime: number; // matching time
success: boolean; // Whether the order was submitted successfully.
⋮----
export interface SyncCancelHFOrderResponse {
clientOid?: string; // client order Id
orderId?: string; // order Id
originSize: string; // original order size
dealSize: string; // deal size
remainSize: string; // remain size
canceledSize: string; // Cumulative number of cancellations
status: string; // Order Status. open: the order is active; done: the order has been completed
}
⋮----
clientOid?: string; // client order Id
orderId?: string; // order Id
originSize: string; // original order size
dealSize: string; // deal size
remainSize: string; // remain size
canceledSize: string; // Cumulative number of cancellations
status: string; // Order Status. open: the order is active; done: the order has been completed
⋮----
export interface CancelAllHFOrdersResponse {
succeedSymbols?: string[]; // Cancel order successful symbol
failedSymbols?: {
symbol: string; // Cancel order failed symbol
error: string; // Error message
}[];
}
⋮----
succeedSymbols?: string[]; // Cancel order successful symbol
⋮----
symbol: string; // Cancel order failed symbol
error: string; // Error message
⋮----
export interface AutoCancelHFOrderSettingQueryResponse {
timeout: number; // Auto cancel order trigger setting time, the unit is second. range: timeout=-1 (meaning unset) or 5 <= timeout <= 86400
symbols: string; // List of trading pairs. Separated by commas, empty means all trading pairs
currentTime: number; // System current time (in seconds)
triggerTime: number; // Trigger cancellation time (in seconds)
}
⋮----
timeout: number; // Auto cancel order trigger setting time, the unit is second. range: timeout=-1 (meaning unset) or 5 <= timeout <= 86400
symbols: string; // List of trading pairs. Separated by commas, empty means all trading pairs
currentTime: number; // System current time (in seconds)
triggerTime: number; // Trigger cancellation time (in seconds)
⋮----
export interface HFFilledOrder {
id: number;
orderId: string;
counterOrderId: string;
tradeId: number;
symbol: string;
side: 'buy' | 'sell';
liquidity: 'taker' | 'maker';
type: 'limit' | 'market';
forceTaker: boolean;
price: string;
size: string;
funds: string;
fee: string;
feeRate: string;
feeCurrency: string;
stop: string;
tradeType: string;
taxRate: string;
tax: string;
createdAt: number;
}
⋮----
export interface HFOrder {
id: string;
clientOid: string;
symbol: string;
opType: string;
type: 'limit' | 'market';
side: 'buy' | 'sell';
price: string;
size: string;
funds: string;
dealSize: string;
dealFunds: string;
remainSize: string;
remainFunds: string;
cancelledSize: string;
cancelledFunds: string;
fee: string;
feeCurrency: string;
stp?: 'DC' | 'CO' | 'CN' | 'CB' | null;
timeInForce: 'GTC' | 'GTT' | 'IOC' | 'FOK';
postOnly: boolean;
hidden: boolean;
iceberg: boolean;
visibleSize: string;
cancelAfter: number;
channel: string;
remark?: string | null;
tags?: string | null;
cancelExist: boolean;
tradeType: string;
inOrderBook: boolean;
active: boolean;
tax: string;
createdAt: number;
lastUpdatedAt: number;
cancelReason: number;
}
⋮----
/**
*
* Orders
*
*/
⋮----
export interface MultipleOrdersResponse {
symbol: string;
type?: string;
side: string;
price: string;
size: string;
funds?: any;
stp?: string;
stop?: string;
stopPrice?: any;
timeInForce?: string;
cancelAfter?: number;
postOnly?: boolean;
hidden?: boolean;
iceberg?: boolean;
visibleSize?: any;
channel: string;
id: string;
status: string;
failMsg?: any;
clientOid: string;
}
export interface SpotOrder {
id: string;
symbol: string;
opType: string;
type: string;
side: string;
price: string;
size: string;
funds: string;
dealFunds: string;
dealSize: string;
fee: string;
feeCurrency: string;
stp: string;
stop: string;
stopTriggered: boolean;
stopPrice: string;
timeInForce: string;
postOnly: boolean;
hidden: boolean;
iceberg: boolean;
visibleSize: string;
cancelAfter: number;
channel: string;
clientOid: string;
remark: string;
tags: string;
isActive: boolean;
cancelExist: boolean;
createdAt: number;
tradeType: string;
}
⋮----
export interface SpotOrderList {
currentPage: number;
pageSize: number;
totalNum: number;
totalPage: number;
items: SpotOrder[];
}
⋮----
/**
*
* Fills
*
*/
⋮----
export interface SpotOrderFill {
symbol: string; // symbol.
tradeId: string; // trade id, it is generated by Matching engine.
orderId: string; // Order ID, unique identifier of an order.
counterOrderId: string; // counter order id.
side: 'buy' | 'sell'; // transaction direction, include buy and sell.
price: string; // order price
size: string; // order quantity
funds: string; // order funds
type: 'limit' | 'market' | 'limit_stop' | 'market_stop'; // order type, e.g. limit, market, stop_limit.
fee: string; // fee
feeCurrency: string; // charge fee currency
stop: string; // stop type, include entry and loss
liquidity: 'taker' | 'maker'; // include taker and maker
forceTaker: boolean; // forced to become taker, include true and false
createdAt: number; // create time
tradeType: 'TRADE' | 'MARGIN_TRADE' | 'MARGIN_ISOLATED_TRADE'; // The type of trading: TRADE(Spot Trading), MARGIN_TRADE (Margin Trading).
}
⋮----
symbol: string; // symbol.
tradeId: string; // trade id, it is generated by Matching engine.
orderId: string; // Order ID, unique identifier of an order.
counterOrderId: string; // counter order id.
side: 'buy' | 'sell'; // transaction direction, include buy and sell.
price: string; // order price
size: string; // order quantity
funds: string; // order funds
type: 'limit' | 'market' | 'limit_stop' | 'market_stop'; //