upstox-js-sdk
Version:
The official Node Js client for communicating with the Upstox API
200 lines (182 loc) • 7.87 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.TradeData = void 0;
var _ApiClient = require("../ApiClient");
/*
* Upstox Developer API
* Build your App on the Upstox platform  # 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.
*
*/
/**
* The TradeData model module.
* @module model/TradeData
* @version v2
*/
class TradeData {
/**
* Constructs a new <code>TradeData</code>.
* Response data for trades
* @alias module:model/TradeData
* @class
*/
constructor() {}
/**
* Constructs a <code>TradeData</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/TradeData} obj Optional instance to populate.
* @return {module:model/TradeData} The populated <code>TradeData</code> instance.
*/
static constructFromObject(data, obj) {
if (data) {
obj = obj || new TradeData();
if (data.hasOwnProperty('exchange')) obj.exchange = _ApiClient.ApiClient.convertToType(data['exchange'], 'String');
if (data.hasOwnProperty('product')) obj.product = _ApiClient.ApiClient.convertToType(data['product'], 'String');
if (data.hasOwnProperty('tradingsymbol')) obj.tradingsymbol = _ApiClient.ApiClient.convertToType(data['tradingsymbol'], 'String');
if (data.hasOwnProperty('trading_symbol')) obj.tradingSymbol = _ApiClient.ApiClient.convertToType(data['trading_symbol'], 'String');
if (data.hasOwnProperty('instrument_token')) obj.instrumentToken = _ApiClient.ApiClient.convertToType(data['instrument_token'], 'String');
if (data.hasOwnProperty('order_type')) obj.orderType = _ApiClient.ApiClient.convertToType(data['order_type'], 'String');
if (data.hasOwnProperty('transaction_type')) obj.transactionType = _ApiClient.ApiClient.convertToType(data['transaction_type'], 'String');
if (data.hasOwnProperty('quantity')) obj.quantity = _ApiClient.ApiClient.convertToType(data['quantity'], 'Number');
if (data.hasOwnProperty('exchange_order_id')) obj.exchangeOrderId = _ApiClient.ApiClient.convertToType(data['exchange_order_id'], 'String');
if (data.hasOwnProperty('order_id')) obj.orderId = _ApiClient.ApiClient.convertToType(data['order_id'], 'String');
if (data.hasOwnProperty('exchange_timestamp')) obj.exchangeTimestamp = _ApiClient.ApiClient.convertToType(data['exchange_timestamp'], 'String');
if (data.hasOwnProperty('average_price')) obj.averagePrice = _ApiClient.ApiClient.convertToType(data['average_price'], 'Number');
if (data.hasOwnProperty('trade_id')) obj.tradeId = _ApiClient.ApiClient.convertToType(data['trade_id'], 'String');
if (data.hasOwnProperty('order_ref_id')) obj.orderRefId = _ApiClient.ApiClient.convertToType(data['order_ref_id'], 'String');
if (data.hasOwnProperty('order_timestamp')) obj.orderTimestamp = _ApiClient.ApiClient.convertToType(data['order_timestamp'], 'String');
}
return obj;
}
}
/**
* Exchange to which the order is associated
* @member {String} exchange
*/
exports.TradeData = TradeData;
TradeData.prototype.exchange = undefined;
/**
* Shows if the order was either Intraday, Delivery, CO or OCO
* @member {String} product
*/
TradeData.prototype.product = undefined;
/**
* Shows the trading symbol which could be a combination of symbol name, instrument, expiry date etc
* @member {String} tradingsymbol
*/
TradeData.prototype.tradingsymbol = undefined;
/**
* Shows the trading symbol which could be a combination of symbol name, instrument, expiry date etc
* @member {String} tradingSymbol
*/
TradeData.prototype.tradingSymbol = undefined;
/**
* Identifier issued by Upstox used for subscribing to live market quotes
* @member {String} instrumentToken
*/
TradeData.prototype.instrumentToken = undefined;
/**
* Allowed values for the <code>orderType</code> property.
* @enum {String}
* @readonly
*/
TradeData.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<br>LIMIT refers to Limit Order<br>SL refers to Stop Loss Limit<br>SL-M refers to Stop loss market
* @member {module:model/TradeData.OrderTypeEnum} orderType
*/
TradeData.prototype.orderType = undefined;
/**
* Allowed values for the <code>transactionType</code> property.
* @enum {String}
* @readonly
*/
TradeData.TransactionTypeEnum = {
/**
* value: "BUY"
* @const
*/
BUY: "BUY",
/**
* value: "SELL"
* @const
*/
SELL: "SELL"
};
/**
* Indicates whether the order was a buy or sell order
* @member {module:model/TradeData.TransactionTypeEnum} transactionType
*/
TradeData.prototype.transactionType = undefined;
/**
* The total quantity traded from this particular order
* @member {Number} quantity
*/
TradeData.prototype.quantity = undefined;
/**
* Unique order ID assigned by the exchange for the order placed
* @member {String} exchangeOrderId
*/
TradeData.prototype.exchangeOrderId = undefined;
/**
* Unique order ID assigned internally for the order placed
* @member {String} orderId
*/
TradeData.prototype.orderId = undefined;
/**
* User readable time at when the trade occurred
* @member {String} exchangeTimestamp
*/
TradeData.prototype.exchangeTimestamp = undefined;
/**
* Price at which the traded quantity is traded
* @member {Number} averagePrice
*/
TradeData.prototype.averagePrice = undefined;
/**
* Trade ID generated from exchange towards traded transaction
* @member {String} tradeId
*/
TradeData.prototype.tradeId = undefined;
/**
* The order reference ID for which the order must be modified
* @member {String} orderRefId
*/
TradeData.prototype.orderRefId = undefined;
/**
* User readable timestamp at which the order was placed
* @member {String} orderTimestamp
*/
TradeData.prototype.orderTimestamp = undefined;