igniteui-react-core
Version:
Ignite UI React Core.
128 lines (127 loc) • 4.04 kB
JavaScript
/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { __extends } from "tslib";
import { StockInfo } from "./StockInfo";
import { markType } from "./type";
/**
* @hidden
*/
var StockPosition = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(StockPosition, _super);
function StockPosition() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._index = 0;
_this._tradeDate = new Date();
_this._shares = 0;
_this._costPerShare = 0;
_this._marketPrice = 0;
_this._data = null;
_this._action = null;
return _this;
}
Object.defineProperty(StockPosition.prototype, "index", {
get: function () {
return this._index;
},
set: function (a) {
this._index = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(StockPosition.prototype, "tradeDate", {
get: function () {
return this._tradeDate;
},
set: function (a) {
this._tradeDate = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(StockPosition.prototype, "shares", {
get: function () {
return this._shares;
},
set: function (a) {
this._shares = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(StockPosition.prototype, "costPerShare", {
get: function () {
return this._costPerShare;
},
set: function (a) {
this._costPerShare = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(StockPosition.prototype, "costTotal", {
get: function () {
return Math.round(this.shares * this.costPerShare);
},
enumerable: false,
configurable: true
});
Object.defineProperty(StockPosition.prototype, "marketValue", {
get: function () {
return Math.round(this.shares * this.marketPrice);
},
enumerable: false,
configurable: true
});
Object.defineProperty(StockPosition.prototype, "marketPrice", {
get: function () {
return this._marketPrice;
},
set: function (a) {
this._marketPrice = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(StockPosition.prototype, "gainValue", {
get: function () {
return Math.round(this.marketValue - this.costTotal);
},
enumerable: false,
configurable: true
});
Object.defineProperty(StockPosition.prototype, "gainPercentage", {
get: function () {
return this.gainValue / this.costTotal * 100;
},
enumerable: false,
configurable: true
});
Object.defineProperty(StockPosition.prototype, "data", {
get: function () {
return this._data;
},
set: function (a) {
this._data = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(StockPosition.prototype, "action", {
get: function () {
return this._action;
},
set: function (a) {
this._action = a;
},
enumerable: false,
configurable: true
});
StockPosition.$t = markType(StockPosition, 'StockPosition', StockInfo.$);
return StockPosition;
}(StockInfo));
export { StockPosition };