UNPKG

kucoin-universal-sdk

Version:
312 lines (311 loc) 15.9 kB
import { Serializable } from '../../../internal/interfaces/serializable'; export declare class AddOrderSyncReq implements Serializable { /** * Client Order ID: The ClientOid field is a unique ID created by the user (we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. */ clientOid?: string; /** * Specify if the order is to \'buy\' or \'sell\'. */ side: AddOrderSyncReq.SideEnum; /** * symbol */ symbol: string; /** * Specify if the order is a \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price; you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. */ type: AddOrderSyncReq.TypeEnum; /** * Order placement remarks, length cannot exceed 20 characters (ASCII) */ remark?: string; /** * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC */ stp?: AddOrderSyncReq.StpEnum; /** * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. */ price?: string; /** * Specify quantity for order. When **type** is limited, size refers to the amount of trading targets (the asset name written in front) for the trading pair. The Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds */ size?: string; /** * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading */ timeInForce?: AddOrderSyncReq.TimeInForceEnum; /** * passive order labels, this is disabled when the order timing strategy is IOC or FOK */ postOnly?: boolean; /** * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) */ hidden?: boolean; /** * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) */ iceberg?: boolean; /** * Maximum visible quantity in iceberg orders */ visibleSize?: string; /** * Order tag, length cannot exceed 20 characters (ASCII) */ tags?: string; /** * Cancel after n seconds, the order timing strategy is GTT, -1 means it will not be cancelled automatically, the default value is -1 */ cancelAfter?: number; /** * When **type** is market, select one out of two: size or funds */ funds?: string; /** * Order failed after timeout of specified milliseconds, If clientTimestamp + allowMaxTimeWindow < Gateway received the message time, this order will fail. */ allowMaxTimeWindow?: number; /** * Equal to KC-API-TIMESTAMP. Needs to be defined if allowMaxTimeWindow is specified. */ clientTimestamp?: number; /** * Private constructor, please use the corresponding static methods to construct the object. */ private constructor(); /** * Creates a new instance of the `AddOrderSyncReq` class. * The builder pattern allows step-by-step construction of a `AddOrderSyncReq` object. */ static builder(): AddOrderSyncReqBuilder; /** * Creates a new instance of the `AddOrderSyncReq` class with the given data. */ static create(data: { /** * Client Order ID: The ClientOid field is a unique ID created by the user (we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. */ clientOid?: string; /** * Specify if the order is to \'buy\' or \'sell\'. */ side: AddOrderSyncReq.SideEnum; /** * symbol */ symbol: string; /** * Specify if the order is a \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price; you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. */ type: AddOrderSyncReq.TypeEnum; /** * Order placement remarks, length cannot exceed 20 characters (ASCII) */ remark?: string; /** * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC */ stp?: AddOrderSyncReq.StpEnum; /** * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. */ price?: string; /** * Specify quantity for order. When **type** is limited, size refers to the amount of trading targets (the asset name written in front) for the trading pair. The Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds */ size?: string; /** * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading */ timeInForce?: AddOrderSyncReq.TimeInForceEnum; /** * passive order labels, this is disabled when the order timing strategy is IOC or FOK */ postOnly?: boolean; /** * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) */ hidden?: boolean; /** * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) */ iceberg?: boolean; /** * Maximum visible quantity in iceberg orders */ visibleSize?: string; /** * Order tag, length cannot exceed 20 characters (ASCII) */ tags?: string; /** * Cancel after n seconds, the order timing strategy is GTT, -1 means it will not be cancelled automatically, the default value is -1 */ cancelAfter?: number; /** * When **type** is market, select one out of two: size or funds */ funds?: string; /** * Order failed after timeout of specified milliseconds, If clientTimestamp + allowMaxTimeWindow < Gateway received the message time, this order will fail. */ allowMaxTimeWindow?: number; /** * Equal to KC-API-TIMESTAMP. Needs to be defined if allowMaxTimeWindow is specified. */ clientTimestamp?: number; }): AddOrderSyncReq; /** * Convert the object to a JSON string. */ toJson(): string; /** * Create an object from a JSON string. */ static fromJson(input: string): AddOrderSyncReq; /** * Create an object from Js Object. */ static fromObject(jsonObject: Object): AddOrderSyncReq; } export declare namespace AddOrderSyncReq { enum SideEnum { /** * */ BUY, /** * */ SELL } enum TypeEnum { /** * */ LIMIT, /** * */ MARKET } enum StpEnum { /** * */ DC, /** * */ CO, /** * */ CN, /** * */ CB } enum TimeInForceEnum { /** * */ GTC, /** * */ GTT, /** * */ IOC, /** * */ FOK } } export declare class AddOrderSyncReqBuilder { readonly obj: AddOrderSyncReq; constructor(obj: AddOrderSyncReq); /** * Client Order ID: The ClientOid field is a unique ID created by the user (we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. */ setClientOid(value: string): AddOrderSyncReqBuilder; /** * Specify if the order is to \'buy\' or \'sell\'. */ setSide(value: AddOrderSyncReq.SideEnum): AddOrderSyncReqBuilder; /** * symbol */ setSymbol(value: string): AddOrderSyncReqBuilder; /** * Specify if the order is a \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price; you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. */ setType(value: AddOrderSyncReq.TypeEnum): AddOrderSyncReqBuilder; /** * Order placement remarks, length cannot exceed 20 characters (ASCII) */ setRemark(value: string): AddOrderSyncReqBuilder; /** * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC */ setStp(value: AddOrderSyncReq.StpEnum): AddOrderSyncReqBuilder; /** * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. */ setPrice(value: string): AddOrderSyncReqBuilder; /** * Specify quantity for order. When **type** is limited, size refers to the amount of trading targets (the asset name written in front) for the trading pair. The Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds */ setSize(value: string): AddOrderSyncReqBuilder; /** * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading */ setTimeInForce(value: AddOrderSyncReq.TimeInForceEnum): AddOrderSyncReqBuilder; /** * passive order labels, this is disabled when the order timing strategy is IOC or FOK */ setPostOnly(value: boolean): AddOrderSyncReqBuilder; /** * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) */ setHidden(value: boolean): AddOrderSyncReqBuilder; /** * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) */ setIceberg(value: boolean): AddOrderSyncReqBuilder; /** * Maximum visible quantity in iceberg orders */ setVisibleSize(value: string): AddOrderSyncReqBuilder; /** * Order tag, length cannot exceed 20 characters (ASCII) */ setTags(value: string): AddOrderSyncReqBuilder; /** * Cancel after n seconds, the order timing strategy is GTT, -1 means it will not be cancelled automatically, the default value is -1 */ setCancelAfter(value: number): AddOrderSyncReqBuilder; /** * When **type** is market, select one out of two: size or funds */ setFunds(value: string): AddOrderSyncReqBuilder; /** * Order failed after timeout of specified milliseconds, If clientTimestamp + allowMaxTimeWindow < Gateway received the message time, this order will fail. */ setAllowMaxTimeWindow(value: number): AddOrderSyncReqBuilder; /** * Equal to KC-API-TIMESTAMP. Needs to be defined if allowMaxTimeWindow is specified. */ setClientTimestamp(value: number): AddOrderSyncReqBuilder; /** * Get the final object. */ build(): AddOrderSyncReq; }