kucoin-universal-sdk
Version:
Official KuCoin Universal SDK.
302 lines (301 loc) • 13.3 kB
TypeScript
import { Serializable } from '../../../internal/interfaces/serializable';
export declare class AddTPSLOrderReq implements Serializable {
/**
* Unique order ID created by users to identify their orders. The maximum length cannot exceed 40, e.g. UUID only allows numbers, characters, underline(_), and separator (-).
*/
clientOid: string;
/**
* Specify if the order is to \'buy\' or \'sell\'.
*/
side: AddTPSLOrderReq.SideEnum;
/**
* Symbol of the contract. Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220)
*/
symbol: string;
/**
* Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required.
*/
leverage: number;
/**
* Specify if the order is a \'limit\' order or \'market\' order
*/
type: AddTPSLOrderReq.TypeEnum;
/**
* Either \'TP\' or \'MP\'
*/
stopPriceType?: AddTPSLOrderReq.StopPriceTypeEnum;
/**
* A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true. If set to true, only the orders reducing the position size will be executed. If the reduce-only order size exceeds the position size, the extra size will be canceled.
*/
reduceOnly?: boolean;
/**
* A mark to close the position. Set to false by default. If closeOrder is set to true, the system will close the position and the position size will become 0. Side, Size and Leverage fields can be left empty and the system will determine the side and size automatically.
*/
closeOrder?: boolean;
/**
* Margin mode: ISOLATED, default: ISOLATED
*/
marginMode?: AddTPSLOrderReq.MarginModeEnum;
/**
* Required for type is \'limit\' order, indicating the operating price
*/
price?: string;
/**
* Order size (lot), must be a positive integer. The quantity unit of coin-swap contracts is size (lot), and other units are not supported.
*/
size: number;
/**
* Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC
*/
timeInForce?: AddTPSLOrderReq.TimeInForceEnum;
/**
* Optional for type is \'limit\' order, post only flag, invalid when timeInForce is IOC. When postOnly is true, choosing hidden or iceberg is not allowed. The post-only flag ensures that the trader always pays the maker fee and provides liquidity to the order book. If any part of the order is going to pay taker fees, the order will be fully rejected.
*/
postOnly?: boolean;
/**
* Optional for type is \'limit\' order, orders not displaying in order book. When hidden is chosen, choosing postOnly is not allowed.
*/
hidden?: boolean;
/**
* Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg is chosen, choosing postOnly is not allowed.
*/
iceberg?: boolean;
/**
* Optional for type is \'limit\' order, the maximum visible size of an iceberg order. Please place order in size (lots). The units of qty (base currency) and valueQty (value) are not supported. Need to be defined if iceberg is specified.
*/
visibleSize?: string;
/**
* Take profit price
*/
triggerStopUpPrice?: string;
/**
* Stop loss price
*/
triggerStopDownPrice?: string;
/**
* Private constructor, please use the corresponding static methods to construct the object.
*/
private constructor();
/**
* Creates a new instance of the `AddTPSLOrderReq` class.
* The builder pattern allows step-by-step construction of a `AddTPSLOrderReq` object.
*/
static builder(): AddTPSLOrderReqBuilder;
/**
* Creates a new instance of the `AddTPSLOrderReq` class with the given data.
*/
static create(data: {
/**
* Unique order ID created by users to identify their orders. The maximum length cannot exceed 40, e.g. UUID only allows numbers, characters, underline(_), and separator (-).
*/
clientOid: string;
/**
* Specify if the order is to \'buy\' or \'sell\'.
*/
side: AddTPSLOrderReq.SideEnum;
/**
* Symbol of the contract. Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220)
*/
symbol: string;
/**
* Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required.
*/
leverage: number;
/**
* Specify if the order is a \'limit\' order or \'market\' order
*/
type: AddTPSLOrderReq.TypeEnum;
/**
* Either \'TP\' or \'MP\'
*/
stopPriceType?: AddTPSLOrderReq.StopPriceTypeEnum;
/**
* A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true. If set to true, only the orders reducing the position size will be executed. If the reduce-only order size exceeds the position size, the extra size will be canceled.
*/
reduceOnly?: boolean;
/**
* A mark to close the position. Set to false by default. If closeOrder is set to true, the system will close the position and the position size will become 0. Side, Size and Leverage fields can be left empty and the system will determine the side and size automatically.
*/
closeOrder?: boolean;
/**
* Margin mode: ISOLATED, default: ISOLATED
*/
marginMode?: AddTPSLOrderReq.MarginModeEnum;
/**
* Required for type is \'limit\' order, indicating the operating price
*/
price?: string;
/**
* Order size (lot), must be a positive integer. The quantity unit of coin-swap contracts is size (lot), and other units are not supported.
*/
size: number;
/**
* Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC
*/
timeInForce?: AddTPSLOrderReq.TimeInForceEnum;
/**
* Optional for type is \'limit\' order, post only flag, invalid when timeInForce is IOC. When postOnly is true, choosing hidden or iceberg is not allowed. The post-only flag ensures that the trader always pays the maker fee and provides liquidity to the order book. If any part of the order is going to pay taker fees, the order will be fully rejected.
*/
postOnly?: boolean;
/**
* Optional for type is \'limit\' order, orders not displaying in order book. When hidden is chosen, choosing postOnly is not allowed.
*/
hidden?: boolean;
/**
* Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg is chosen, choosing postOnly is not allowed.
*/
iceberg?: boolean;
/**
* Optional for type is \'limit\' order, the maximum visible size of an iceberg order. Please place order in size (lots). The units of qty (base currency) and valueQty (value) are not supported. Need to be defined if iceberg is specified.
*/
visibleSize?: string;
/**
* Take profit price
*/
triggerStopUpPrice?: string;
/**
* Stop loss price
*/
triggerStopDownPrice?: string;
}): AddTPSLOrderReq;
/**
* Convert the object to a JSON string.
*/
toJson(): string;
/**
* Create an object from a JSON string.
*/
static fromJson(input: string): AddTPSLOrderReq;
/**
* Create an object from Js Object.
*/
static fromObject(jsonObject: Object): AddTPSLOrderReq;
}
export declare namespace AddTPSLOrderReq {
enum SideEnum {
/**
*
*/
BUY,
/**
*
*/
SELL
}
enum TypeEnum {
/**
* limit order
*/
LIMIT,
/**
* market order
*/
MARKET
}
enum StopPriceTypeEnum {
/**
* TP for trade price, The last trade price is the last price at which an order was filled. This price can be found in the latest match message.
*/
TRADE_PRICE,
/**
* MP for mark price. The mark price can be obtained through relevant OPEN API for index services.
*/
MARK_PRICE
}
enum MarginModeEnum {
/**
*
*/
ISOLATED
}
enum TimeInForceEnum {
/**
* Order remains open on the order book until canceled. This is the default type if the field is left empty.
*/
GOOD_TILL_CANCELED,
/**
* Being matched or not, the remaining size of the order will be instantly canceled instead of entering the order book.
*/
IMMEDIATE_OR_CANCEL
}
}
export declare class AddTPSLOrderReqBuilder {
readonly obj: AddTPSLOrderReq;
constructor(obj: AddTPSLOrderReq);
/**
* Unique order ID created by users to identify their orders. The maximum length cannot exceed 40, e.g. UUID only allows numbers, characters, underline(_), and separator (-).
*/
setClientOid(value: string): AddTPSLOrderReqBuilder;
/**
* Specify if the order is to \'buy\' or \'sell\'.
*/
setSide(value: AddTPSLOrderReq.SideEnum): AddTPSLOrderReqBuilder;
/**
* Symbol of the contract. Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220)
*/
setSymbol(value: string): AddTPSLOrderReqBuilder;
/**
* Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required.
*/
setLeverage(value: number): AddTPSLOrderReqBuilder;
/**
* Specify if the order is a \'limit\' order or \'market\' order
*/
setType(value: AddTPSLOrderReq.TypeEnum): AddTPSLOrderReqBuilder;
/**
* Either \'TP\' or \'MP\'
*/
setStopPriceType(value: AddTPSLOrderReq.StopPriceTypeEnum): AddTPSLOrderReqBuilder;
/**
* A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true. If set to true, only the orders reducing the position size will be executed. If the reduce-only order size exceeds the position size, the extra size will be canceled.
*/
setReduceOnly(value: boolean): AddTPSLOrderReqBuilder;
/**
* A mark to close the position. Set to false by default. If closeOrder is set to true, the system will close the position and the position size will become 0. Side, Size and Leverage fields can be left empty and the system will determine the side and size automatically.
*/
setCloseOrder(value: boolean): AddTPSLOrderReqBuilder;
/**
* Margin mode: ISOLATED, default: ISOLATED
*/
setMarginMode(value: AddTPSLOrderReq.MarginModeEnum): AddTPSLOrderReqBuilder;
/**
* Required for type is \'limit\' order, indicating the operating price
*/
setPrice(value: string): AddTPSLOrderReqBuilder;
/**
* Order size (lot), must be a positive integer. The quantity unit of coin-swap contracts is size (lot), and other units are not supported.
*/
setSize(value: number): AddTPSLOrderReqBuilder;
/**
* Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC
*/
setTimeInForce(value: AddTPSLOrderReq.TimeInForceEnum): AddTPSLOrderReqBuilder;
/**
* Optional for type is \'limit\' order, post only flag, invalid when timeInForce is IOC. When postOnly is true, choosing hidden or iceberg is not allowed. The post-only flag ensures that the trader always pays the maker fee and provides liquidity to the order book. If any part of the order is going to pay taker fees, the order will be fully rejected.
*/
setPostOnly(value: boolean): AddTPSLOrderReqBuilder;
/**
* Optional for type is \'limit\' order, orders not displaying in order book. When hidden is chosen, choosing postOnly is not allowed.
*/
setHidden(value: boolean): AddTPSLOrderReqBuilder;
/**
* Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg is chosen, choosing postOnly is not allowed.
*/
setIceberg(value: boolean): AddTPSLOrderReqBuilder;
/**
* Optional for type is \'limit\' order, the maximum visible size of an iceberg order. Please place order in size (lots). The units of qty (base currency) and valueQty (value) are not supported. Need to be defined if iceberg is specified.
*/
setVisibleSize(value: string): AddTPSLOrderReqBuilder;
/**
* Take profit price
*/
setTriggerStopUpPrice(value: string): AddTPSLOrderReqBuilder;
/**
* Stop loss price
*/
setTriggerStopDownPrice(value: string): AddTPSLOrderReqBuilder;
/**
* Get the final object.
*/
build(): AddTPSLOrderReq;
}