The solveForROE power is a loan level engine power property that allows you write a chat skill that solves for a given ROE based on changes to certain loan parameters and the utterance defined in the intent. This article will cover using the solveForROE power.

 

In this Article

 

What is the solveForROE power?

The solveForROE power allows you to solve for a desiredROE based on the following parameters defined in your skill code:

  

What are the solverParameters?

The solverParameters is an object used to define what variables will be used to determine the desired return to solve for. The solverParameters are:

  • desiredROE: defined as a number, is a required parameter in which you define the ROE value you want to solve for. The ROE value will be entered as a decimal.
    • For example, if the desiredROE is 20%, define it as .20.
    • If this is a value that may change frequently, consider using skillConfigurationKeys.
  • basedOn: defined as a string, is a required parameter in which the opportunity screen input that will be adjusted to solve for the desiredROE is defined. Variables are available for the following inputs:
    • rate
    • maturity
    • fees
  • initialRate? - defined as a number, as a percentage, is the threshold for the rate value for when the skill should attempt to solve for the desiredROE. If not defined, the rate entered in the selected loan in the opportunity will be used (from commercialLoanAccount), and the skill will attempt to solve for the desiredROE every time the skill should run.
  • initialFees? - defined as a number, as a dollar amount, is the threshold for the initial fees for when the skill should attempt to solve for the desiredROE. If not defined, the fees entered in the selected loan in the opportunity will be used (from commercialLoanAccount), and the skill will attempt to solve for the desiredROE every time the skill should run.
  • initialMaturity? - defined as a number, is the maturity (in months), that will be the threshold for when the skill should attempt to solve for the desiredROE. If not defined, the maturity entered in the the selected loan in the opportunity (from commercialLoanAccount), and the skill will attempt to solve for the desiredROE every time the skill should run.
  • rateType? - defined as a number, is an enum used to set the rate type that will be used in conjuction with the initialRate as the threshold for when the skill should attempt to solve for the desiredROE. If not defined, the rate type of the selected loan in the opportunity will be used (from commercialLoanAccount), and the skill will attempt to solve for the desiredROE every time the skill should run. The enum values are:
    • 0: fixed
    • 2: floating
    • 4: adjustable

 

What are the solverSettings?

The solverSettings is an object used to set the constraints around the desired ROE result and are stored as an object. The solverSettings are:

  • returnTolerance - defined as a number, is the tolerance allowed for achieving the desiredROE.
    • For example, if the desiredROE is .20, setting a threshold of .005 means that a solverResult of .198 for the ROE would be an acceptable result.
  • minValue - defined as a number, is the minimum allowed value of the basedOn variable defined as part of the solverParameters.
  • maxValue - defined as a number, is the maximum allowed value of the basedOn variable defined as part of the solverParameters.
  • round- defined as a number, is the number of decimal points to round the ROE to.

If solverSettings are not defined in the skill code, default solverSettings will be applied. The default settings are:

  • returnTolerance - 0.00005
  • minValue - 0.0001
  • maxValue - 1
  • round - 5

 

What are the solverResults?

The solverResults are the available values that will be returned based on the variable (basedOn) you're using to reach the desiredROE. For instance, if you're trying to solve for a desiredROE basedOn rate, then you'll use the solverResult for rate.

The solverResults are:

  • rate - defined as a number, is the rate, as a percentage, that would need to be entered in the opportunity for the desiredROE to be reached.
  • roe - defined as a number, is the resulting ROE after the desiredROE is solved for.
  • fees - defined as a number, is the initial fee, as a dollar amount, that would need to be entered in the opportunity for the desiredROE to be reached.
  • spread - defined as a number, is the spread, as a percentage, that would need to be entered in the opportunity for a floating or adjustable rate loan the desiredROE to be reached.
  • maturity - defined as a number, is the maturity (in months) that would need to be entered in the opportunity for the desiredROE to be reached.
  • solved - defined as boolean, indicates whether or not the desiredROE was successfully solved for

 

How to use the solveForROE power

To use the solveForROE power, you'll first need to define your solveParmeters and SolverSettings. Using an example of a skill that will solve for a desiredROE of 15% basedOn rate, this looks like the following:

const solveParameters: SolverParameters = {
    desiredRoe: 0.15, // 15%
    basedOn: "rate" 
};

const solverSettings: SolverSettings = {
    minValue: 0; // rate can not be below 0%
    maxvalue: 1; // rate can not be above 100%
    returnTolerance: 0.00005;
    round: 2
}

You'll also need to define the loan the information will be retrieved from and that the solverResult will be returned to. To obtain the solverResult, you'll call the solveForROE power as follows:

skillContext.powers.precisionLender.engine.loan.solveForROE (solveParameters, 
commercialLoanAccountEntity, solverSettings)

Continuing with our earlier example, defining the loan account and using the power to obtain the result would look like the following:

const eventData: OpportunityModel = await skillContext.powers.precisionLender
.opportunity.getCurrentOpportunityModel(); const currentLoanId: string = eventData.contextId; const currentLoan: CommercialLoanAccount = eventData.engineModel.commercialLoanAccounts.find((loan) => { return loan.id === currentLoanId; }); const results: solverResults = await skillContext.powers.precisionLender.engine.loan.solveForRoe(solveParameters, currentLoan, solverSettings);

 You can then pass the results as a message in a simpleHeader using the chat power. 

if (results.solved) {
return skillContext.powers.andi.chat.sendSimpleHeader(`Set the rate to ${results.rate} to
achieve an ${solveParameters.desiredRoe * 100}% return`);
} else {
return skillContext.powers.andi.chat.sendSimpleHeader(
`Unable to solve for a ${solveParameters.desiredRoe * 100}% return.
Select another value.`);
}
Was this article helpful?
0 out of 0 found this helpful