UNPKG

kucoin-universal-sdk

Version:
335 lines 12.6 kB
"use strict"; // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. Object.defineProperty(exports, "__esModule", { value: true }); exports.AddOrderTestReqBuilder = exports.AddOrderTestReq = void 0; const class_transformer_1 = require("class-transformer"); class AddOrderTestReq { /** * Private constructor, please use the corresponding static methods to construct the object. */ constructor() { /** * 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. */ this.type = AddOrderTestReq.TypeEnum.LIMIT; /** * [Time in force](https://www.kucoin.com/docs-new/api-5176570) is a special strategy used during trading */ this.timeInForce = AddOrderTestReq.TimeInForceEnum.GTC; /** * passive order labels, this is disabled when the order timing strategy is IOC or FOK */ this.postOnly = false; /** * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) */ this.hidden = false; /** * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) */ this.iceberg = false; /** * True - isolated margin; false - cross margin. Default is false */ this.isIsolated = false; /** * When Margin Account has inefficient balance, our system autoborrows inefficient assets and opens positions according to the lowest market interest rate. */ this.autoBorrow = false; /** * AutoPay allows the return of borrowed assets when you close a position. Our system automatically triggers the repayment and the maximum repayment amount equals to the filled-order amount. */ this.autoRepay = false; // @ts-ignore this.clientOid = null; // @ts-ignore this.side = null; // @ts-ignore this.symbol = null; } /** * Creates a new instance of the `AddOrderTestReq` class. * The builder pattern allows step-by-step construction of a `AddOrderTestReq` object. */ static builder() { return new AddOrderTestReqBuilder(new AddOrderTestReq()); } /** * Creates a new instance of the `AddOrderTestReq` class with the given data. */ static create(data) { let obj = new AddOrderTestReq(); obj.clientOid = data.clientOid; obj.side = data.side; obj.symbol = data.symbol; if (data.type) { obj.type = data.type; } else { obj.type = AddOrderTestReq.TypeEnum.LIMIT; } obj.stp = data.stp; obj.price = data.price; obj.size = data.size; if (data.timeInForce) { obj.timeInForce = data.timeInForce; } else { obj.timeInForce = AddOrderTestReq.TimeInForceEnum.GTC; } if (data.postOnly) { obj.postOnly = data.postOnly; } else { obj.postOnly = false; } if (data.hidden) { obj.hidden = data.hidden; } else { obj.hidden = false; } if (data.iceberg) { obj.iceberg = data.iceberg; } else { obj.iceberg = false; } obj.visibleSize = data.visibleSize; obj.cancelAfter = data.cancelAfter; obj.funds = data.funds; if (data.isIsolated) { obj.isIsolated = data.isIsolated; } else { obj.isIsolated = false; } if (data.autoBorrow) { obj.autoBorrow = data.autoBorrow; } else { obj.autoBorrow = false; } if (data.autoRepay) { obj.autoRepay = data.autoRepay; } else { obj.autoRepay = false; } return obj; } /** * Convert the object to a JSON string. */ toJson() { return JSON.stringify((0, class_transformer_1.instanceToPlain)(this)); } /** * Create an object from a JSON string. */ static fromJson(input) { return this.fromObject(JSON.parse(input)); } /** * Create an object from Js Object. */ static fromObject(jsonObject) { return (0, class_transformer_1.plainToClassFromExist)(new AddOrderTestReq(), jsonObject); } } exports.AddOrderTestReq = AddOrderTestReq; (function (AddOrderTestReq) { let SideEnum; (function (SideEnum) { /** * */ SideEnum[SideEnum["BUY"] = 'buy'] = "BUY"; /** * */ SideEnum[SideEnum["SELL"] = 'sell'] = "SELL"; })(SideEnum = AddOrderTestReq.SideEnum || (AddOrderTestReq.SideEnum = {})); let TypeEnum; (function (TypeEnum) { /** * */ TypeEnum[TypeEnum["LIMIT"] = 'limit'] = "LIMIT"; /** * */ TypeEnum[TypeEnum["MARKET"] = 'market'] = "MARKET"; })(TypeEnum = AddOrderTestReq.TypeEnum || (AddOrderTestReq.TypeEnum = {})); let StpEnum; (function (StpEnum) { /** * */ StpEnum[StpEnum["DC"] = 'DC'] = "DC"; /** * */ StpEnum[StpEnum["CO"] = 'CO'] = "CO"; /** * */ StpEnum[StpEnum["CN"] = 'CN'] = "CN"; /** * */ StpEnum[StpEnum["CB"] = 'CB'] = "CB"; })(StpEnum = AddOrderTestReq.StpEnum || (AddOrderTestReq.StpEnum = {})); let TimeInForceEnum; (function (TimeInForceEnum) { /** * */ TimeInForceEnum[TimeInForceEnum["GTC"] = 'GTC'] = "GTC"; /** * */ TimeInForceEnum[TimeInForceEnum["GTT"] = 'GTT'] = "GTT"; /** * */ TimeInForceEnum[TimeInForceEnum["IOC"] = 'IOC'] = "IOC"; /** * */ TimeInForceEnum[TimeInForceEnum["FOK"] = 'FOK'] = "FOK"; })(TimeInForceEnum = AddOrderTestReq.TimeInForceEnum || (AddOrderTestReq.TimeInForceEnum = {})); })(AddOrderTestReq || (exports.AddOrderTestReq = AddOrderTestReq = {})); class AddOrderTestReqBuilder { constructor(obj) { this.obj = obj; this.obj = obj; } /** * 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) { this.obj.clientOid = value; return this; } /** * Specify if the order is to \'buy\' or \'sell\'. */ setSide(value) { this.obj.side = value; return this; } /** * symbol */ setSymbol(value) { this.obj.symbol = value; return this; } /** * 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) { this.obj.type = value; return this; } /** * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB , and DC */ setStp(value) { this.obj.stp = value; return this; } /** * 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) { this.obj.price = value; return this; } /** * 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) { this.obj.size = value; return this; } /** * [Time in force](https://www.kucoin.com/docs-new/api-5176570) is a special strategy used during trading */ setTimeInForce(value) { this.obj.timeInForce = value; return this; } /** * passive order labels, this is disabled when the order timing strategy is IOC or FOK */ setPostOnly(value) { this.obj.postOnly = value; return this; } /** * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) */ setHidden(value) { this.obj.hidden = value; return this; } /** * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) */ setIceberg(value) { this.obj.iceberg = value; return this; } /** * Maximum visible quantity in iceberg orders */ setVisibleSize(value) { this.obj.visibleSize = value; return this; } /** * Cancel after n seconds, the order timing strategy is GTT */ setCancelAfter(value) { this.obj.cancelAfter = value; return this; } /** * When **type** is market, select one out of two: size or funds */ setFunds(value) { this.obj.funds = value; return this; } /** * True - isolated margin; false - cross margin. Default is false */ setIsIsolated(value) { this.obj.isIsolated = value; return this; } /** * When Margin Account has inefficient balance, our system autoborrows inefficient assets and opens positions according to the lowest market interest rate. */ setAutoBorrow(value) { this.obj.autoBorrow = value; return this; } /** * AutoPay allows the return of borrowed assets when you close a position. Our system automatically triggers the repayment and the maximum repayment amount equals to the filled-order amount. */ setAutoRepay(value) { this.obj.autoRepay = value; return this; } /** * Get the final object. */ build() { return this.obj; } } exports.AddOrderTestReqBuilder = AddOrderTestReqBuilder; //# sourceMappingURL=model_add_order_test_req.js.map