upstox-js-sdk
Version:
The official Node Js client for communicating with the Upstox API
250 lines (227 loc) • 7.51 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';
/**
* The PlaceOrderV3Request model module.
* @module model/PlaceOrderV3Request
* @version v0
*/
export class PlaceOrderV3Request {
/**
* Constructs a new <code>PlaceOrderV3Request</code>.
* @alias module:model/PlaceOrderV3Request
* @class
* @param quantity {Number} Quantity with which the order is to be placed
* @param product {module:model/PlaceOrderV3Request.ProductEnum} Signifies if the order was either Intraday, Delivery, CO or OCO
* @param validity {module:model/PlaceOrderV3Request.ValidityEnum} It can be one of the following - DAY(default), IOC
* @param price {Number} Price at which the order will be placed
* @param instrumentToken {String} Key of the instrument
* @param orderType {module:model/PlaceOrderV3Request.OrderTypeEnum} Type of order. It can be one of the following MARKET refers to market order LIMIT refers to Limit Order SL refers to Stop Loss Limit SL-M refers to Stop Loss Market
* @param transactionType {module:model/PlaceOrderV3Request.TransactionTypeEnum} Indicates whether its a buy or sell order
* @param disclosedQuantity {Number} The quantity that should be disclosed in the market depth
* @param triggerPrice {Number} If the order is a stop loss order then the trigger price to be set is mentioned here
* @param isAmo {Boolean} Signifies if the order is an After Market Order
*/
constructor(quantity, product, validity, price, instrumentToken, orderType, transactionType, disclosedQuantity, triggerPrice, isAmo) {
this.quantity = quantity;
this.product = product;
this.validity = validity;
this.price = price;
this.instrumentToken = instrumentToken;
this.orderType = orderType;
this.transactionType = transactionType;
this.disclosedQuantity = disclosedQuantity;
this.triggerPrice = triggerPrice;
this.isAmo = isAmo;
}
/**
* Constructs a <code>PlaceOrderV3Request</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/PlaceOrderV3Request} obj Optional instance to populate.
* @return {module:model/PlaceOrderV3Request} The populated <code>PlaceOrderV3Request</code> instance.
*/
static constructFromObject(data, obj) {
if (data) {
obj = obj || new PlaceOrderV3Request();
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('validity'))
obj.validity = ApiClient.convertToType(data['validity'], 'String');
if (data.hasOwnProperty('price'))
obj.price = ApiClient.convertToType(data['price'], 'Number');
if (data.hasOwnProperty('tag'))
obj.tag = ApiClient.convertToType(data['tag'], 'String');
if (data.hasOwnProperty('slice'))
obj.slice = ApiClient.convertToType(data['slice'], 'Boolean');
if (data.hasOwnProperty('instrument_token'))
obj.instrumentToken = ApiClient.convertToType(data['instrument_token'], 'String');
if (data.hasOwnProperty('order_type'))
obj.orderType = ApiClient.convertToType(data['order_type'], 'String');
if (data.hasOwnProperty('transaction_type'))
obj.transactionType = ApiClient.convertToType(data['transaction_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');
if (data.hasOwnProperty('is_amo'))
obj.isAmo = ApiClient.convertToType(data['is_amo'], 'Boolean');
}
return obj;
}
}
/**
* Quantity with which the order is to be placed
* @member {Number} quantity
*/
PlaceOrderV3Request.prototype.quantity = undefined;
/**
* Allowed values for the <code>product</code> property.
* @enum {String}
* @readonly
*/
PlaceOrderV3Request.ProductEnum = {
/**
* value: "I"
* @const
*/
I: "I",
/**
* value: "D"
* @const
*/
D: "D",
/**
* value: "MTF"
* @const
*/
MTF: "MTF"
};
/**
* Signifies if the order was either Intraday, Delivery, CO or OCO
* @member {module:model/PlaceOrderV3Request.ProductEnum} product
*/
PlaceOrderV3Request.prototype.product = undefined;
/**
* Allowed values for the <code>validity</code> property.
* @enum {String}
* @readonly
*/
PlaceOrderV3Request.ValidityEnum = {
/**
* value: "DAY"
* @const
*/
DAY: "DAY",
/**
* value: "IOC"
* @const
*/
IOC: "IOC"
};
/**
* It can be one of the following - DAY(default), IOC
* @member {module:model/PlaceOrderV3Request.ValidityEnum} validity
*/
PlaceOrderV3Request.prototype.validity = undefined;
/**
* Price at which the order will be placed
* @member {Number} price
*/
PlaceOrderV3Request.prototype.price = undefined;
/**
* @member {String} tag
*/
PlaceOrderV3Request.prototype.tag = undefined;
/**
* @member {Boolean} slice
*/
PlaceOrderV3Request.prototype.slice = undefined;
/**
* Key of the instrument
* @member {String} instrumentToken
*/
PlaceOrderV3Request.prototype.instrumentToken = undefined;
/**
* Allowed values for the <code>orderType</code> property.
* @enum {String}
* @readonly
*/
PlaceOrderV3Request.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 LIMIT refers to Limit Order SL refers to Stop Loss Limit SL-M refers to Stop Loss Market
* @member {module:model/PlaceOrderV3Request.OrderTypeEnum} orderType
*/
PlaceOrderV3Request.prototype.orderType = undefined;
/**
* Allowed values for the <code>transactionType</code> property.
* @enum {String}
* @readonly
*/
PlaceOrderV3Request.TransactionTypeEnum = {
/**
* value: "BUY"
* @const
*/
BUY: "BUY",
/**
* value: "SELL"
* @const
*/
SELL: "SELL"
};
/**
* Indicates whether its a buy or sell order
* @member {module:model/PlaceOrderV3Request.TransactionTypeEnum} transactionType
*/
PlaceOrderV3Request.prototype.transactionType = undefined;
/**
* The quantity that should be disclosed in the market depth
* @member {Number} disclosedQuantity
*/
PlaceOrderV3Request.prototype.disclosedQuantity = undefined;
/**
* If the order is a stop loss order then the trigger price to be set is mentioned here
* @member {Number} triggerPrice
*/
PlaceOrderV3Request.prototype.triggerPrice = undefined;
/**
* Signifies if the order is an After Market Order
* @member {Boolean} isAmo
*/
PlaceOrderV3Request.prototype.isAmo = undefined;