kucoin-universal-sdk
Version:
Official KuCoin Universal SDK.
232 lines (231 loc) • 5.55 kB
TypeScript
import { WsMessage } from '../../../model/common';
import { WebSocketMessageCallback } from '../../../internal/interfaces/websocket';
import { Response } from '../../../internal/interfaces/serializable';
export declare class PositionEvent implements Response<WsMessage> {
/**
* Symbol of the contract. Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-221752070)
*/
symbol: string;
/**
* Whether it is cross margin.
*/
crossMode: boolean;
/**
* ADL ranking percentile
*/
delevPercentage: number;
/**
* Open time
*/
openingTimestamp: number;
/**
* Current timestamp
*/
currentTimestamp: number;
/**
* Current position quantity
*/
currentQty: number;
/**
* Current position value
*/
currentCost: number;
/**
* Current commission
*/
currentComm: number;
/**
* Unrealized value
*/
unrealisedCost: number;
/**
* Accumulated realized gross profit value
*/
realisedGrossCost: number;
/**
* Current realized position value
*/
realisedCost: number;
/**
* Opened position or not
*/
isOpen: boolean;
/**
* Mark price
*/
markPrice: number;
/**
* Mark Value
*/
markValue: number;
/**
* Position value
*/
posCost: number;
/**
* Inital margin Cross = opening value/cross leverage; isolated = accumulation of initial margin for each transaction
*/
posInit: number;
/**
* Bankruptcy cost Cross = mark value * imr; Isolated = position margin (accumulation of initial margin, additional margin, generated funding fees, etc.)
*/
posMargin: number;
/**
* Accumulated realized gross profit value
*/
realisedGrossPnl: number;
/**
* Realized profit and loss
*/
realisedPnl: number;
/**
* Unrealized profit and loss
*/
unrealisedPnl: number;
/**
* Profit-loss ratio of the position
*/
unrealisedPnlPcnt: number;
/**
* Rate of return on investment
*/
unrealisedRoePcnt: number;
/**
* Average entry price
*/
avgEntryPrice: number;
/**
* Liquidation price: For Cross Margin, you can refer to the liquidationPrice, and the liquidation is based on the risk rate.
*/
liquidationPrice: number;
/**
* Bankruptcy price: For Cross Margin, you can refer to the bankruptPrice, and the liquidation is based on the risk rate.
*/
bankruptPrice: number;
/**
* Currency used to clear and settle the trades
*/
settleCurrency: string;
/**
* Margin Mode: CROSS, ISOLATED
*/
marginMode: PositionEvent.MarginModeEnum;
/**
* Position Side
*/
positionSide: PositionEvent.PositionSideEnum;
/**
* Leverage
*/
leverage: number;
/**
* Auto deposit margin or not **Only applicable to Isolated Margin**
*/
autoDeposit?: boolean;
/**
* Maintenance margin requirement
*/
maintMarginReq?: number;
/**
* Risk limit **Only applicable to Isolated Margin**
*/
riskLimit?: number;
/**
* Leverage of the order **Only applicable to Isolated Margin**
*/
realLeverage?: number;
/**
* Added margin **Only applicable to Isolated Margin**
*/
posCross?: number;
/**
* Bankruptcy cost **Only applicable to Isolated Margin**
*/
posComm?: number;
/**
* Funding fees paid out **Only applicable to Isolated Margin**
*/
posLoss?: number;
/**
* The current remaining unsettled funding fee for the position **Only applicable to Isolated Margin**
*/
posFunding?: number;
/**
* Maintenance margin
*/
posMaint?: number;
/**
* Position margin **Only applicable to Isolated Margin**
*/
maintMargin?: number;
/**
* Funding time
*/
fundingTime?: number;
/**
* Position size
*/
qty?: number;
/**
* Funding rate
*/
fundingRate?: number;
/**
* Funding fees
*/
fundingFee?: number;
/**
* Funding Fee Settlement Time (nanoseconds)
*/
ts?: number;
/**
* Adjustment isolated margin risk limit level successful or not
*/
success?: boolean;
/**
* Adjustment isolated margin risk limit level failure reason
*/
msg?: 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): PositionEvent;
/**
* Create an object from Js Object.
*/
static fromObject(jsonObject: Object): PositionEvent;
}
export declare namespace PositionEvent {
enum MarginModeEnum {
/**
* cross margin
*/
CROSS,
/**
* isolated margin
*/
ISOLATED
}
enum PositionSideEnum {
/**
* One-way position
*/
BOTH
}
}
export type PositionEventCallback = (topic: string, subject: string, data: PositionEvent) => void;
export declare class PositionEventCallbackWrapper implements WebSocketMessageCallback {
private callback;
constructor(callback: PositionEventCallback);
onMessage(msg: WsMessage): void;
}