UNPKG

upstox-js-sdk

Version:

The official Node Js client for communicating with the Upstox API

160 lines (145 loc) 6.3 kB
/* * Upstox Developer API * Build your App on the Upstox platform ![Banner](https://api.upstox.com/api-docs/images/banner.jpg \"banner\") # Introduction Upstox API is a set of rest APIs that provide data required to build a complete investment and trading platform. Execute orders in real time, manage user portfolio, stream live market data (using Websocket), and more, with the easy to understand API collection. All requests are over HTTPS and the requests are sent with the content-type ‘application/json’. Developers have the option of choosing the response type as JSON or CSV for a few API calls. To be able to use these APIs you need to create an App in the Developer Console and generate your **apiKey** and **apiSecret**. You can use a redirect URL which will be called after the login flow. If you are a **trader**, you can directly create apps from Upstox mobile app or the desktop platform itself from **Apps** sections inside the **Account** Tab. Head over to <a href=\"http://account.upstox.com/developer/apps\" target=\"_blank\">account.upstox.com/developer/apps</a>.</br> If you are a **business** looking to integrate Upstox APIs, reach out to us and we will get a custom app created for you in no time. It is highly recommended that you do not embed the **apiSecret** in your frontend app. Create a remote backend which does the handshake on behalf of the frontend app. Marking the apiSecret in the frontend app will make your app vulnerable to threats and potential issues. * * OpenAPI spec version: v2 * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * * Swagger Codegen version: 3.0.46 * * Do not edit the class manually. * */ import {ApiClient} from '../ApiClient'; /** * The ModifyOrderRequest model module. * @module model/ModifyOrderRequest * @version v2 */ export class ModifyOrderRequest { /** * Constructs a new <code>ModifyOrderRequest</code>. * @alias module:model/ModifyOrderRequest * @class * @param validity {module:model/ModifyOrderRequest.ValidityEnum} Order validity (DAY- Day and IOC- Immediate or Cancel (IOC) order) * @param price {Number} Price at which the order was placed * @param orderId {String} The order ID for which the order must be modified * @param orderType {module:model/ModifyOrderRequest.OrderTypeEnum} Type of order. It can be one of the following MARKET refers to market order LIMILT refers to Limit Order SL refers to Stop Loss Limit SL-M refers to Stop Loss Market * @param triggerPrice {Number} If the order is a stop loss order then the trigger price to be set is mentioned here */ constructor(validity, price, orderId, orderType, triggerPrice) { this.validity = validity; this.price = price; this.orderId = orderId; this.orderType = orderType; this.triggerPrice = triggerPrice; } /** * Constructs a <code>ModifyOrderRequest</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/ModifyOrderRequest} obj Optional instance to populate. * @return {module:model/ModifyOrderRequest} The populated <code>ModifyOrderRequest</code> instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new ModifyOrderRequest(); if (data.hasOwnProperty('quantity')) obj.quantity = ApiClient.convertToType(data['quantity'], 'Number'); if (data.hasOwnProperty('validity')) obj.validity = ApiClient.convertToType(data['validity'], 'String'); if (data.hasOwnProperty('price')) obj.price = ApiClient.convertToType(data['price'], 'Number'); if (data.hasOwnProperty('order_id')) obj.orderId = ApiClient.convertToType(data['order_id'], 'String'); if (data.hasOwnProperty('order_type')) obj.orderType = ApiClient.convertToType(data['order_type'], 'String'); if (data.hasOwnProperty('disclosed_quantity')) obj.disclosedQuantity = ApiClient.convertToType(data['disclosed_quantity'], 'Number'); if (data.hasOwnProperty('trigger_price')) obj.triggerPrice = ApiClient.convertToType(data['trigger_price'], 'Number'); } return obj; } } /** * Quantity with which the order was placed * @member {Number} quantity */ ModifyOrderRequest.prototype.quantity = undefined; /** * Allowed values for the <code>validity</code> property. * @enum {String} * @readonly */ ModifyOrderRequest.ValidityEnum = { /** * value: "DAY" * @const */ DAY: "DAY", /** * value: "IOC" * @const */ IOC: "IOC" }; /** * Order validity (DAY- Day and IOC- Immediate or Cancel (IOC) order) * @member {module:model/ModifyOrderRequest.ValidityEnum} validity */ ModifyOrderRequest.prototype.validity = undefined; /** * Price at which the order was placed * @member {Number} price */ ModifyOrderRequest.prototype.price = undefined; /** * The order ID for which the order must be modified * @member {String} orderId */ ModifyOrderRequest.prototype.orderId = undefined; /** * Allowed values for the <code>orderType</code> property. * @enum {String} * @readonly */ ModifyOrderRequest.OrderTypeEnum = { /** * value: "MARKET" * @const */ MARKET: "MARKET", /** * value: "LIMIT" * @const */ LIMIT: "LIMIT", /** * value: "SL" * @const */ SL: "SL", /** * value: "SL-M" * @const */ SL_M: "SL-M" }; /** * Type of order. It can be one of the following MARKET refers to market order LIMILT refers to Limit Order SL refers to Stop Loss Limit SL-M refers to Stop Loss Market * @member {module:model/ModifyOrderRequest.OrderTypeEnum} orderType */ ModifyOrderRequest.prototype.orderType = undefined; /** * The quantity that should be disclosed in the market depth * @member {Number} disclosedQuantity */ ModifyOrderRequest.prototype.disclosedQuantity = undefined; /** * If the order is a stop loss order then the trigger price to be set is mentioned here * @member {Number} triggerPrice */ ModifyOrderRequest.prototype.triggerPrice = undefined;