paddle_quantum.finance.qpo

Quantum portfolio optimization tools.

paddle_quantum.finance.qpo.portfolio_combination_optimization(num_asset, data, iter, lr=None, risk=0.5, budget=None, penalty=None, circuit=2, init_state=None, optimizer=None, measure_shots=2048, logger=None, compare=False)

A highly encapsuled method of the portfolio combination optimization.

Parameters:
  • num_asset (int) – the number of investable asset.

  • data (DataSimulator | Tuple[Tensor, Tensor]) – stock data, a DataSimulator or tuple (covariance_matrix, return_rate_vector).

  • iter (int) – number of optimization cycles.

  • lr (float | None) – learning rate.

  • risk (float) – the coeffcient of risk.

  • budget (int | None) – investment budget, or the maximum counts of projects we invest.

  • penalty (float | None) – the weight of regular terms.

  • circuit (Circuit | int) – the Circuit we use to inference. If int is input, we will construct complex_entangled_layer that times.

  • init_state (State | None) – the initial state of inference circuit, default to be the product state of zero states.

  • optimizer (Optimizer | None) – the paddle.optimizer.Optimizer instance, default to be paddle.optimizer.Adam.

  • measure_shots (int) – the times we measure the end state, default to be 2048.

  • logger (Logger | None) – logging.Logger instance for detail record.

  • compare (bool) – whether compare the loss of end state with the loss of ground state. This will be costly when num_asset too large.

Returns:

the optimal investment strategy as a list.

Return type:

investment_plan

Note

This function is only applied to a well defined problem introduced in Portfolio Optimization.