kucoin-universal-sdk
Version:
Official KuCoin Universal SDK.
136 lines • 4.73 kB
JavaScript
"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.PositionEventCallbackWrapper = exports.PositionEvent = void 0;
const class_transformer_1 = require("class-transformer");
const common_1 = require("../../../model/common");
class PositionEvent {
constructor() {
// @ts-ignore
this.symbol = null;
// @ts-ignore
this.crossMode = null;
// @ts-ignore
this.delevPercentage = null;
// @ts-ignore
this.openingTimestamp = null;
// @ts-ignore
this.currentTimestamp = null;
// @ts-ignore
this.currentQty = null;
// @ts-ignore
this.currentCost = null;
// @ts-ignore
this.currentComm = null;
// @ts-ignore
this.unrealisedCost = null;
// @ts-ignore
this.realisedGrossCost = null;
// @ts-ignore
this.realisedCost = null;
// @ts-ignore
this.isOpen = null;
// @ts-ignore
this.markPrice = null;
// @ts-ignore
this.markValue = null;
// @ts-ignore
this.posCost = null;
// @ts-ignore
this.posInit = null;
// @ts-ignore
this.posMargin = null;
// @ts-ignore
this.realisedGrossPnl = null;
// @ts-ignore
this.realisedPnl = null;
// @ts-ignore
this.unrealisedPnl = null;
// @ts-ignore
this.unrealisedPnlPcnt = null;
// @ts-ignore
this.unrealisedRoePcnt = null;
// @ts-ignore
this.avgEntryPrice = null;
// @ts-ignore
this.liquidationPrice = null;
// @ts-ignore
this.bankruptPrice = null;
// @ts-ignore
this.settleCurrency = null;
// @ts-ignore
this.marginMode = null;
// @ts-ignore
this.positionSide = null;
// @ts-ignore
this.leverage = 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 PositionEvent(), jsonObject);
}
}
exports.PositionEvent = PositionEvent;
__decorate([
(0, class_transformer_1.Exclude)(),
__metadata("design:type", common_1.WsMessage)
], PositionEvent.prototype, "commonResponse", void 0);
(function (PositionEvent) {
let MarginModeEnum;
(function (MarginModeEnum) {
/**
* cross margin
*/
MarginModeEnum[MarginModeEnum["CROSS"] = 'CROSS'] = "CROSS";
/**
* isolated margin
*/
MarginModeEnum[MarginModeEnum["ISOLATED"] = 'ISOLATED'] = "ISOLATED";
})(MarginModeEnum = PositionEvent.MarginModeEnum || (PositionEvent.MarginModeEnum = {}));
let PositionSideEnum;
(function (PositionSideEnum) {
/**
* One-way position
*/
PositionSideEnum[PositionSideEnum["BOTH"] = 'BOTH'] = "BOTH";
})(PositionSideEnum = PositionEvent.PositionSideEnum || (PositionEvent.PositionSideEnum = {}));
})(PositionEvent || (exports.PositionEvent = PositionEvent = {}));
class PositionEventCallbackWrapper {
constructor(callback) {
this.callback = callback;
this.callback = callback;
}
onMessage(msg) {
let event = PositionEvent.fromObject(msg.data);
event.setCommonResponse(msg);
this.callback(msg.topic, msg.subject, event);
}
}
exports.PositionEventCallbackWrapper = PositionEventCallbackWrapper;
//# sourceMappingURL=model_position_event.js.map