upstox-js-sdk
Version:
The official Node Js client for communicating with the Upstox API
133 lines (121 loc) • 3.62 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 GttRule model module.
* @module model/GttRule
* @version v0
*/
export class GttRule {
/**
* Constructs a new <code>GttRule</code>.
* List of rules defining the conditions for each leg in the GTT order
* @alias module:model/GttRule
* @class
* @param strategy {module:model/GttRule.StrategyEnum} Defines the strategy for the GTT order leg: ENTRY - First leg order STOPLOSS - Stop-loss order TARGET - Target order
* @param triggerType {module:model/GttRule.TriggerTypeEnum} Trigger type for each leg of the order
* @param triggerPrice {Number} Trigger price for the GTT order leg
*/
constructor(strategy, triggerType, triggerPrice) {
this.strategy = strategy;
this.triggerType = triggerType;
this.triggerPrice = triggerPrice;
}
/**
* Constructs a <code>GttRule</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/GttRule} obj Optional instance to populate.
* @return {module:model/GttRule} The populated <code>GttRule</code> instance.
*/
static constructFromObject(data, obj) {
if (data) {
obj = obj || new GttRule();
if (data.hasOwnProperty('strategy'))
obj.strategy = ApiClient.convertToType(data['strategy'], 'String');
if (data.hasOwnProperty('trigger_type'))
obj.triggerType = ApiClient.convertToType(data['trigger_type'], 'String');
if (data.hasOwnProperty('trigger_price'))
obj.triggerPrice = ApiClient.convertToType(data['trigger_price'], 'Number');
if (data.hasOwnProperty('trailing_gap'))
obj.trailingGap = ApiClient.convertToType(data['trailing_gap'], 'Number');
}
return obj;
}
}
/**
* Allowed values for the <code>strategy</code> property.
* @enum {String}
* @readonly
*/
GttRule.StrategyEnum = {
/**
* value: "ENTRY"
* @const
*/
ENTRY: "ENTRY",
/**
* value: "STOPLOSS"
* @const
*/
STOPLOSS: "STOPLOSS",
/**
* value: "TARGET"
* @const
*/
TARGET: "TARGET"
};
/**
* Defines the strategy for the GTT order leg: ENTRY - First leg order STOPLOSS - Stop-loss order TARGET - Target order
* @member {module:model/GttRule.StrategyEnum} strategy
*/
GttRule.prototype.strategy = undefined;
/**
* Allowed values for the <code>triggerType</code> property.
* @enum {String}
* @readonly
*/
GttRule.TriggerTypeEnum = {
/**
* value: "ABOVE"
* @const
*/
ABOVE: "ABOVE",
/**
* value: "BELOW"
* @const
*/
BELOW: "BELOW",
/**
* value: "IMMEDIATE"
* @const
*/
IMMEDIATE: "IMMEDIATE"
};
/**
* Trigger type for each leg of the order
* @member {module:model/GttRule.TriggerTypeEnum} triggerType
*/
GttRule.prototype.triggerType = undefined;
/**
* Trigger price for the GTT order leg
* @member {Number} triggerPrice
*/
GttRule.prototype.triggerPrice = undefined;
/**
* Optional parameter defining the trailing gap for the GTT order
* @member {Number} trailingGap
*/
GttRule.prototype.trailingGap = undefined;