kucoin-api
Version:
Complete & robust Node.js SDK for Kucoin's REST APIs and WebSockets, with TypeScript & strong end to end tests.
263 lines (262 loc) • 5.94 kB
TypeScript
/**
*
***********
* Margin Trading
***********
*
*/
/**
*
* Margin HF trade
*
*/
export interface SubmitHFMarginOrderRequest {
clientOid: string;
side: 'buy' | 'sell';
symbol: string;
type?: 'limit' | 'market';
stp?: 'CN' | 'CO' | 'CB' | 'DC';
isIsolated?: boolean;
autoBorrow?: boolean;
autoRepay?: boolean;
price?: string;
size?: string;
timeInForce?: 'GTC' | 'GTT' | 'IOC' | 'FOK';
cancelAfter?: number;
postOnly?: boolean;
hidden?: boolean;
iceberg?: boolean;
visibleSize?: string;
funds?: string;
}
export interface HFMarginRequestOrder {
symbol: string;
tradeType: 'MARGIN_TRADE' | 'MARGIN_ISOLATED_TRADE';
}
export interface GetHFMarginFilledRequest {
symbol: string;
tradeType: 'MARGIN_TRADE' | 'MARGIN_ISOLATED_TRADE';
side?: 'buy' | 'sell';
type?: 'limit' | 'market';
startAt?: number;
endAt?: number;
lastId?: number;
limit?: number;
}
export interface getHFMarginFillsRequest {
orderId?: string;
symbol: string;
tradeType: 'MARGIN_TRADE' | 'MARGIN_ISOLATED_TRADE';
side?: 'buy' | 'sell';
type?: 'limit' | 'market';
startAt?: number;
endAt?: number;
lastId?: number;
limit?: number;
}
/**
*
* Orders
*
*/
export interface SubmitMarginOrderRequest {
clientOid: string;
side: 'buy' | 'sell';
symbol: string;
type?: 'limit' | 'market';
remark?: string;
stp?: 'CN' | 'CO' | 'CB' | 'DC';
marginModel?: 'cross' | 'isolated';
autoBorrow?: boolean;
autoRepay?: boolean;
price: string;
size?: string;
timeInForce?: 'GTC' | 'GTT' | 'IOC' | 'FOK';
cancelAfter?: number;
postOnly?: boolean;
hidden?: boolean;
iceberg?: boolean;
visibleSize?: string;
funds?: string;
}
/**
*
* Margin info
*
*/
export interface MarginRiskLimitRequest {
isIsolated: boolean;
symbol?: string;
currency?: string;
}
/**
*
* Isolated Margin
*
*/
/**
*
* Margin trading(v3)
*
*/
export interface MarginBorrowV3Request {
isIsolated?: boolean;
symbol?: string;
currency: string;
size: number;
timeInForce: 'IOC' | 'FOK';
isHf: boolean;
}
export interface MarginRepayV3Request {
isIsolated?: boolean;
symbol?: string;
currency: string;
size: number;
isHf: boolean;
}
export interface MarginHistoryV3Request {
currency: string;
isIsolated?: boolean;
symbol?: string;
orderNo?: string;
startTime?: number;
endTime?: number;
currentPage?: number;
pageSize?: number;
}
export interface MarginInterestRecordsRequest {
isIsolated?: boolean;
symbol?: string;
currency?: string;
startTime?: number;
endTime?: number;
currentPage?: number;
pageSize?: number;
}
/**
*
* Lending market(v3)
*
*/
export interface InitiateLendingSubscriptionV3Request {
currency: string;
size: string;
interestRate: string;
}
export interface InitiateLendingRedemptionV3Request {
currency: string;
size: string;
purchaseOrderNo: string;
}
export interface ModifyLendingSubscriptionOrdersV3Request {
currency: string;
purchaseOrderNo: string;
interestRate: string;
}
export interface GetLendingRedemptionOrdersV3Request {
currency: string;
redeemOrderNo?: string;
status: 'DONE' | 'PENDING';
currentPage?: number;
pageSize?: number;
}
export interface GetLendingSubscriptionOrdersV3Request {
currency: string;
purchaseOrderNo?: string;
status: 'DONE' | 'PENDING';
currentPage?: number;
pageSize?: number;
}
export interface GetBorrowInterestRateRequest {
vipLevel?: number;
currency?: string;
}
/**
* Margin Stop Order Requests
*/
export interface SubmitMarginStopOrderRequest {
clientOid: string;
side: 'buy' | 'sell';
symbol: string;
type?: 'limit' | 'market';
remark?: string;
stop?: string;
stopPrice: string;
stp?: 'DC' | 'CO' | 'CN' | 'CB';
isIsolated: boolean;
autoRepay: boolean;
autoBorrow: boolean;
price?: string;
size?: string;
timeInForce?: 'GTC' | 'GTT' | 'IOC' | 'FOK';
cancelAfter?: number;
postOnly?: boolean;
hidden?: boolean;
iceberg?: boolean;
visibleSize?: string;
funds?: string;
}
export interface CancelMarginStopOrderByClientOidRequest {
clientOid: string;
}
export interface BatchCancelMarginStopOrdersRequest {
symbol?: string;
tradeType: 'MARGIN_TRADE' | 'MARGIN_ISOLATED_TRADE';
orderIds?: string;
}
export interface GetMarginStopOrdersListRequest {
symbol?: string;
side?: string;
type?: 'limit' | 'market' | 'limit_stop' | 'market_stop';
tradeType?: 'MARGIN_TRADE' | 'MARGIN_ISOLATED_TRADE';
startAt?: number;
endAt?: number;
currentPage?: number;
orderIds?: string;
pageSize?: number;
stop?: 'stop' | 'oco';
}
export interface GetMarginStopOrderByOrderIdRequest {
orderId: string;
}
export interface GetMarginStopOrderByClientOidRequest {
clientOid: string;
}
/**
* Margin OCO Order Requests
*/
export interface SubmitMarginOcoOrderRequest {
symbol: string;
side: 'buy' | 'sell';
price: string;
size: string;
stopPrice: string;
limitPrice: string;
clientOid: string;
isIsolated: boolean;
autoRepay?: boolean;
autoBorrow?: boolean;
}
export interface CancelMarginOcoOrderByOrderIdRequest {
orderId: string;
}
export interface CancelMarginOcoOrderByClientOidRequest {
clientOid: string;
}
export interface BatchCancelMarginOcoOrdersRequest {
orderIds?: string;
symbol?: string;
tradeType?: 'MARGIN_TRADE' | 'MARGIN_ISOLATED_TRADE';
}
export interface GetMarginOcoOrderByClientOidRequest {
clientOid: string;
}
export interface GetMarginOcoOrderDetailByOrderIdRequest {
orderId: string;
}
/**
* Get Margin Collateral Ratio
*/
export interface GetMarginCollateralRatioRequest {
currencyList?: string;
}