UNPKG

kucoin-universal-sdk

Version:
204 lines (203 loc) 5.52 kB
import { WsMessage } from '../../../model/common'; import { WebSocketMessageCallback } from '../../../internal/interfaces/websocket'; import { Response } from '../../../internal/interfaces/serializable'; export declare class OrderV2Event implements Response<WsMessage> { /** * Cumulative number of cancellations */ canceledSize?: string; /** * Client Order ID: The ClientOid field is a unique ID created by the user */ clientOid: string; /** * Cumulative number filled */ filledSize?: string; /** * The unique order id generated by the trading system */ orderId: string; /** * Gateway received the message time (milliseconds) */ orderTime: number; /** * User-specified order type */ orderType: OrderV2Event.OrderTypeEnum; /** * User-specified order size */ originSize: string; /** * Price */ price?: string; /** * Remain funds */ remainFunds?: string; /** * Remain size */ remainSize?: string; /** * buy or sell */ side: OrderV2Event.SideEnum; /** * User-specified order size */ size?: string; /** * Order Status */ status: OrderV2Event.StatusEnum; /** * Symbol */ symbol: string; /** * Match engine received the message time (nanoseconds) */ ts: number; /** * Order Type */ type: OrderV2Event.TypeEnum; /** * The size before order update */ oldSize?: string; /** * Actual Fee Type */ feeType?: OrderV2Event.FeeTypeEnum; /** * 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?: OrderV2Event.LiquidityEnum; /** * 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; 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): OrderV2Event; /** * Create an object from Js Object. */ static fromObject(jsonObject: Object): OrderV2Event; } export declare namespace OrderV2Event { enum OrderTypeEnum { /** * limit */ LIMIT, /** * market */ MARKET } enum SideEnum { /** * buy */ BUY, /** * sell */ SELL } enum StatusEnum { /** * the order enters the matching system */ _NEW, /** * 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 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, /** * The message sent when the order enters the matching system. When the order has just entered the matching system and has not yet done matching logic with the counterparty, a private message with the message type &quot;received&quot; and the order status &quot;new&quot; will be pushed. */ RECEIVED } enum FeeTypeEnum { /** * takerFee */ TAKERFEE, /** * makerFee */ MAKERFEE } enum LiquidityEnum { /** * taker */ TAKER, /** * maker */ MAKER } } export type OrderV2EventCallback = (topic: string, subject: string, data: OrderV2Event) => void; export declare class OrderV2EventCallbackWrapper implements WebSocketMessageCallback { private callback; constructor(callback: OrderV2EventCallback); onMessage(msg: WsMessage): void; }