kucoin-universal-sdk
Version:
Official KuCoin Universal SDK.
216 lines (215 loc) • 5.61 kB
TypeScript
import { WsMessage } from '../../../model/common';
import { WebSocketMessageCallback } from '../../../internal/interfaces/websocket';
import { Response } from '../../../internal/interfaces/serializable';
export declare class OrderEvent implements Response<WsMessage> {
/**
* Symbol of the contract. Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-221752070)
*/
symbol: string;
/**
* User-specified order type
*/
orderType?: OrderEvent.OrderTypeEnum;
/**
* buy or sell
*/
side: OrderEvent.SideEnum;
/**
* Cumulative number of cancellations
*/
canceledSize: string;
/**
* The unique order id generated by the trading system
*/
orderId: string;
/**
* Margin Mode
*/
marginMode: OrderEvent.MarginModeEnum;
/**
* Order Type
*/
type: OrderEvent.TypeEnum;
/**
* Gateway received the message time (milliseconds)
*/
orderTime: number;
/**
* User-specified order size
*/
size: string;
/**
* Cumulative number filled
*/
filledSize: string;
/**
* Price
*/
price: string;
/**
* Remain size
*/
remainSize: string;
/**
* Order Status
*/
status: OrderEvent.StatusEnum;
/**
* Match engine received the message time (nanoseconds)
*/
ts: number;
/**
* Actual transaction order type, If the counterparty order is an [Hidden/Iceberg Order](https://www.kucoin.com/docs-new/doc-338146), even if it is a maker order, this param will be displayed as taker. For actual trading fee, please refer to the **feeType**
*/
liquidity?: OrderEvent.LiquidityEnum;
/**
* Actual Fee Type
*/
feeType?: OrderEvent.FeeTypeEnum;
/**
* Match Price (when the type is \"match\")
*/
matchPrice?: string;
/**
* Match Size (when the type is \"match\")
*/
matchSize?: string;
/**
* Trade ID: Generated by Matching engine.
*/
tradeId?: string;
/**
* The size before order update
*/
oldSize?: string;
/**
* Client Order ID: The ClientOid field is a unique ID created by the user
*/
clientOid?: string;
/**
* normal order or liquid order
*/
tradeType: OrderEvent.TradeTypeEnum;
private constructor();
/**
* common response
*/
commonResponse?: WsMessage;
setCommonResponse(response: WsMessage): void;
/**
* Convert the object to a JSON string.
*/
toJson(): string;
/**
* Create an object from a JSON string.
*/
static fromJson(input: string): OrderEvent;
/**
* Create an object from Js Object.
*/
static fromObject(jsonObject: Object): OrderEvent;
}
export declare namespace OrderEvent {
enum OrderTypeEnum {
/**
* limit
*/
LIMIT,
/**
* market
*/
MARKET
}
enum SideEnum {
/**
* buy
*/
BUY,
/**
* sell
*/
SELL
}
enum MarginModeEnum {
/**
* Isolated Margin
*/
ISOLATED,
/**
* Cross Margin
*/
CROSS
}
enum TypeEnum {
/**
* the order is in the order book (maker order)
*/
OPEN,
/**
* The message sent when the order is match, 1. When the status is open and the type is match, it is a maker match. 2. When the status is match and the type is match, it is a taker match.
*/
MATCH,
/**
* The message sent due to the order being modified: STP triggering, partial cancellation of the order. Includes these three scenarios: 1. When the status is open and the type is update: partial amounts of the order have been canceled, or STP triggers 2. When the status is match and the type is update: STP triggers 3. When the status is done and the type is update: partial amounts of the order have been filled and the unfilled part got canceled, or STP is triggered.
*/
UPDATE,
/**
* The message sent when the status of the order changes to DONE after the transaction
*/
FILLED,
/**
* The message sent when the status of the order changes to DONE due to being canceled
*/
CANCELED
}
enum StatusEnum {
/**
* the order is in the order book (maker order)
*/
OPEN,
/**
* when taker order executes with orders in the order book, the taker order status is “match”
*/
MATCH,
/**
* the order is fully executed successfully
*/
DONE
}
enum LiquidityEnum {
/**
* taker
*/
TAKER,
/**
* maker
*/
MAKER
}
enum FeeTypeEnum {
/**
* takerFee
*/
TAKERFEE,
/**
* makerFee
*/
MAKERFEE
}
enum TradeTypeEnum {
/**
* Normal trade order
*/
TRADE,
/**
* Liquid order; all other types with the exception of type=update will be pushed
*/
LIQUID
}
}
export type OrderEventCallback = (topic: string, subject: string, data: OrderEvent) => void;
export declare class OrderEventCallbackWrapper implements WebSocketMessageCallback {
private callback;
constructor(callback: OrderEventCallback);
onMessage(msg: WsMessage): void;
}