UNPKG

kucoin-universal-sdk

Version:
192 lines 7.36 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.OrderEventCallbackWrapper = exports.OrderEvent = void 0; const class_transformer_1 = require("class-transformer"); const common_1 = require("../../../model/common"); class OrderEvent { constructor() { // @ts-ignore this.symbol = null; // @ts-ignore this.side = null; // @ts-ignore this.canceledSize = null; // @ts-ignore this.orderId = null; // @ts-ignore this.marginMode = null; // @ts-ignore this.type = null; // @ts-ignore this.orderTime = null; // @ts-ignore this.size = null; // @ts-ignore this.filledSize = null; // @ts-ignore this.price = null; // @ts-ignore this.remainSize = null; // @ts-ignore this.status = null; // @ts-ignore this.ts = null; // @ts-ignore this.tradeType = 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 OrderEvent(), jsonObject); } } exports.OrderEvent = OrderEvent; __decorate([ (0, class_transformer_1.Exclude)(), __metadata("design:type", common_1.WsMessage) ], OrderEvent.prototype, "commonResponse", void 0); (function (OrderEvent) { let OrderTypeEnum; (function (OrderTypeEnum) { /** * limit */ OrderTypeEnum[OrderTypeEnum["LIMIT"] = 'limit'] = "LIMIT"; /** * market */ OrderTypeEnum[OrderTypeEnum["MARKET"] = 'market'] = "MARKET"; })(OrderTypeEnum = OrderEvent.OrderTypeEnum || (OrderEvent.OrderTypeEnum = {})); let SideEnum; (function (SideEnum) { /** * buy */ SideEnum[SideEnum["BUY"] = 'buy'] = "BUY"; /** * sell */ SideEnum[SideEnum["SELL"] = 'sell'] = "SELL"; })(SideEnum = OrderEvent.SideEnum || (OrderEvent.SideEnum = {})); let MarginModeEnum; (function (MarginModeEnum) { /** * Isolated Margin */ MarginModeEnum[MarginModeEnum["ISOLATED"] = 'ISOLATED'] = "ISOLATED"; /** * Cross Margin */ MarginModeEnum[MarginModeEnum["CROSS"] = 'CROSS'] = "CROSS"; })(MarginModeEnum = OrderEvent.MarginModeEnum || (OrderEvent.MarginModeEnum = {})); 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"; })(TypeEnum = OrderEvent.TypeEnum || (OrderEvent.TypeEnum = {})); let StatusEnum; (function (StatusEnum) { /** * 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 = OrderEvent.StatusEnum || (OrderEvent.StatusEnum = {})); let LiquidityEnum; (function (LiquidityEnum) { /** * taker */ LiquidityEnum[LiquidityEnum["TAKER"] = 'taker'] = "TAKER"; /** * maker */ LiquidityEnum[LiquidityEnum["MAKER"] = 'maker'] = "MAKER"; })(LiquidityEnum = OrderEvent.LiquidityEnum || (OrderEvent.LiquidityEnum = {})); let FeeTypeEnum; (function (FeeTypeEnum) { /** * takerFee */ FeeTypeEnum[FeeTypeEnum["TAKERFEE"] = 'takerFee'] = "TAKERFEE"; /** * makerFee */ FeeTypeEnum[FeeTypeEnum["MAKERFEE"] = 'makerFee'] = "MAKERFEE"; })(FeeTypeEnum = OrderEvent.FeeTypeEnum || (OrderEvent.FeeTypeEnum = {})); let TradeTypeEnum; (function (TradeTypeEnum) { /** * Normal trade order */ TradeTypeEnum[TradeTypeEnum["TRADE"] = 'trade'] = "TRADE"; /** * Liquid order; all other types with the exception of type&#x3D;update will be pushed */ TradeTypeEnum[TradeTypeEnum["LIQUID"] = 'liquid'] = "LIQUID"; })(TradeTypeEnum = OrderEvent.TradeTypeEnum || (OrderEvent.TradeTypeEnum = {})); })(OrderEvent || (exports.OrderEvent = OrderEvent = {})); class OrderEventCallbackWrapper { constructor(callback) { this.callback = callback; this.callback = callback; } onMessage(msg) { let event = OrderEvent.fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } } exports.OrderEventCallbackWrapper = OrderEventCallbackWrapper; //# sourceMappingURL=model_order_event.js.map