kucoin-universal-sdk
Version:
Official KuCoin Universal SDK.
175 lines • 6.96 kB
JavaScript
;
// 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.StopOrderEventCallbackWrapper = exports.StopOrderEvent = void 0;
const class_transformer_1 = require("class-transformer");
const common_1 = require("../../../model/common");
class StopOrderEvent {
constructor() {
// @ts-ignore
this.createdAt = null;
// @ts-ignore
this.orderId = null;
// @ts-ignore
this.orderPrice = null;
// @ts-ignore
this.orderType = null;
// @ts-ignore
this.side = null;
// @ts-ignore
this.size = null;
// @ts-ignore
this.stop = null;
// @ts-ignore
this.stopPrice = null;
// @ts-ignore
this.symbol = null;
// @ts-ignore
this.tradeType = 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 StopOrderEvent(), jsonObject);
}
}
exports.StopOrderEvent = StopOrderEvent;
__decorate([
(0, class_transformer_1.Exclude)(),
__metadata("design:type", common_1.WsMessage)
], StopOrderEvent.prototype, "commonResponse", void 0);
(function (StopOrderEvent) {
let OrderTypeEnum;
(function (OrderTypeEnum) {
/**
* stop
*/
OrderTypeEnum[OrderTypeEnum["STOP"] = 'stop'] = "STOP";
})(OrderTypeEnum = StopOrderEvent.OrderTypeEnum || (StopOrderEvent.OrderTypeEnum = {}));
let SideEnum;
(function (SideEnum) {
/**
* buy
*/
SideEnum[SideEnum["BUY"] = 'buy'] = "BUY";
/**
* sell
*/
SideEnum[SideEnum["SELL"] = 'sell'] = "SELL";
})(SideEnum = StopOrderEvent.SideEnum || (StopOrderEvent.SideEnum = {}));
let StopEnum;
(function (StopEnum) {
/**
* stop loss order
*/
StopEnum[StopEnum["LOSS"] = 'loss'] = "LOSS";
/**
* Take profit order
*/
StopEnum[StopEnum["ENTRY"] = 'entry'] = "ENTRY";
/**
* Limit stop loss OCO order
*/
StopEnum[StopEnum["L_L_O"] = 'l_l_o'] = "L_L_O";
/**
* Trigger stop loss OCO order
*/
StopEnum[StopEnum["L_S_O"] = 'l_s_o'] = "L_S_O";
/**
* Limit stop profit OCO order
*/
StopEnum[StopEnum["E_L_O"] = 'e_l_o'] = "E_L_O";
/**
* Trigger stop profit OCO order
*/
StopEnum[StopEnum["E_S_O"] = 'e_s_o'] = "E_S_O";
/**
* Moving stop loss order
*/
StopEnum[StopEnum["TSO"] = 'tso'] = "TSO";
})(StopEnum = StopOrderEvent.StopEnum || (StopOrderEvent.StopEnum = {}));
let TradeTypeEnum;
(function (TradeTypeEnum) {
/**
* Spot
*/
TradeTypeEnum[TradeTypeEnum["TRADE"] = 'TRADE'] = "TRADE";
/**
* Spot margin trade
*/
TradeTypeEnum[TradeTypeEnum["MARGIN_TRADE"] = 'MARGIN_TRADE'] = "MARGIN_TRADE";
/**
* Spot margin isolated trade
*/
TradeTypeEnum[TradeTypeEnum["MARGIN_ISOLATED_TRADE"] = 'MARGIN_ISOLATED_TRADE'] = "MARGIN_ISOLATED_TRADE";
})(TradeTypeEnum = StopOrderEvent.TradeTypeEnum || (StopOrderEvent.TradeTypeEnum = {}));
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 matched, 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["CANCEL"] = 'cancel'] = "CANCEL";
/**
* 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 "received" and the order status "new" will be pushed.
*/
TypeEnum[TypeEnum["RECEIVED"] = 'received'] = "RECEIVED";
})(TypeEnum = StopOrderEvent.TypeEnum || (StopOrderEvent.TypeEnum = {}));
})(StopOrderEvent || (exports.StopOrderEvent = StopOrderEvent = {}));
class StopOrderEventCallbackWrapper {
constructor(callback) {
this.callback = callback;
this.callback = callback;
}
onMessage(msg) {
let event = StopOrderEvent.fromObject(msg.data);
event.setCommonResponse(msg);
this.callback(msg.topic, msg.subject, event);
}
}
exports.StopOrderEventCallbackWrapper = StopOrderEventCallbackWrapper;
//# sourceMappingURL=model_stop_order_event.js.map