UNPKG

kucoin-universal-sdk

Version:
312 lines (311 loc) 13.8 kB
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 an \'limit\' order or \'market\' order */ type: AddOrderReq.TypeEnum; /** * Either \'down\' or \'up\'. If stop is used,parameter stopPrice and stopPriceType also need to be provieded. */ stop?: AddOrderReq.StopEnum; /** * Either \'TP\' or \'MP\', Need to be defined if stop is specified. */ stopPriceType?: AddOrderReq.StopPriceTypeEnum; /** * Need 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; /** * Margin mode: ISOLATED, default: ISOLATED */ marginMode?: AddOrderReq.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?: AddOrderReq.TimeInForceEnum; /** * Optional for type is \'limit\' order, post only flag, invalid when timeInForce is IOC. When postOnly is true, not allowed choose hidden or iceberg. 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 fee, the order will be fully rejected. */ postOnly?: boolean; /** * Optional for type is \'limit\' order, orders not displaying in order book. When hidden chose, not allowed choose postOnly. */ hidden?: boolean; /** * Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg chose, not allowed choose postOnly. */ 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; /** * 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 an \'limit\' order or \'market\' order */ type: AddOrderReq.TypeEnum; /** * Either \'down\' or \'up\'. If stop is used,parameter stopPrice and stopPriceType also need to be provieded. */ stop?: AddOrderReq.StopEnum; /** * Either \'TP\' or \'MP\', Need to be defined if stop is specified. */ stopPriceType?: AddOrderReq.StopPriceTypeEnum; /** * Need 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; /** * Margin mode: ISOLATED, default: ISOLATED */ marginMode?: AddOrderReq.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?: AddOrderReq.TimeInForceEnum; /** * Optional for type is \'limit\' order, post only flag, invalid when timeInForce is IOC. When postOnly is true, not allowed choose hidden or iceberg. 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 fee, the order will be fully rejected. */ postOnly?: boolean; /** * Optional for type is \'limit\' order, orders not displaying in order book. When hidden chose, not allowed choose postOnly. */ hidden?: boolean; /** * Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg chose, not allowed choose postOnly. */ 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; }): 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 } enum MarginModeEnum { /** * Isolated Margin */ 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 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 an \'limit\' order or \'market\' order */ setType(value: AddOrderReq.TypeEnum): AddOrderReqBuilder; /** * Either \'down\' or \'up\'. If stop is used,parameter stopPrice and stopPriceType also need to be provieded. */ setStop(value: AddOrderReq.StopEnum): AddOrderReqBuilder; /** * Either \'TP\' or \'MP\', Need to be defined if stop is specified. */ setStopPriceType(value: AddOrderReq.StopPriceTypeEnum): AddOrderReqBuilder; /** * Need 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; /** * Margin mode: ISOLATED, default: ISOLATED */ setMarginMode(value: AddOrderReq.MarginModeEnum): AddOrderReqBuilder; /** * Required for type is \'limit\' order, indicating the operating price */ setPrice(value: string): AddOrderReqBuilder; /** * 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, not allowed choose hidden or iceberg. 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 fee, the order will be fully rejected. */ setPostOnly(value: boolean): AddOrderReqBuilder; /** * Optional for type is \'limit\' order, orders not displaying in order book. When hidden chose, not allowed choose postOnly. */ setHidden(value: boolean): AddOrderReqBuilder; /** * Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg chose, not allowed choose postOnly. */ 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; /** * Get the final object. */ build(): AddOrderReq; }