UNPKG

kucoin-universal-sdk

Version:
170 lines 6.88 kB
"use strict"; // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.OrderV2EventCallbackWrapper = exports.OrderV2Event = void 0; const class_transformer_1 = require("class-transformer"); const common_1 = require("../../../model/common"); class OrderV2Event { constructor() { // @ts-ignore this.clientOid = null; // @ts-ignore this.orderId = null; // @ts-ignore this.orderTime = null; // @ts-ignore this.orderType = null; // @ts-ignore this.originSize = null; // @ts-ignore this.side = null; // @ts-ignore this.status = null; // @ts-ignore this.symbol = null; // @ts-ignore this.ts = null; // @ts-ignore this.type = null; } setCommonResponse(response) { this.commonResponse = response; } /** * Convert the object to a JSON string. */ toJson() { return JSON.stringify((0, class_transformer_1.instanceToPlain)(this)); } /** * Create an object from a JSON string. */ static fromJson(input) { return this.fromObject(JSON.parse(input)); } /** * Create an object from Js Object. */ static fromObject(jsonObject) { return (0, class_transformer_1.plainToClassFromExist)(new OrderV2Event(), jsonObject); } } exports.OrderV2Event = OrderV2Event; __decorate([ (0, class_transformer_1.Exclude)(), __metadata("design:type", common_1.WsMessage) ], OrderV2Event.prototype, "commonResponse", void 0); (function (OrderV2Event) { let OrderTypeEnum; (function (OrderTypeEnum) { /** * limit */ OrderTypeEnum[OrderTypeEnum["LIMIT"] = 'limit'] = "LIMIT"; /** * market */ OrderTypeEnum[OrderTypeEnum["MARKET"] = 'market'] = "MARKET"; })(OrderTypeEnum = OrderV2Event.OrderTypeEnum || (OrderV2Event.OrderTypeEnum = {})); let SideEnum; (function (SideEnum) { /** * buy */ SideEnum[SideEnum["BUY"] = 'buy'] = "BUY"; /** * sell */ SideEnum[SideEnum["SELL"] = 'sell'] = "SELL"; })(SideEnum = OrderV2Event.SideEnum || (OrderV2Event.SideEnum = {})); let StatusEnum; (function (StatusEnum) { /** * the order enters the matching system */ StatusEnum[StatusEnum["_NEW"] = 'new'] = "_NEW"; /** * the order is in the order book (maker order) */ StatusEnum[StatusEnum["OPEN"] = 'open'] = "OPEN"; /** * when taker order executes with orders in the order book, the taker order status is “match” */ StatusEnum[StatusEnum["MATCH"] = 'match'] = "MATCH"; /** * the order is fully executed successfully */ StatusEnum[StatusEnum["DONE"] = 'done'] = "DONE"; })(StatusEnum = OrderV2Event.StatusEnum || (OrderV2Event.StatusEnum = {})); let TypeEnum; (function (TypeEnum) { /** * the order is in the order book (maker order) */ TypeEnum[TypeEnum["OPEN"] = 'open'] = "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. */ TypeEnum[TypeEnum["MATCH"] = '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. */ TypeEnum[TypeEnum["UPDATE"] = 'update'] = "UPDATE"; /** * The message sent when the status of the order changes to DONE after the transaction */ TypeEnum[TypeEnum["FILLED"] = 'filled'] = "FILLED"; /** * The message sent when the status of the order changes to DONE due to being canceled */ TypeEnum[TypeEnum["CANCELED"] = '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. */ TypeEnum[TypeEnum["RECEIVED"] = 'received'] = "RECEIVED"; })(TypeEnum = OrderV2Event.TypeEnum || (OrderV2Event.TypeEnum = {})); let FeeTypeEnum; (function (FeeTypeEnum) { /** * takerFee */ FeeTypeEnum[FeeTypeEnum["TAKERFEE"] = 'takerFee'] = "TAKERFEE"; /** * makerFee */ FeeTypeEnum[FeeTypeEnum["MAKERFEE"] = 'makerFee'] = "MAKERFEE"; })(FeeTypeEnum = OrderV2Event.FeeTypeEnum || (OrderV2Event.FeeTypeEnum = {})); let LiquidityEnum; (function (LiquidityEnum) { /** * taker */ LiquidityEnum[LiquidityEnum["TAKER"] = 'taker'] = "TAKER"; /** * maker */ LiquidityEnum[LiquidityEnum["MAKER"] = 'maker'] = "MAKER"; })(LiquidityEnum = OrderV2Event.LiquidityEnum || (OrderV2Event.LiquidityEnum = {})); })(OrderV2Event || (exports.OrderV2Event = OrderV2Event = {})); class OrderV2EventCallbackWrapper { constructor(callback) { this.callback = callback; this.callback = callback; } onMessage(msg) { let event = OrderV2Event.fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } } exports.OrderV2EventCallbackWrapper = OrderV2EventCallbackWrapper; //# sourceMappingURL=model_order_v2_event.js.map