kucoin-universal-sdk
Version:
Official KuCoin Universal SDK.
394 lines (393 loc) • 18.6 kB
TypeScript
import { Serializable } from '../../../internal/interfaces/serializable';
export declare class AddOrderReq 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: AddOrderReq.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?: AddOrderReq.TypeEnum;
/**
* Remark for the order: Length cannot exceed 100 utf8 characters
*/
remark?: string;
/**
* Either \'down\' or \'up\'. If stop is used, parameter stopPrice and stopPriceType also need to be provided.
*/
stop?: AddOrderReq.StopEnum;
/**
* Either \'TP\', \'IP\' or \'MP\', Need to be defined if stop is specified.
*/
stopPriceType?: AddOrderReq.StopPriceTypeEnum;
/**
* Needs to be defined if stop is specified.
*/
stopPrice?: string;
/**
* 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;
/**
* A mark to force-hold the funds for an order, even though it\'s an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default. The system will force-freeze a certain amount of funds for this order, including orders whose direction is opposite to the current positions. This feature is to ensure that the order won’t be canceled by the matching engine in such a way that not enough funds are frozen for the order.
*/
forceHold?: boolean;
/**
* [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB. DC not currently supported.
*/
stp?: AddOrderReq.StpEnum;
/**
* Margin mode: ISOLATED, CROSS, default: ISOLATED
*/
marginMode?: AddOrderReq.MarginModeEnum;
/**
* Required for type is \'limit\' order, indicating the operating price
*/
price?: string;
/**
* **Choose one of size, qty, valueQty**, 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?: AddOrderReq.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;
/**
* **Choose one of size, qty, valueQty**. Order size (base currency) must be an integer multiple of the multiplier. The unit of the quantity of coin-swap is size (lot), which is not supported.
*/
qty?: string;
/**
* **Choose one of size, qty, valueQty**. Order size (Value), USDS-Swap correspond to USDT or USDC. The unit of the quantity of coin-swap is size (lot), which is not supported.
*/
valueQty?: string;
/**
* Private constructor, please use the corresponding static methods to construct the object.
*/
private constructor();
/**
* Creates a new instance of the `AddOrderReq` class.
* The builder pattern allows step-by-step construction of a `AddOrderReq` object.
*/
static builder(): AddOrderReqBuilder;
/**
* Creates a new instance of the `AddOrderReq` 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: AddOrderReq.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?: AddOrderReq.TypeEnum;
/**
* Remark for the order: Length cannot exceed 100 utf8 characters
*/
remark?: string;
/**
* Either \'down\' or \'up\'. If stop is used, parameter stopPrice and stopPriceType also need to be provided.
*/
stop?: AddOrderReq.StopEnum;
/**
* Either \'TP\', \'IP\' or \'MP\', Need to be defined if stop is specified.
*/
stopPriceType?: AddOrderReq.StopPriceTypeEnum;
/**
* Needs to be defined if stop is specified.
*/
stopPrice?: string;
/**
* 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;
/**
* A mark to force-hold the funds for an order, even though it\'s an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default. The system will force-freeze a certain amount of funds for this order, including orders whose direction is opposite to the current positions. This feature is to ensure that the order won’t be canceled by the matching engine in such a way that not enough funds are frozen for the order.
*/
forceHold?: boolean;
/**
* [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB. DC not currently supported.
*/
stp?: AddOrderReq.StpEnum;
/**
* Margin mode: ISOLATED, CROSS, default: ISOLATED
*/
marginMode?: AddOrderReq.MarginModeEnum;
/**
* Required for type is \'limit\' order, indicating the operating price
*/
price?: string;
/**
* **Choose one of size, qty, valueQty**, 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?: AddOrderReq.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;
/**
* **Choose one of size, qty, valueQty**. Order size (base currency) must be an integer multiple of the multiplier. The unit of the quantity of coin-swap is size (lot), which is not supported.
*/
qty?: string;
/**
* **Choose one of size, qty, valueQty**. Order size (Value), USDS-Swap correspond to USDT or USDC. The unit of the quantity of coin-swap is size (lot), which is not supported.
*/
valueQty?: string;
}): AddOrderReq;
/**
* Convert the object to a JSON string.
*/
toJson(): string;
/**
* Create an object from a JSON string.
*/
static fromJson(input: string): AddOrderReq;
/**
* Create an object from Js Object.
*/
static fromObject(jsonObject: Object): AddOrderReq;
}
export declare namespace AddOrderReq {
enum SideEnum {
/**
*
*/
BUY,
/**
*
*/
SELL
}
enum TypeEnum {
/**
*
*/
LIMIT,
/**
*
*/
MARKET
}
enum StopEnum {
/**
* Triggers when the price reaches or goes below the stopPrice.
*/
DOWN,
/**
* Triggers when the price reaches or goes above the stopPrice.
*/
UP
}
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,
/**
* IP for index price. The index price can be obtained through relevant OPEN API for index services.
*/
INDEX_PRICE
}
enum StpEnum {
/**
* Cancel new, Cancel the new order
*/
CN,
/**
* Cancel old, Cancel the old order
*/
CO,
/**
* Cancel both, Cancel both sides
*/
CB
}
enum MarginModeEnum {
/**
* Isolated Margin
*/
ISOLATED,
/**
* Cross Margin
*/
CROSS
}
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 AddOrderReqBuilder {
readonly obj: AddOrderReq;
constructor(obj: AddOrderReq);
/**
* 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): AddOrderReqBuilder;
/**
* Specify if the order is to \'buy\' or \'sell\'.
*/
setSide(value: AddOrderReq.SideEnum): AddOrderReqBuilder;
/**
* Symbol of the contract. Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220)
*/
setSymbol(value: string): AddOrderReqBuilder;
/**
* 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): AddOrderReqBuilder;
/**
* Specify if the order is a \'limit\' order or \'market\' order
*/
setType(value: AddOrderReq.TypeEnum): AddOrderReqBuilder;
/**
* Remark for the order: Length cannot exceed 100 utf8 characters
*/
setRemark(value: string): AddOrderReqBuilder;
/**
* Either \'down\' or \'up\'. If stop is used, parameter stopPrice and stopPriceType also need to be provided.
*/
setStop(value: AddOrderReq.StopEnum): AddOrderReqBuilder;
/**
* Either \'TP\', \'IP\' or \'MP\', Need to be defined if stop is specified.
*/
setStopPriceType(value: AddOrderReq.StopPriceTypeEnum): AddOrderReqBuilder;
/**
* Needs to be defined if stop is specified.
*/
setStopPrice(value: string): AddOrderReqBuilder;
/**
* 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): AddOrderReqBuilder;
/**
* 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): AddOrderReqBuilder;
/**
* A mark to force-hold the funds for an order, even though it\'s an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default. The system will force-freeze a certain amount of funds for this order, including orders whose direction is opposite to the current positions. This feature is to ensure that the order won’t be canceled by the matching engine in such a way that not enough funds are frozen for the order.
*/
setForceHold(value: boolean): AddOrderReqBuilder;
/**
* [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB. DC not currently supported.
*/
setStp(value: AddOrderReq.StpEnum): AddOrderReqBuilder;
/**
* Margin mode: ISOLATED, CROSS, default: ISOLATED
*/
setMarginMode(value: AddOrderReq.MarginModeEnum): AddOrderReqBuilder;
/**
* Required for type is \'limit\' order, indicating the operating price
*/
setPrice(value: string): AddOrderReqBuilder;
/**
* **Choose one of size, qty, valueQty**, 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): AddOrderReqBuilder;
/**
* 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: AddOrderReq.TimeInForceEnum): AddOrderReqBuilder;
/**
* 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): AddOrderReqBuilder;
/**
* Optional for type is \'limit\' order, orders not displaying in order book. When hidden is chosen, choosing postOnly is not allowed.
*/
setHidden(value: boolean): AddOrderReqBuilder;
/**
* 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): AddOrderReqBuilder;
/**
* 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): AddOrderReqBuilder;
/**
* **Choose one of size, qty, valueQty**. Order size (base currency) must be an integer multiple of the multiplier. The unit of the quantity of coin-swap is size (lot), which is not supported.
*/
setQty(value: string): AddOrderReqBuilder;
/**
* **Choose one of size, qty, valueQty**. Order size (Value), USDS-Swap correspond to USDT or USDC. The unit of the quantity of coin-swap is size (lot), which is not supported.
*/
setValueQty(value: string): AddOrderReqBuilder;
/**
* Get the final object.
*/
build(): AddOrderReq;
}