kucoin-api
Version:
Complete & robust Node.js SDK for Kucoin's REST APIs and WebSockets, with TypeScript & strong end to end tests.
323 lines (322 loc) • 7.36 kB
TypeScript
/**
*
***********
* Margin Trading
***********
*
*/
/**
*
* Margin HF trade
*
*/
export interface HFMarginOrder {
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;
stop?: string | null;
stopTriggered: boolean;
stopPrice: string;
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;
tax: string;
active: boolean;
createdAt: number;
lastUpdatedAt: number;
}
/** @deprecated not used anymore **/
export type HFMarginFilledOrder = HFMarginOrder & {
inOrderBook: boolean;
active: boolean;
};
export interface HFMarginTransactionRecord {
id: number;
symbol: string;
tradeId: number;
orderId: string;
counterOrderId: string;
side: 'buy' | 'sell';
liquidity: 'taker' | 'maker';
forceTaker: boolean;
price: string;
size: string;
funds: string;
fee: string;
feeRate: string;
feeCurrency: string;
stop: string;
tradeType: 'TRADE' | 'MARGIN_TRADE';
tax: string;
taxRate: string;
type: 'limit' | 'market';
createdAt: number;
}
/**
*
* Orders
*
*/
export interface SubmitMarginOrderResponse {
orderId: string;
borrowSize?: number;
loanApplyId?: string;
}
/**
*
* Margin info
*
*/
export interface MarginActivePairsV3 {
symbol: string;
name: string;
enableTrading: boolean;
market: string;
baseCurrency: string;
quoteCurrency: string;
baseIncrement: string;
baseMinSize: string;
baseMaxSize: string;
quoteIncrement: string;
quoteMinSize: string;
quoteMaxSize: string;
priceIncrement: string;
feeCurrency: string;
priceLimitRate: string;
minFunds: string;
}
export interface MarginLevTokenInfo {
currency: string;
netAsset: number;
targetLeverage: string;
actualLeverage: string;
issuedSize: string;
basket: string;
}
export interface MarginMarkPrice {
symbol: string;
timePoint: number;
value: number;
}
export interface MarginConfigInfo {
currencyList: string[];
warningDebtRatio: string;
liqDebtRatio: string;
maxLeverage: number;
}
export interface MarginRiskLimit {
timestamp: number;
currency?: string;
symbol?: string;
borrowMaxAmount?: string;
buyMaxAmount?: string;
holdMaxAmount?: string;
borrowCoefficient?: string;
marginCoefficient?: string;
precision?: number;
borrowMinAmount?: string;
borrowMinUnit?: string;
borrowEnabled?: boolean;
baseMaxBorrowAmount?: string;
quoteMaxBorrowAmount?: string;
baseMaxBuyAmount?: string;
quoteMaxBuyAmount?: string;
baseMaxHoldAmount?: string;
quoteMaxHoldAmount?: string;
basePrecision?: number;
quotePrecision?: number;
baseBorrowCoefficient?: string;
quoteBorrowCoefficient?: string;
baseMarginCoefficient?: string;
quoteMarginCoefficient?: string;
baseBorrowMinAmount?: string | null;
quoteBorrowMinAmount?: string | null;
baseBorrowMinUnit?: string | null;
quoteBorrowMinUnit?: string | null;
baseBorrowEnabled?: boolean;
quoteBorrowEnabled?: boolean;
}
/**
*
* Isolated Margin
*
*/
export interface IsolatedMarginSymbolsConfig {
symbol: string;
symbolName: string;
baseCurrency: string;
quoteCurrency: string;
maxLeverage: number;
flDebtRatio: string;
tradeEnable: boolean;
autoRenewMaxDebtRatio: string;
baseBorrowEnable: boolean;
quoteBorrowEnable: boolean;
baseTransferInEnable: boolean;
quoteTransferInEnable: boolean;
baseBorrowCoefficient: string;
quoteBorrowCoefficient: string;
}
export interface IsolatedMarginAccountInfo {
totalConversionBalance: string;
liabilityConversionBalance: string;
assets: AssetInfo[];
}
export interface SingleIsolatedMarginAccountInfo {
symbol: string;
status: string;
debtRatio: string;
baseAsset: AssetDetail;
quoteAsset: AssetDetail;
}
export interface AssetInfo {
symbol: string;
status: string;
debtRatio: string;
baseAsset: AssetDetail;
quoteAsset: AssetDetail;
}
export interface AssetDetail {
currency: string;
totalBalance: string;
holdBalance: string;
availableBalance: string;
liability: string;
interest: string;
borrowableAmount: string;
}
/**
*
* Margin trading(v3)
*
*/
export interface MarginSubmitOrderV3Response {
orderId: string;
clientOid: string;
borrowSize: string;
loanApplyId: string;
}
export interface MarginOrderV3 {
timestamp: number;
orderNo: string;
actualSize: number;
}
export interface MarginBorrowHistoryV3 {
timestamp: number;
currentPage: number;
pageSize: number;
totalNum: number;
totalPage: number;
items: MarginBorrowHistoryRecord[];
}
export interface MarginBorrowHistoryRecord {
orderNo: string;
symbol: string;
currency: string;
size: number;
actualSize: number;
status: string;
createdTime: number;
}
export interface MarginRepayHistoryV3 {
timestamp: number;
currentPage: number;
pageSize: number;
totalNum: number;
totalPage: number;
items: MarginRepayHistoryRecord[];
}
export interface MarginRepayHistoryRecord {
orderNo: string;
symbol: string | null;
currency: string;
size: string;
principal: string;
interest: string;
status: string;
createdTime: number;
}
export interface MarginInterestRecord {
currency: string;
dayRatio: string;
interestAmount: string;
createdTime: number;
}
export interface MarginInterestRecords {
timestamp: number;
currentPage: number;
pageSize: number;
totalNum: number;
totalPage: number;
items: MarginInterestRecord[];
}
/**
*
* Lending market(v3)
*
*/
interface LendingMarketItem {
currency: string;
purchaseEnable: boolean;
redeemEnable: boolean;
increment: string;
minPurchaseSize: string;
minInterestRate: string;
maxInterestRate: string;
interestIncrement: string;
maxPurchaseSize: string;
marketInterestRate: string;
autoPurchaseEnable: boolean;
}
export interface LendingCurrencyV3 {
currentPage: number;
pageSize: number;
totalNum: number;
totalPage: number;
items: LendingMarketItem[];
}
export interface LendingOrder {
currency: string;
purchaseOrderNo: string;
redeemOrderNo?: string;
redeemAmount?: string;
receiptAmount?: string;
purchaseAmount?: string;
lendAmount?: string;
interestRate?: string;
incomeAmount?: string;
applyTime: number;
status: 'DONE' | 'PENDING';
}
export interface LendingRedemption {
currentPage: number;
pageSize: number;
totalNum: number;
totalPage: number;
items: LendingOrder[];
}
export {};