ia-common 1.0.1-beta.234 → 1.0.1-beta.236
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/@model.d.ts
CHANGED
|
@@ -18,3 +18,4 @@ export * from "./model/corporate-actions/corporate-action-model";
|
|
|
18
18
|
export * from "./model/corporate-actions/split-bonus-corporate-action-model";
|
|
19
19
|
export * from "./model/corporate-actions/ofs-corporate-action-model";
|
|
20
20
|
export * from "./model/configurations-entity-model";
|
|
21
|
+
export * from "./model/equity-advice-entity-model";
|
package/build/@model.js
CHANGED
|
@@ -34,3 +34,4 @@ __exportStar(require("./model/corporate-actions/corporate-action-model"), export
|
|
|
34
34
|
__exportStar(require("./model/corporate-actions/split-bonus-corporate-action-model"), exports);
|
|
35
35
|
__exportStar(require("./model/corporate-actions/ofs-corporate-action-model"), exports);
|
|
36
36
|
__exportStar(require("./model/configurations-entity-model"), exports);
|
|
37
|
+
__exportStar(require("./model/equity-advice-entity-model"), exports);
|
|
@@ -6,4 +6,5 @@ var KAFKA_TOPICS;
|
|
|
6
6
|
KAFKA_TOPICS["TICKER_SERVICE"] = "ticker-service";
|
|
7
7
|
KAFKA_TOPICS["ADVICE_CREATED"] = "advice.created";
|
|
8
8
|
KAFKA_TOPICS["ADVICE_STATUS_UPDATED"] = "advice_status_updated";
|
|
9
|
+
KAFKA_TOPICS["ADVICE_EXPIRED"] = "advice_expired";
|
|
9
10
|
})(KAFKA_TOPICS || (exports.KAFKA_TOPICS = KAFKA_TOPICS = {}));
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { AdviceType, InvestDurationType, AdviceTransactionType, AdviceStatus } from "../@enum";
|
|
2
|
+
import { IAdviceEntity } from "../@type";
|
|
3
|
+
export declare class EquityAdviceEntityModel implements IAdviceEntity {
|
|
4
|
+
id: number;
|
|
5
|
+
type: AdviceType;
|
|
6
|
+
advisorOrgId: number;
|
|
7
|
+
stockName: string;
|
|
8
|
+
cmp: number;
|
|
9
|
+
targetPrice: number;
|
|
10
|
+
stopLoss: number;
|
|
11
|
+
investmentDurationType: InvestDurationType;
|
|
12
|
+
transactionType: AdviceTransactionType;
|
|
13
|
+
fromDate: number;
|
|
14
|
+
toDate: number;
|
|
15
|
+
noteDocumentUrl: string | null;
|
|
16
|
+
videoUrl: string | null;
|
|
17
|
+
voiceUrl: string | null;
|
|
18
|
+
status: AdviceStatus;
|
|
19
|
+
rationale: string | null;
|
|
20
|
+
targetHitOn: Date | null;
|
|
21
|
+
targetHitCMP: number | null;
|
|
22
|
+
gainLoss: number | null;
|
|
23
|
+
createdOn: Date;
|
|
24
|
+
updatedOn: Date;
|
|
25
|
+
createdBy: number;
|
|
26
|
+
updatedBy: number;
|
|
27
|
+
constructor(data: IAdviceEntity);
|
|
28
|
+
getRandomHigh(): number;
|
|
29
|
+
getGainLoss(randomHigh?: number): number;
|
|
30
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EquityAdviceEntityModel = void 0;
|
|
4
|
+
var _enum_1 = require("../@enum");
|
|
5
|
+
var _utils_1 = require("../@utils");
|
|
6
|
+
var EquityAdviceEntityModel = /** @class */ (function () {
|
|
7
|
+
function EquityAdviceEntityModel(data) {
|
|
8
|
+
Object.assign(this, data);
|
|
9
|
+
}
|
|
10
|
+
EquityAdviceEntityModel.prototype.getRandomHigh = function () {
|
|
11
|
+
var randomHigh = 0;
|
|
12
|
+
if (this.transactionType !== _enum_1.AdviceTransactionType.SELL) {
|
|
13
|
+
randomHigh = _utils_1.mathUtils.randomNumber(this.stopLoss, this.targetPrice);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
randomHigh = _utils_1.mathUtils.randomNumber(this.targetPrice, this.stopLoss);
|
|
17
|
+
}
|
|
18
|
+
return randomHigh;
|
|
19
|
+
};
|
|
20
|
+
EquityAdviceEntityModel.prototype.getGainLoss = function (randomHigh) {
|
|
21
|
+
return parseFloat((((randomHigh !== null && randomHigh !== void 0 ? randomHigh : this.getRandomHigh() - this.cmp) /
|
|
22
|
+
(this.targetPrice - this.cmp)) *
|
|
23
|
+
100).toFixed(2));
|
|
24
|
+
};
|
|
25
|
+
return EquityAdviceEntityModel;
|
|
26
|
+
}());
|
|
27
|
+
exports.EquityAdviceEntityModel = EquityAdviceEntityModel;
|