Files
Superalgos/Projects/Portfolio-Management/TS/Modules/PortfolioManagerClient.js
T

64 lines
1.9 KiB
JavaScript

exports.newPortfolioManagementModulesPortfolioManagerClient = function (processIndex) {
/*
This object represents a proxy of the Profile Manager. It is used to send
questions to the Event and Formula Managers and receive their answers.
*/
let thisObject = {
askPortfolioEventsManager: askPortfolioEventsManager,
askPortfolioFormulaManager: askPortfolioFormulaManager,
initialize: initialize,
finalize: finalize
}
return thisObject
function initialize() {
}
function finalize() {
}
async function askPortfolioEventsManager(eventNode, eventStatus) {
let reponse = {
raiseEvent: eventStatus,
reason: "No need to ask Portfolio Manager"
}
if (eventNode.askPortfolioEventsManager === undefined) {
return reponse
}
if (eventStatus === true) {
/*
First we will check if the Portfolio Manager confirms this event
can be raised.
*/
if (eventNode.askPortfolioEventsManager.confirmEvent !== undefined) {
let message = {
question: "Confirm This Event Can Be Raised",
event: eventNode.type
}
reponse = await portfolioManagerEventsClient.sendMessage(message)
}
} else {
/*
In this case, we will check if the Porfolio Manager would like to
raise this event anyways.
*/
if (eventNode.askPortfolioEventsManager.raiseEvent !== undefined) {
let message = {
question: "Must This Event Be Raised",
event: eventNode.type
}
reponse = await portfolioManagerEventsClient.sendMessage(message)
}
}
return response
}
async function askPortfolioFormulaManager() {
}
}