UNPKG

upstox-js-sdk

Version:

The official Node Js client for communicating with the Upstox API

206 lines (182 loc) 8.03 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 HoldingsData model module. * @module model/HoldingsData * @version v2 */ export class HoldingsData { /** * Constructs a new <code>HoldingsData</code>. * Response data for holdings * @alias module:model/HoldingsData * @class */ constructor() { } /** * Constructs a <code>HoldingsData</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/HoldingsData} obj Optional instance to populate. * @return {module:model/HoldingsData} The populated <code>HoldingsData</code> instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new HoldingsData(); if (data.hasOwnProperty('isin')) obj.isin = ApiClient.convertToType(data['isin'], 'String'); if (data.hasOwnProperty('cnc_used_quantity')) obj.cncUsedQuantity = ApiClient.convertToType(data['cnc_used_quantity'], 'Number'); if (data.hasOwnProperty('collateral_type')) obj.collateralType = ApiClient.convertToType(data['collateral_type'], 'String'); if (data.hasOwnProperty('company_name')) obj.companyName = ApiClient.convertToType(data['company_name'], 'String'); if (data.hasOwnProperty('haircut')) obj.haircut = ApiClient.convertToType(data['haircut'], 'Number'); if (data.hasOwnProperty('product')) obj.product = ApiClient.convertToType(data['product'], 'String'); if (data.hasOwnProperty('quantity')) obj.quantity = ApiClient.convertToType(data['quantity'], 'Number'); if (data.hasOwnProperty('tradingsymbol')) obj.tradingsymbol = ApiClient.convertToType(data['tradingsymbol'], 'String'); if (data.hasOwnProperty('trading_symbol')) obj.tradingSymbol = ApiClient.convertToType(data['trading_symbol'], 'String'); if (data.hasOwnProperty('last_price')) obj.lastPrice = ApiClient.convertToType(data['last_price'], 'Number'); if (data.hasOwnProperty('close_price')) obj.closePrice = ApiClient.convertToType(data['close_price'], 'Number'); if (data.hasOwnProperty('pnl')) obj.pnl = ApiClient.convertToType(data['pnl'], 'Number'); if (data.hasOwnProperty('day_change')) obj.dayChange = ApiClient.convertToType(data['day_change'], 'Number'); if (data.hasOwnProperty('day_change_percentage')) obj.dayChangePercentage = ApiClient.convertToType(data['day_change_percentage'], 'Number'); if (data.hasOwnProperty('instrument_token')) obj.instrumentToken = ApiClient.convertToType(data['instrument_token'], 'String'); if (data.hasOwnProperty('average_price')) obj.averagePrice = ApiClient.convertToType(data['average_price'], 'Number'); if (data.hasOwnProperty('collateral_quantity')) obj.collateralQuantity = ApiClient.convertToType(data['collateral_quantity'], 'Number'); if (data.hasOwnProperty('collateral_update_quantity')) obj.collateralUpdateQuantity = ApiClient.convertToType(data['collateral_update_quantity'], 'Number'); if (data.hasOwnProperty('t1_quantity')) obj.t1Quantity = ApiClient.convertToType(data['t1_quantity'], 'Number'); if (data.hasOwnProperty('exchange')) obj.exchange = ApiClient.convertToType(data['exchange'], 'String'); } return obj; } } /** * The standard ISIN representing stocks listed on multiple exchanges * @member {String} isin */ HoldingsData.prototype.isin = undefined; /** * Quantity either blocked towards open or completed order * @member {Number} cncUsedQuantity */ HoldingsData.prototype.cncUsedQuantity = undefined; /** * Category of collateral assigned by RMS * @member {String} collateralType */ HoldingsData.prototype.collateralType = undefined; /** * Name of the company * @member {String} companyName */ HoldingsData.prototype.companyName = undefined; /** * This is the haircut percentage applied from RMS (applicable incase of collateral) * @member {Number} haircut */ HoldingsData.prototype.haircut = undefined; /** * Shows if the order was either Intraday, Delivery, CO or OCO * @member {String} product */ HoldingsData.prototype.product = undefined; /** * The total holding qty * @member {Number} quantity */ HoldingsData.prototype.quantity = undefined; /** * Shows the trading symbol of the instrument * @member {String} tradingsymbol */ HoldingsData.prototype.tradingsymbol = undefined; /** * Shows the trading symbol of the instrument * @member {String} tradingSymbol */ HoldingsData.prototype.tradingSymbol = undefined; /** * The last traded price of the instrument * @member {Number} lastPrice */ HoldingsData.prototype.lastPrice = undefined; /** * Closing price of the instrument from the last trading day * @member {Number} closePrice */ HoldingsData.prototype.closePrice = undefined; /** * Profit and Loss * @member {Number} pnl */ HoldingsData.prototype.pnl = undefined; /** * Day's change in absolute value for the stock * @member {Number} dayChange */ HoldingsData.prototype.dayChange = undefined; /** * Day's change in percentage for the stock * @member {Number} dayChangePercentage */ HoldingsData.prototype.dayChangePercentage = undefined; /** * Key issued by Upstox for the instrument * @member {String} instrumentToken */ HoldingsData.prototype.instrumentToken = undefined; /** * Average price at which the net holding quantity was acquired * @member {Number} averagePrice */ HoldingsData.prototype.averagePrice = undefined; /** * Quantity marked as collateral by RMS on users request * @member {Number} collateralQuantity */ HoldingsData.prototype.collateralQuantity = undefined; /** * @member {Number} collateralUpdateQuantity */ HoldingsData.prototype.collateralUpdateQuantity = undefined; /** * Quantity on T+1 day after order execution * @member {Number} t1Quantity */ HoldingsData.prototype.t1Quantity = undefined; /** * Exchange of the trading symbol * @member {String} exchange */ HoldingsData.prototype.exchange = undefined;