Here are the four common objectives:

**Risk Minimization****Mean Variance Optimization****Maximizing Returns using Risk Targeting****Custom weighted objective****Tracking Benchmarks****Factor Targeting**

## Risk Minimization

The optimizer can account for two types of risk: total risk and factor risk. In each case, the optimizer can either lower the total risk, or lower factor risk of the provided position set. The optimizer will find the best combination of trades in order to minimize these risks.

The structure of the **objective** for minimizing total risk is:

`{ "minimizeTotalRisk": true }`

Otherwise, you may be interested in lowering your factor risk. The structure of the **objective** for minimizing factor risk is:

`{ "minimizeFactorRisk": true }`

## Mean-Variance Optimization

Similar to risk minimization, the mean-variance optimization also tries to lower your total / factor risk. In this case, the optimizer is also able to account for your expected returns. By setting the objective to one of the risk minimization objectives (total risk minimization or factor risk minimization from above) and **sending in expected forecasts**, you can achieve a more optimal risk-adjusted return.

Follow along with this article, API Use Case: Mean Variance Optimization Walkthrough

## Maximizing Returns using Risk Targeting with Forecasts

The `targetTotalRisk`

optimization works in conjunction with an expected returns `forecast`

, thereby finding the portfolio with maximized expected returns and will not exceed the provided risk target. In effect, this objective is best thought of as a `maximizeReturns`

function, taking the inputted target risk value as a max risk constraint.

This objective can be achieved like this:

`{ "targetTotalRisk": 0.12 }`

where 0.12 corresponds to a 12% total risk target.

It is possible to get the full range of risk available for the same set of expected returns by running two separate optimizations. When requesting

`optimization(...){`

risk {

total

}

}

- Set the objective to
`{ "targetTotalRisk": 0.00 }`

and run this optimization to obtain the minimum risk value - Set the objective to
`{ "targetTotalRisk": 1000.00 }`

and run this optimization to obtain the maximum risk value

All valid risk values are in between the two returned risk values and can be used to target total risk.

Please note:

- If no forecast is passed in, the optimizer will return the portfolio associated with your minimal total risk.
- If the provided target risk is below the minimum possible risk, then the minimum risk portfolio is returned.
- If the provided target risk is above the risk of the maximum return portfolio, then the maximum return portfolio is returned.
- This behavior is similar for the
`"targetFactorRisk"`

objective.

## Custom-Weighted Objective

Using the `query.model.optimization(objective.custom)`

input, you can include a custom objective using one or several objective terms, allowing for the setting of the relative importance between the different objective terms. The current objective terms supported include: maximize forecast returns, minimize market impact, and minimize factor risk / stock specific risk.**Objective Options**

`{`

"objective": {

"custom": {

"minimizeRisk": {

"factorRisk": {

"weight": 3

},

"specificRisk": {

"weight": 1

}

},

"minimizeMarketImpact": {

"weight": 10

},

"maximizeForecastReturn": {

"weight": 5

}

}

}

}

All terms in this custom objective are weighted relative to one another, where weights are defined to be greater than or equal to 0.

## Tracking Benchmarks

Often a manager will want to analyze their performance compared to a benchmark. The optimizer can account for this tracking by offering an “active” version to any objective. Passing in your positions with the position set for your preferred benchmark will signal the optimizer to return all trades and metrics based on the active objective.

Learn more about Benchmarks and their usage in the API.

Below is a sample query that would achieve a standard mean-variance optimization, using a forecast and tracking against the S&P500 benchmark.

**Query with benchmark**

`query (`

$positionSet: PositionSetInput!,

$objective: [OptimizationObjective]!,

$modelId: String!,

$forecast: ForecastInput!,

$benchmark: PositionSetInput!

) {

model(id: $modelId) {

optimization(

positionSet: $positionSet,

objective: $objective,

constraints: {},

forecast: $forecast,

base: [$benchmark]) {

positionsDelta {

date

equities {

id {

ticker

mic

}

economicExposure

}

}

}

}

}

**Query Variables**

`{`

"positionSet": {

"dates": {

"date": "2017-06-30",

"equities": [{

"id": {

"ticker": "GOOG",

"mic": "XNAS"

},

"economicExposure": 1000.00

}, {

"id": {

"ticker": "IBM",

"mic": "XNYS"

},

"economicExposure": 2000.00

}]

}

},

"objective": [{

"minimizeTotalRisk": true

}],

"modelId": "xxxxx-xx",

"forecast": {

"horizon": 20,

"equities": [{

"id": {

"ticker": "GOOG",

"mic": "XNAS"

},

"expectedPercentReturn": 0.12

}, {

"id": {

"ticker": "IBM",

"mic": "XNYS"

},

"expectedPercentReturn": 0.275

}]

},

"benchmark": {

"type": "BENCHMARK",

"id": "SP500"

}

}

## Factor Targeting

In addition to factor risk minimization, the optimizer can isolate specific factors and target your desired factor exposure z-score for each factor specified in a list. For example, if your book has been over-exposed to *volatility* (with a current exposure of 3.24) and you are targeting an exposure of 1.4, as well as, targeting a *size* exposure of 1.2, then with **objective.targetExposures** you can specify the following:

`{`

"targetExposures": [{

"id": "Volatility",

"target": 1.4

},{

"id": "Size",

"target": 1.2

}]

}

**Query with target exposure objective and additional constraints**

`query (`

$positionSet: PositionSetInput!,

$objective: [OptimizationObjective]!,

$modelId: String!,

$constraints: OptimizationConstraints!

) {

model(id: $modelId) {

optimization(

positionSet: $positionSet,

objective: $objective,

constraints: $constraints) {

positionsDelta {

date

equities {

id {

ticker

mic

}

economicExposure

}

}

}

}

}

**Variables**

`{`

"positionSet": {

"dates": {

"date": "2017-06-30",

"equities": [{

"id": {

"ticker": "GOOG",

"mic": "XNAS"

},

"economicExposure": 1000.00

}, {

"id": {

"ticker": "IBM",

"mic": "XNYS"

},

"economicExposure": 2000.00

}]

}

},

"objective": {

"targetExposures": [{

"id": "Volatility",

"target": 1.4

},{

"id": "Size",

"target": 1.2

}]

},

"modelId": "xxxxx-xx"

}