igniteui-react-core
Version:
Ignite UI React Core.
82 lines (81 loc) • 2.47 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 { StockInfo } from "./StockInfo";
import { markType } from "./type";
/**
* @hidden
*/
export let StockPosition = /*@__PURE__*/ (() => {
class StockPosition extends StockInfo {
constructor() {
super(...arguments);
this._index = 0;
this._tradeDate = new Date();
this._shares = 0;
this._costPerShare = 0;
this._marketPrice = 0;
this._data = null;
this._action = null;
}
get index() {
return this._index;
}
set index(a) {
this._index = a;
}
get tradeDate() {
return this._tradeDate;
}
set tradeDate(a) {
this._tradeDate = a;
}
get shares() {
return this._shares;
}
set shares(a) {
this._shares = a;
}
get costPerShare() {
return this._costPerShare;
}
set costPerShare(a) {
this._costPerShare = a;
}
get costTotal() {
return Math.round(this.shares * this.costPerShare);
}
get marketValue() {
return Math.round(this.shares * this.marketPrice);
}
get marketPrice() {
return this._marketPrice;
}
set marketPrice(a) {
this._marketPrice = a;
}
get gainValue() {
return Math.round(this.marketValue - this.costTotal);
}
get gainPercentage() {
return this.gainValue / this.costTotal * 100;
}
get data() {
return this._data;
}
set data(a) {
this._data = a;
}
get action() {
return this._action;
}
set action(a) {
this._action = a;
}
}
StockPosition.$t = /*@__PURE__*/ markType(StockPosition, 'StockPosition', StockInfo.$);
return StockPosition;
})();