upstox-js-sdk
Version:
The official Node Js client for communicating with the Upstox API
95 lines (87 loc) • 3.19 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Instrument = void 0;
var _ApiClient = require("../ApiClient");
/*
* OpenAPI definition
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* OpenAPI spec version: v0
*
* 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.54
*
* Do not edit the class manually.
*
*/
/**
* The Instrument model module.
* @module model/Instrument
* @version v0
*/
class Instrument {
/**
* Constructs a new <code>Instrument</code>.
* instruments
* @alias module:model/Instrument
* @class
* @param instrumentKey {String} Instrument Key of the Instrument
* @param quantity {Number} Quantity of the instrument to buy or sell for margin calculation
* @param product {String} Product with which the order is to be placed
* @param transactionType {String} Indicates whether its a BUY or SELL order
*/
constructor(instrumentKey, quantity, product, transactionType) {
this.instrument_key = instrumentKey;
this.quantity = quantity;
this.product = product;
this.transaction_type = transactionType;
}
/**
* Constructs a <code>Instrument</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/Instrument} obj Optional instance to populate.
* @return {module:model/Instrument} The populated <code>Instrument</code> instance.
*/
static constructFromObject(data, obj) {
if (data) {
obj = obj || new Instrument();
if (data.hasOwnProperty('instrument_key')) obj.instrumentKey = _ApiClient.ApiClient.convertToType(data['instrument_key'], 'String');
if (data.hasOwnProperty('quantity')) obj.quantity = _ApiClient.ApiClient.convertToType(data['quantity'], 'Number');
if (data.hasOwnProperty('product')) obj.product = _ApiClient.ApiClient.convertToType(data['product'], 'String');
if (data.hasOwnProperty('transaction_type')) obj.transactionType = _ApiClient.ApiClient.convertToType(data['transaction_type'], 'String');
if (data.hasOwnProperty('price')) obj.price = _ApiClient.ApiClient.convertToType(data['price'], 'Number');
}
return obj;
}
}
/**
* Instrument Key of the Instrument
* @member {String} instrumentKey
*/
exports.Instrument = Instrument;
Instrument.prototype.instrument_key = undefined;
/**
* Quantity of the instrument to buy or sell for margin calculation
* @member {Number} quantity
*/
Instrument.prototype.quantity = undefined;
/**
* Product with which the order is to be placed
* @member {String} product
*/
Instrument.prototype.product = undefined;
/**
* Indicates whether its a BUY or SELL order
* @member {String} transactionType
*/
Instrument.prototype.transaction_type = undefined;
/**
* price
* @member {Number} price
*/
Instrument.prototype.price = undefined;