upstox-js-sdk
Version:
The official Node Js client for communicating with the Upstox API
165 lines (153 loc) • 5.01 kB
JavaScript
/*
* 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.66
*
* Do not edit the class manually.
*
*/
import {ApiClient} from '../ApiClient';
import {GttRule} from './GttRule';
/**
* The GttPlaceOrderRequest model module.
* @module model/GttPlaceOrderRequest
* @version v0
*/
export class GttPlaceOrderRequest {
/**
* Constructs a new <code>GttPlaceOrderRequest</code>.
* @alias module:model/GttPlaceOrderRequest
* @class
* @param type {module:model/GttPlaceOrderRequest.TypeEnum} Type of GTT order. It can be one of the following: SINGLE refers to a single-leg GTT order MULTIPLE refers to a multi-leg GTT order
* @param quantity {Number} Quantity with which the order is to be placed
* @param product {module:model/GttPlaceOrderRequest.ProductEnum} Signifies if the order was either Intraday, Delivery or MTF
* @param rules {Array.<module:model/GttRule>} List of rules defining the conditions for each leg in the GTT order
* @param instrumentToken {String} Key of the instrument
* @param transactionType {module:model/GttPlaceOrderRequest.TransactionTypeEnum} Indicates whether its a buy or sell order
*/
constructor(type, quantity, product, rules, instrumentToken, transactionType) {
this.type = type;
this.quantity = quantity;
this.product = product;
this.rules = rules;
this.instrumentToken = instrumentToken;
this.transactionType = transactionType;
}
/**
* Constructs a <code>GttPlaceOrderRequest</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/GttPlaceOrderRequest} obj Optional instance to populate.
* @return {module:model/GttPlaceOrderRequest} The populated <code>GttPlaceOrderRequest</code> instance.
*/
static constructFromObject(data, obj) {
if (data) {
obj = obj || new GttPlaceOrderRequest();
if (data.hasOwnProperty('type'))
obj.type = ApiClient.convertToType(data['type'], 'String');
if (data.hasOwnProperty('quantity'))
obj.quantity = ApiClient.convertToType(data['quantity'], 'Number');
if (data.hasOwnProperty('product'))
obj.product = ApiClient.convertToType(data['product'], 'String');
if (data.hasOwnProperty('rules'))
obj.rules = ApiClient.convertToType(data['rules'], [GttRule]);
if (data.hasOwnProperty('instrument_token'))
obj.instrumentToken = ApiClient.convertToType(data['instrument_token'], 'String');
if (data.hasOwnProperty('transaction_type'))
obj.transactionType = ApiClient.convertToType(data['transaction_type'], 'String');
}
return obj;
}
}
/**
* Allowed values for the <code>type</code> property.
* @enum {String}
* @readonly
*/
GttPlaceOrderRequest.TypeEnum = {
/**
* value: "SINGLE"
* @const
*/
SINGLE: "SINGLE",
/**
* value: "MULTIPLE"
* @const
*/
MULTIPLE: "MULTIPLE"
};
/**
* Type of GTT order. It can be one of the following: SINGLE refers to a single-leg GTT order MULTIPLE refers to a multi-leg GTT order
* @member {module:model/GttPlaceOrderRequest.TypeEnum} type
*/
GttPlaceOrderRequest.prototype.type = undefined;
/**
* Quantity with which the order is to be placed
* @member {Number} quantity
*/
GttPlaceOrderRequest.prototype.quantity = undefined;
/**
* Allowed values for the <code>product</code> property.
* @enum {String}
* @readonly
*/
GttPlaceOrderRequest.ProductEnum = {
/**
* value: "I"
* @const
*/
I: "I",
/**
* value: "D"
* @const
*/
D: "D",
/**
* value: "MTF"
* @const
*/
MTF: "MTF"
};
/**
* Signifies if the order was either Intraday, Delivery or MTF
* @member {module:model/GttPlaceOrderRequest.ProductEnum} product
*/
GttPlaceOrderRequest.prototype.product = undefined;
/**
* List of rules defining the conditions for each leg in the GTT order
* @member {Array.<module:model/GttRule>} rules
*/
GttPlaceOrderRequest.prototype.rules = undefined;
/**
* Key of the instrument
* @member {String} instrumentToken
*/
GttPlaceOrderRequest.prototype.instrumentToken = undefined;
/**
* Allowed values for the <code>transactionType</code> property.
* @enum {String}
* @readonly
*/
GttPlaceOrderRequest.TransactionTypeEnum = {
/**
* value: "BUY"
* @const
*/
BUY: "BUY",
/**
* value: "SELL"
* @const
*/
SELL: "SELL"
};
/**
* Indicates whether its a buy or sell order
* @member {module:model/GttPlaceOrderRequest.TransactionTypeEnum} transactionType
*/
GttPlaceOrderRequest.prototype.transactionType = undefined;